Skip to content

Commit d6dac11

Browse files
committed
[SYCL][OpenCL] Ban AMD OpenCL platform (#5825)
Compiling kernels for it is not supported, device info sometimes throws, and there is HIP backend. Closes #5825
1 parent 4a4702e commit d6dac11

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

sycl/source/detail/platform_impl.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,28 @@ static bool IsBannedPlatform(platform Platform) {
7575
// To avoid problems on default users and deployment of DPC++ on platforms
7676
// where CUDA is available, the OpenCL support is disabled.
7777
//
78-
auto IsNVIDIAOpenCL = [](platform Platform) {
78+
// There is also no support for the AMD HSA backend for OpenCL consumption,
79+
// as well as reported problems with device queries, so AMD OpenCL support
80+
// is disabled as well.
81+
//
82+
auto IsMatchingOpenCL = [](platform Platform, const std::string_view name) {
7983
if (getSyclObjImpl(Platform)->is_host())
8084
return false;
8185

82-
const bool HasCUDA = Platform.get_info<info::platform::name>().find(
83-
"NVIDIA CUDA") != std::string::npos;
86+
const bool HasNameMatch = Platform.get_info<info::platform::name>().find(
87+
name) != std::string::npos;
8488
const auto Backend =
8589
detail::getSyclObjImpl(Platform)->getPlugin().getBackend();
86-
const bool IsCUDAOCL = (HasCUDA && Backend == backend::opencl);
87-
if (detail::pi::trace(detail::pi::TraceLevel::PI_TRACE_ALL) && IsCUDAOCL) {
88-
std::cout << "SYCL_PI_TRACE[all]: "
89-
<< "NVIDIA CUDA OpenCL platform found but is not compatible."
90-
<< std::endl;
90+
const bool IsMatchingOCL = (HasNameMatch && Backend == backend::opencl);
91+
if (detail::pi::trace(detail::pi::TraceLevel::PI_TRACE_ALL) &&
92+
IsMatchingOCL) {
93+
std::cout << "SYCL_PI_TRACE[all]: " << name
94+
<< " OpenCL platform found but is not compatible." << std::endl;
9195
}
92-
return IsCUDAOCL;
96+
return IsMatchingOCL;
9397
};
94-
return IsNVIDIAOpenCL(Platform);
98+
return IsMatchingOpenCL(Platform, "NVIDIA CUDA") ||
99+
IsMatchingOpenCL(Platform, "AMD Accelerated Parallel Processing");
95100
}
96101

97102
// This routine has the side effect of registering each platform's last device

0 commit comments

Comments
 (0)