mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-17 05:41:41 +02:00
add Mesa OpenCL support
allow usage of Mesa OpenCl
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -14,6 +14,11 @@ R"===(
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* For Mesa clover support */
|
||||
#ifdef cl_clang_storage_class_specifiers
|
||||
# pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
|
||||
#endif
|
||||
|
||||
#ifdef cl_amd_media_ops
|
||||
#pragma OPENCL EXTENSION cl_amd_media_ops : enable
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user