Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CN_GPU: Fix old compilers and old kernels (Clang 3.5 tested, without CONFIG_HUGETLBFS) #2274

Merged
merged 1 commit into from
Mar 7, 2019
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
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