Skip to content

Commit 07ebd36

Browse files
authored
[UR] Skip CTS testing on certain platforms (intel#18622)
This adds a platform blacklist that causes all tests on that platform to be skipped. The AMD OpenCL device is currently the only platform on this list (as we don't officially support it - users should use the HIP backend instead).
1 parent 4438a4b commit 07ebd36

File tree

3 files changed

+52
-8
lines changed

3 files changed

+52
-8
lines changed

unified-runtime/scripts/core/INTRO.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,10 @@ no valid platforms, then the tests will fail. Command line arguments take priori
426426

427427
.. envvar:: UR_CTS_ALSO_RUN_KNOWN_FAILURES
428428

429-
A boolean option to enable running tests which have been marked as known
430-
failures using the :c:macro:`UUR_KNOWN_FAILURE_ON` macro. Enabled when the
431-
environment variable is set to any of the following values: ``1``, ``on``,
432-
``ON``, ``yes``, ``YES``, ``true``, ``TRUE``.
429+
A boolean option to enable running tests which have been either marked as known
430+
failures using the :c:macro:`UUR_KNOWN_FAILURE_ON` macro or would run on a
431+
blacklisted platform. Enabled when the environment variable is set to any of
432+
the following values: ``1``, ``on``, ``ON``, ``yes``, ``YES``, ``true``, ``TRUE``.
433433

434434
Service identifiers
435435
---------------------

unified-runtime/test/conformance/testing/include/uur/fixtures.h

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,40 @@
1818

1919
namespace uur {
2020

21+
namespace {
22+
// By default we skip certain platforms that we don't officially support and are unstable
23+
void checkBlacklisted(ur_platform_handle_t platform) {
24+
static const std::array<uur::Matcher, 1> BLACKLISTED_PLATFORMS{
25+
uur::OpenCL{"AMD Accelerated Parallel Processing"},
26+
};
27+
28+
if (uur::alsoRunKnownFailures()) {
29+
return;
30+
}
31+
32+
ur_adapter_handle_t adapter = 0;
33+
ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_ADAPTER,
34+
sizeof(adapter), &adapter, nullptr));
35+
detail::AdapterInfo info = detail::getAdapterInfo(adapter);
36+
37+
size_t name_size = 0;
38+
ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_NAME, 0, nullptr,
39+
&name_size));
40+
std::string name(name_size - 1, '\0');
41+
ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_NAME, name_size,
42+
name.data(), nullptr));
43+
44+
for (auto &m : BLACKLISTED_PLATFORMS) {
45+
if (m.matches(info, name)) {
46+
GTEST_SKIP() << "Platform '" << name
47+
<< "' is blacklisted and not tested by default."
48+
" Set `UR_CTS_ALSO_RUN_KNOWN_FAILURES` in the "
49+
"environment to disable the blacklist.";
50+
}
51+
}
52+
}
53+
} // namespace
54+
2155
struct urAdapterTest : ::testing::Test,
2256
::testing::WithParamInterface<ur_adapter_handle_t> {
2357
void SetUp() override { adapter = GetParam(); }
@@ -31,7 +65,10 @@ struct urAdapterTest : ::testing::Test,
3165
// platform.
3266
struct urPlatformTest : ::testing::Test,
3367
::testing::WithParamInterface<ur_platform_handle_t> {
34-
void SetUp() override { platform = GetParam(); }
68+
void SetUp() override {
69+
platform = GetParam();
70+
UUR_RETURN_ON_FATAL_FAILURE(checkBlacklisted(platform));
71+
}
3572

3673
ur_platform_handle_t platform = nullptr;
3774
};
@@ -84,6 +121,8 @@ struct urDeviceTest : ::testing::Test,
84121
device = GetParam().device;
85122
platform = GetParam().platform;
86123
adapter = GetParam().adapter;
124+
125+
UUR_RETURN_ON_FATAL_FAILURE(checkBlacklisted(platform));
87126
}
88127

89128
ur_device_handle_t device = nullptr;
@@ -122,7 +161,10 @@ template <class T>
122161
struct urPlatformTestWithParam
123162
: ::testing::Test,
124163
::testing::WithParamInterface<std::tuple<ur_platform_handle_t, T>> {
125-
void SetUp() override { platform = std::get<0>(this->GetParam()); }
164+
void SetUp() override {
165+
platform = std::get<0>(this->GetParam());
166+
UUR_RETURN_ON_FATAL_FAILURE(checkBlacklisted(platform));
167+
}
126168
const T &getParam() const { return std::get<1>(this->GetParam()); }
127169
ur_platform_handle_t platform;
128170
};
@@ -154,6 +196,8 @@ struct urDeviceTestWithParam
154196
device = device_tuple.device;
155197
platform = device_tuple.platform;
156198
adapter = device_tuple.adapter;
199+
200+
UUR_RETURN_ON_FATAL_FAILURE(checkBlacklisted(platform));
157201
}
158202
// TODO - I don't like the confusion with GetParam();
159203
const T &getParam() const { return std::get<1>(this->GetParam()); }

unified-runtime/test/conformance/testing/include/uur/known_failure.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ inline AdapterInfo getAdapterInfo(ur_adapter_handle_t adapter) {
3232

3333
struct Matcher {
3434
Matcher(uint32_t adapterVersion, ur_backend_t backend,
35-
std::vector<std::string> deviceNames)
35+
std::vector<std::string> checkNames)
3636
: adapterVersion(adapterVersion), backend(backend),
37-
names(std::move(deviceNames)) {}
37+
names(std::move(checkNames)) {}
3838

3939
bool matches(const detail::AdapterInfo &adapterInfo,
4040
const std::string &name) const {

0 commit comments

Comments
 (0)