Skip to content

Commit c19294f

Browse files
authored
[SYCL][ROCM] Added ROCm backend to device filter (#4077)
Adding rocm backend to SyclBeMap, so the device filter does not throw errors with ROCm backend Updated error message from device filter to include ROCm.
1 parent 8636e75 commit c19294f

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

sycl/source/detail/config.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,12 @@ static const std::array<std::pair<std::string, info::device_type>, 5>
185185
{"*", info::device_type::all}}};
186186

187187
// Array is used by SYCL_DEVICE_FILTER and SYCL_DEVICE_ALLOWLIST
188-
static const std::array<std::pair<std::string, backend>, 5> SyclBeMap = {
188+
static const std::array<std::pair<std::string, backend>, 6> SyclBeMap = {
189189
{{"host", backend::host},
190190
{"opencl", backend::opencl},
191191
{"level_zero", backend::level_zero},
192192
{"cuda", backend::cuda},
193+
{"rocm", backend::rocm},
193194
{"*", backend::all}}};
194195

195196
template <> class SYCLConfig<SYCL_DEVICE_FILTER> {

sycl/source/detail/device_filter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ device_filter::device_filter(const std::string &FilterString) {
7575
} catch (...) {
7676
std::string Message =
7777
std::string("Invalid device filter: ") + FilterString +
78-
"\nPossible backend values are {host,opencl,level_zero,cuda,*}.\n"
78+
"\nPossible backend values are "
79+
"{host,opencl,level_zero,cuda,rocm,*}.\n"
7980
"Possible device types are {host,cpu,gpu,acc,*}.\n"
8081
"Device number should be an non-negative integer.\n";
8182
throw cl::sycl::invalid_parameter_error(Message, PI_INVALID_VALUE);

sycl/unittests/allowlist/ParseAllowList.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,10 @@ TEST(ParseAllowListTests, CheckAllValidBackendNameValuesAreProcessed) {
164164
}
165165
sycl::detail::AllowListParsedT ActualValue =
166166
sycl::detail::parseAllowList(AllowList);
167-
sycl::detail::AllowListParsedT ExpectedValue{{{"BackendName", "host"}},
168-
{{"BackendName", "opencl"}},
169-
{{"BackendName", "level_zero"}},
170-
{{"BackendName", "cuda"}},
171-
{{"BackendName", "*"}}};
167+
sycl::detail::AllowListParsedT ExpectedValue{
168+
{{"BackendName", "host"}}, {{"BackendName", "opencl"}},
169+
{{"BackendName", "level_zero"}}, {{"BackendName", "cuda"}},
170+
{{"BackendName", "rocm"}}, {{"BackendName", "*"}}};
172171
EXPECT_EQ(ExpectedValue, ActualValue);
173172
}
174173

0 commit comments

Comments
 (0)