Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[codespell]
skip = ./third_party/simde,./.git,./benchmark/python,./experiments,./gh-pages,./build
skip = ./third_party/simde-0.8.2,./.git,./benchmark/python,./experiments,./gh-pages,./build
ignore-words-list=shft
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ install (
DESTINATION include
FILES_MATCHING PATTERN "*.hpp")
install (
DIRECTORY ${CMAKE_SOURCE_DIR}/third_party/simde
DIRECTORY ${CMAKE_SOURCE_DIR}/third_party/simde-0.8.2
DESTINATION include/${HPCOMBI_INSTALL_DIR})
install (
FILES ${CMAKE_CURRENT_BINARY_DIR}/hpcombi.pc
Expand Down
3 changes: 1 addition & 2 deletions examples/Renner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
#include <unordered_map>
#endif

#include "simde/x86/sse4.1.h" // for simde_mm_max_epu8, simde...
#include "hpcombi/perm16.hpp"

#include "simde-0.8.2/x86/sse4.1.h" // for simde_mm_max_epu8, simde...

template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
Expand Down
47 changes: 24 additions & 23 deletions examples/pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@
#else
#include <unordered_map>
#endif
#include "simde/x86/sse4.1.h" // for simde_mm_max_epu8, simde...
#include "simde-0.8.2/x86/sse4.1.h" // for simde_mm_max_epu8, simde...

#include "hpcombi/perm16.hpp"

template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
out << '[';
if (!v.empty()) {
auto i = v.begin();
for (; i != --v.end(); ++i)
out << std::setw(2) << *i << ",";
out << std::setw(2) << *i;
}
out << "]";
return out;
out << '[';
if (!v.empty()) {
auto i = v.begin();
for (; i != --v.end(); ++i)
out << std::setw(2) << *i << ",";
out << std::setw(2) << *i;
}
out << "]";
return out;
}

using namespace std;
Expand All @@ -54,16 +54,18 @@ std::vector<epu8> subsets;
std::vector<epu8> subperm;

epu8 tosubset(uint16_t n) {
epu8 res {};
epu8 res{};
for (int i = 0; i < 16; i++) {
if (((n >> i) & 1) != 0) res[i] = 0xff;
if (((n >> i) & 1) != 0)
res[i] = 0xff;
}
if (simde_mm_movemask_epi8(res) != n) cout << n << "BUG" << res << endl;
if (simde_mm_movemask_epi8(res) != n)
cout << n << "BUG" << res << endl;
return res;
}

epu8 subset_to_perm(epu8 s) {
epu8 res = Epu8({},0xff);
epu8 res = Epu8({}, 0xff);
int c = 0;
for (int i = 0; i < 16; i++) {
if (s[i] != 0) {
Expand All @@ -76,27 +78,26 @@ epu8 subset_to_perm(epu8 s) {

void make_subsets_of_size(int n, int k) {
int n2 = 1 << n;
for (uint16_t i=0; i < n2; i++) {
for (uint16_t i = 0; i < n2; i++) {
if (__builtin_popcountl(i) == k) {
subsets.push_back(tosubset(i));
subperm.push_back(subset_to_perm(tosubset(i)));
}
}
}

template <int Size>
epu8 extract_pattern(epu8 perm, epu8 permset) {
template <int Size> epu8 extract_pattern(epu8 perm, epu8 permset) {
epu8 cst = Epu8({}, Size);
epu8 res = permuted(perm, permset) | (Epu8.id() >= cst);
res = sort_perm(res) & (Epu8.id() < cst);
return res;
}

template <int Size>
bool has_pattern(epu8 perm, epu8 patt) {
template <int Size> bool has_pattern(epu8 perm, epu8 patt) {
for (size_t i = 0; i < subperm.size(); i++) {
epu8 extr = extract_pattern<Size>(perm, subperm[i]);
if (equal(extr, patt)) return true;
if (equal(extr, patt))
return true;
}
return false;
}
Expand All @@ -106,13 +107,13 @@ int main() {
int n = 8, k = 4, n2 = 1 << n;
make_subsets_of_size(n, k);
cout << subsets.size() << endl;
epu8 perm = {1,4,2,0,3,5,6,7};
epu8 perm = {1, 4, 2, 0, 3, 5, 6, 7};
int i = 42;
cout << Perm16::one() << endl;
cout << perm << endl;
cout << subsets[i] << endl;
cout << simde_mm_movemask_epi8(subsets[i]) << endl;
cout << extract_pattern<4>(perm, subperm[i]) << endl;
cout << int(has_pattern<4>(perm, epu8 {2,1,0,3})) << endl;
cout << int(has_pattern<4>(perm, epu8 {3,2,1,0})) << endl;
cout << int(has_pattern<4>(perm, epu8{2, 1, 0, 3})) << endl;
cout << int(has_pattern<4>(perm, epu8{3, 2, 1, 0})) << endl;
}
2 changes: 1 addition & 1 deletion include/hpcombi/bmat16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "bmat8.hpp" // for BMat8
#include "debug.hpp" // for HPCOMBI_ASSERT

#include "simde/x86/avx2.h"
#include "simde-0.8.2/x86/avx2.h"

namespace HPCombi {
using xpu16 = uint16_t __attribute__((vector_size(32)));
Expand Down
4 changes: 2 additions & 2 deletions include/hpcombi/epu8.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ eg simde_mm_testz_si128(a,a) → is_all_zero(a) */
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
#endif
#include "simde/x86/sse4.1.h" // for simde_mm_max_epu8, simde...
#include "simde/x86/sse4.2.h" // for ???
#include "simde-0.8.2/x86/sse4.1.h" // for simde_mm_max_epu8, simde...
#include "simde-0.8.2/x86/sse4.2.h" // for ???
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
Expand Down
4 changes: 2 additions & 2 deletions include/hpcombi/perm16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
#endif
#include "simde/x86/sse4.1.h"
#include "simde/x86/sse4.2.h"
#include "simde-0.8.2/x86/sse4.1.h"
#include "simde-0.8.2/x86/sse4.2.h"
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
Expand Down
Loading