diff options
author | fireice-uk <fireice-uk@users.noreply.github.com> | 2018-02-21 21:31:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-21 21:31:51 +0000 |
commit | aa34bac1397acdd3ec042bdf31cdae50cb83fbbb (patch) | |
tree | 800a3013746b20d59e5d648bd52980fe4c37e5df /xmrstak/backend/amd/amd_gpu/gpu.cpp | |
parent | cba86718e05384aa7bc4e4b916cf3b3c942b126a (diff) | |
parent | 7b3929dbeff5254a77dcd2c6be89324a11adf4c8 (diff) | |
download | xmr-stak-aa34bac1397acdd3ec042bdf31cdae50cb83fbbb.zip xmr-stak-aa34bac1397acdd3ec042bdf31cdae50cb83fbbb.tar.gz |
Merge pull request #1101 from psychocrypt/topic-mesaSupport
add Mesa OpenCL support
Diffstat (limited to 'xmrstak/backend/amd/amd_gpu/gpu.cpp')
-rw-r--r-- | xmrstak/backend/amd/amd_gpu/gpu.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp index 2f16b67..48eeef5 100644 --- a/xmrstak/backend/amd/amd_gpu/gpu.cpp +++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp @@ -549,6 +549,8 @@ int getAMDPlatformIdx() clStatus = clGetPlatformIDs(numPlatforms, platforms, NULL); int platformIndex = -1; + // Mesa OpenCL is the fallback if no AMD or Apple OpenCL is found + int mesaPlatform = -1; if(clStatus == CL_SUCCESS) { @@ -559,13 +561,29 @@ int getAMDPlatformIdx() clGetPlatformInfo(platforms[i], CL_PLATFORM_VENDOR, infoSize, platformNameVec.data(), NULL); std::string platformName(platformNameVec.data()); - if( platformName.find("Advanced Micro Devices") != std::string::npos || platformName.find("Apple") != std::string::npos) + if( platformName.find("Advanced Micro Devices") != std::string::npos || + platformName.find("Apple") != std::string::npos || + platformName.find("Mesa") != std::string::npos + ) { - platformIndex = i; + printer::inst()->print_msg(L0,"Found AMD platform index id = %i, name = %s",i , platformName.c_str()); - break; + if(platformName.find("Mesa") != std::string::npos) + mesaPlatform = i; + else + { + // exit if AMD or Apple platform is found + platformIndex = i; + break; + } } } + // fall back to Mesa OpenCL + if(platformIndex == -1 && mesaPlatform != -1) + { + printer::inst()->print_msg(L0,"No AMD platform found select Mesa as OpenCL platform"); + platformIndex = mesaPlatform; + } } else printer::inst()->print_msg(L1,"WARNING: %s when calling clGetPlatformIDs for platform information.", err_to_str(clStatus)); |