Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions unified-runtime/scripts/core/INTRO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,10 @@ no valid platforms, then the tests will fail. Command line arguments take priori

.. envvar:: UR_CTS_ALSO_RUN_KNOWN_FAILURES

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

Service identifiers
---------------------
Expand Down
48 changes: 46 additions & 2 deletions unified-runtime/test/conformance/testing/include/uur/fixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,40 @@

namespace uur {

namespace {
// By default we skip certain platforms that we don't officially support and are unstable
void checkBlacklisted(ur_platform_handle_t platform) {
static const std::array<uur::Matcher, 1> BLACKLISTED_PLATFORMS{
uur::OpenCL{"AMD Accelerated Parallel Processing"},
};

if (uur::alsoRunKnownFailures()) {
return;
}

ur_adapter_handle_t adapter = 0;
ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_ADAPTER,
sizeof(adapter), &adapter, nullptr));
detail::AdapterInfo info = detail::getAdapterInfo(adapter);

size_t name_size = 0;
ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_NAME, 0, nullptr,
&name_size));
std::string name(name_size - 1, '\0');
ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_NAME, name_size,
name.data(), nullptr));

for (auto &m : BLACKLISTED_PLATFORMS) {
if (m.matches(info, name)) {
GTEST_SKIP() << "Platform '" << name
<< "' is blacklisted and not tested by default."
" Set `UR_CTS_ALSO_RUN_KNOWN_FAILURES` in the "
"environment to disable the blacklist.";
}
}
}
} // namespace

struct urAdapterTest : ::testing::Test,
::testing::WithParamInterface<ur_adapter_handle_t> {
void SetUp() override { adapter = GetParam(); }
Expand All @@ -31,7 +65,10 @@ struct urAdapterTest : ::testing::Test,
// platform.
struct urPlatformTest : ::testing::Test,
::testing::WithParamInterface<ur_platform_handle_t> {
void SetUp() override { platform = GetParam(); }
void SetUp() override {
platform = GetParam();
UUR_RETURN_ON_FATAL_FAILURE(checkBlacklisted(platform));
}

ur_platform_handle_t platform = nullptr;
};
Expand Down Expand Up @@ -84,6 +121,8 @@ struct urDeviceTest : ::testing::Test,
device = GetParam().device;
platform = GetParam().platform;
adapter = GetParam().adapter;

UUR_RETURN_ON_FATAL_FAILURE(checkBlacklisted(platform));
}

ur_device_handle_t device = nullptr;
Expand Down Expand Up @@ -122,7 +161,10 @@ template <class T>
struct urPlatformTestWithParam
: ::testing::Test,
::testing::WithParamInterface<std::tuple<ur_platform_handle_t, T>> {
void SetUp() override { platform = std::get<0>(this->GetParam()); }
void SetUp() override {
platform = std::get<0>(this->GetParam());
UUR_RETURN_ON_FATAL_FAILURE(checkBlacklisted(platform));
}
const T &getParam() const { return std::get<1>(this->GetParam()); }
ur_platform_handle_t platform;
};
Expand Down Expand Up @@ -154,6 +196,8 @@ struct urDeviceTestWithParam
device = device_tuple.device;
platform = device_tuple.platform;
adapter = device_tuple.adapter;

UUR_RETURN_ON_FATAL_FAILURE(checkBlacklisted(platform));
}
// TODO - I don't like the confusion with GetParam();
const T &getParam() const { return std::get<1>(this->GetParam()); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ inline AdapterInfo getAdapterInfo(ur_adapter_handle_t adapter) {

struct Matcher {
Matcher(uint32_t adapterVersion, ur_backend_t backend,
std::vector<std::string> deviceNames)
std::vector<std::string> checkNames)
: adapterVersion(adapterVersion), backend(backend),
names(std::move(deviceNames)) {}
names(std::move(checkNames)) {}

bool matches(const detail::AdapterInfo &adapterInfo,
const std::string &name) const {
Expand Down