-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CTS macro for marking tests as known failures in code
The new `UUR_KNOWN_FAILURE_ON` macro can be used to skip tests on devices where the test is known to fail. This can be done for a devices in an adapter or by substring match of the device name. For example: ```cpp UUR_KNOWN_FAILURE_ON(uur::OpenCL{"Intel(R) UHD Graphics 770"}); ``` This invocation is also used in a few places in order to have clean CTS runs on machines with this iGPU.
- Loading branch information
Showing
6 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See LICENSE.TXT | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#ifndef UR_CONFORMANCE_INCLUDE_KNOWN_FAILURE_H_INCLUDED | ||
#define UR_CONFORMANCE_INCLUDE_KNOWN_FAILURE_H_INCLUDED | ||
|
||
#include "uur/utils.h" | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace uur { | ||
struct DeviceMatcher { | ||
DeviceMatcher(ur_platform_backend_t backend, | ||
std::vector<std::string> deviceNames) | ||
: backend(backend), deviceNames(deviceNames) {} | ||
|
||
ur_platform_backend_t backend; | ||
std::vector<std::string> deviceNames; | ||
}; | ||
|
||
struct OpenCL : DeviceMatcher { | ||
OpenCL(std::initializer_list<std::string> il) | ||
: DeviceMatcher(UR_PLATFORM_BACKEND_OPENCL, {il.begin(), il.end()}) {} | ||
}; | ||
|
||
struct LevelZero : DeviceMatcher { | ||
LevelZero(std::initializer_list<std::string> il) | ||
: DeviceMatcher(UR_PLATFORM_BACKEND_LEVEL_ZERO, | ||
{il.begin(), il.end()}) {} | ||
}; | ||
|
||
struct CUDA : DeviceMatcher { | ||
CUDA(std::initializer_list<std::string> il) | ||
: DeviceMatcher(UR_PLATFORM_BACKEND_CUDA, {il.begin(), il.end()}) {} | ||
}; | ||
|
||
struct HIP : DeviceMatcher { | ||
HIP(std::initializer_list<std::string> il) | ||
: DeviceMatcher(UR_PLATFORM_BACKEND_HIP, {il.begin(), il.end()}) {} | ||
}; | ||
|
||
struct NativeCPU : DeviceMatcher { | ||
NativeCPU(std::initializer_list<std::string> il) | ||
: DeviceMatcher(UR_PLATFORM_BACKEND_NATIVE_CPU, | ||
{il.begin(), il.end()}) {} | ||
}; | ||
|
||
inline bool isKnownFailureOn(ur_platform_handle_t platform, | ||
ur_device_handle_t device, | ||
std::vector<DeviceMatcher> deviceMatchers) { | ||
for (const auto &deviceMatcher : deviceMatchers) { | ||
ur_platform_backend_t backend = UR_PLATFORM_BACKEND_UNKNOWN; | ||
uur::GetPlatformInfo<ur_platform_backend_t>( | ||
platform, UR_PLATFORM_INFO_BACKEND, backend); | ||
if (deviceMatcher.backend != backend) { | ||
continue; | ||
} | ||
if (deviceMatcher.deviceNames.empty()) { | ||
return true; | ||
} | ||
std::string deviceName; | ||
uur::GetDeviceInfo<std::string>(device, UR_DEVICE_INFO_NAME, | ||
deviceName); | ||
for (const auto &unsupportedDeviceName : deviceMatcher.deviceNames) { | ||
if (deviceName.find(unsupportedDeviceName) != std::string::npos) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
} // namespace uur | ||
|
||
#define UUR_KNOWN_FAILURE_ON(...) \ | ||
if (uur::isKnownFailureOn(platform, device, {__VA_ARGS__})) { \ | ||
std::string platformName; \ | ||
uur::GetPlatformInfo<std::string>(platform, UR_PLATFORM_INFO_NAME, \ | ||
platformName); \ | ||
std::string deviceName; \ | ||
uur::GetDeviceInfo<std::string>(device, UR_DEVICE_INFO_NAME, \ | ||
deviceName); \ | ||
GTEST_SKIP() << "Known failure on: " << platformName << ", " \ | ||
<< deviceName; \ | ||
} | ||
|
||
#endif // UR_CONFORMANCE_INCLUDE_KNOWN_FAILURE_H_INCLUDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters