diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp index 7c7aff788ad60b52024a1db0f5919b4e6b981ecb..2c292754ae2bf06046fdb1d0c9fc7ea3db5d2380 100644 --- a/xmrstak/backend/amd/amd_gpu/gpu.cpp +++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp @@ -420,6 +420,11 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_ options += " -DMEMORY=" + std::to_string(hashMemSize); options += " -DALGO=" + std::to_string(miner_algo[ii]); options += " -DCN_UNROLL=" + std::to_string(ctx->unroll); + /* AMD driver output is something like: `1445.5 (VM)` + * and is mapped to `14` only. The value is only used for a compiler + * workaround. + */ + options += " -DOPENCL_DRIVER_MAJOR=" + std::to_string(std::stoi(openCLDriverVer.data()) / 100); /* create a hash for the compile time cache * used data: diff --git a/xmrstak/backend/amd/amd_gpu/opencl/fast_int_math_v2.cl b/xmrstak/backend/amd/amd_gpu/opencl/fast_int_math_v2.cl index 607806b7ad492d29fad7cfd3348b2a8218d17d1a..55768d38584d151b62dcdef97b02c528887a8f46 100644 --- a/xmrstak/backend/amd/amd_gpu/opencl/fast_int_math_v2.cl +++ b/xmrstak/backend/amd/amd_gpu/opencl/fast_int_math_v2.cl @@ -2,6 +2,10 @@ R"===( /* * @author SChernykh */ + +// cryptonight_monero_v8 +#if(ALGO==11) + static const __constant uint RCP_C[256] = { 0xfe01be73u,0xfd07ff01u,0xfa118c5au,0xf924fb13u,0xf630cddbu,0xf558f73cu,0xf25f2934u,0xf1a3f37bu, @@ -68,9 +72,19 @@ inline uint2 fast_div_v2(const __local uint *RCP, ulong a, uint b) const ulong k = mul_hi(as_uint2(a).s0, r) + ((ulong)(r) * as_uint2(a).s1) + a; ulong q; - ((uint*)&q)[0] = as_uint2(k).s1;; - ((uint*)&q)[1] = (k < a) ? 1 : 0; - + ((uint*)&q)[0] = as_uint2(k).s1; + +#if defined(cl_amd_device_attribute_query) && (OPENCL_DRIVER_MAJOR == 14) + /* The AMD driver 14.XX is not able to compile `(k < a)` + * https://github.com/fireice-uk/xmr-stak/issues/1922 + * This is a workaround for the broken compiler. + */ + const long xx = k - a; + ((uint*)&q)[1] = (xx < 0) ? 1U : 0U; +#else + ((uint*)&q)[1] = (k < a) ? 1U : 0U; +#endif + const long tmp = a - q * b; const bool overshoot = (tmp < 0); const bool undershoot = (tmp >= b); @@ -105,4 +119,7 @@ inline uint fast_sqrt_v2(const ulong n1) return result; } + +#endif + )==="