Skip to content

Commit

Permalink
Merge pull request #2274 from Spudz76/dev-fix-clang35
Browse files Browse the repository at this point in the history
CN_GPU: Fix old compilers and old kernels (Clang 3.5 tested, without CONFIG_HUGETLBFS)
  • Loading branch information
psychocrypt authored Mar 7, 2019
2 parents c1f83fe + 70aea9c commit 09a92e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xmrstak/backend/cpu/crypto/cn_gpu_avx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#include "../../cryptonight.hpp"

#pragma GCC target ("avx2")
#ifndef _mm256_bslli_epi128
#define _mm256_bslli_epi128(a, count) _mm256_slli_si256((a), (count))
#endif
#ifndef _mm256_bsrli_epi128
#define _mm256_bsrli_epi128(a, count) _mm256_srli_si256((a), (count))
#endif

inline void prep_dv_avx(__m256i* idx, __m256i& v, __m256& n01)
{
Expand Down
7 changes: 7 additions & 0 deletions xmrstak/backend/cpu/crypto/cryptonight_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, al
#else
ptr->long_state = (uint8_t*)mmap(NULL, hashMemSize, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, -1, 0);
if (ptr->long_state == MAP_FAILED)
{
// try without MAP_HUGETLB for crappy kernels
msg->warning = "mmap with HUGETLB failed, attempting without it (you should fix your kernel)";
ptr->long_state = (uint8_t*)mmap(NULL, hashMemSize, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
}
#endif

if (ptr->long_state == MAP_FAILED)
Expand Down

0 comments on commit 09a92e9

Please sign in to comment.