Skip to content
Snippets Groups Projects
Unverified Commit aa34bac1 authored by fireice-uk's avatar fireice-uk Committed by GitHub
Browse files

Merge pull request #1101 from psychocrypt/topic-mesaSupport

add Mesa OpenCL support
parents cba86718 7b3929db
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
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