1818
1919namespace 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+
2155struct 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.
3266struct 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>
122161struct 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 ()); }
0 commit comments