Skip to content
Snippets Groups Projects
Commit 70aea9c7 authored by Tony Butler's avatar Tony Butler
Browse files

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

parent b5918237
No related branches found
No related tags found
No related merge requests found
......@@ -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)
{
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment