Skip to content

Commit d7c0540

Browse files
RossBruntoncallumfare
authored andcommitted
[UR][Offload] Quick CTS running for Offload
It is non-trivial which binary format (spir, ptx, amdhsa) is accepted by a given offload device. This should be fixed properly in the future, but for now let the user specify it via an environment variable.
1 parent 29b3767 commit d7c0540

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

test/conformance/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ if(UR_DPCXX)
125125
file(MAKE_DIRECTORY ${UR_CONFORMANCE_DEVICE_BINARIES_DIR})
126126

127127
if("${UR_CONFORMANCE_TARGET_TRIPLES}" STREQUAL "")
128-
if(UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_L0_V2 OR UR_BUILD_ADAPTER_OPENCL OR UR_BUILD_ADAPTER_ALL)
128+
if(UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_OFFLOAD OR UR_BUILD_ADAPTER_L0_V2 OR UR_BUILD_ADAPTER_OPENCL OR UR_BUILD_ADAPTER_ALL)
129129
list(APPEND TARGET_TRIPLES "spir64")
130130
endif()
131-
if(UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_ALL)
131+
if(UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_OFFLOAD OR UR_BUILD_ADAPTER_ALL)
132132
list(APPEND TARGET_TRIPLES "nvptx64-nvidia-cuda")
133133
endif()
134134
if(UR_BUILD_ADAPTER_HIP OR UR_BUILD_ADAPTER_OFFLOAD OR UR_BUILD_ADAPTER_ALL)

test/conformance/platform/urPlatformGetInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ TEST_P(urPlatformGetInfoTest, SuccessBackend) {
106106
&property_value, nullptr));
107107

108108
ASSERT_TRUE(property_value >= UR_PLATFORM_BACKEND_LEVEL_ZERO &&
109-
property_value <= UR_PLATFORM_BACKEND_NATIVE_CPU);
109+
property_value <= UR_PLATFORM_BACKEND_OFFLOAD);
110110
}
111111

112112
TEST_P(urPlatformGetInfoTest, SuccessAdapter) {

test/conformance/source/environment.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,16 @@ std::string KernelsEnvironment::getTargetName(ur_platform_handle_t platform) {
215215
return "nvptx64-nvidia-cuda";
216216
case UR_PLATFORM_BACKEND_HIP:
217217
return "amdgcn-amd-amdhsa";
218+
case UR_PLATFORM_BACKEND_OFFLOAD: {
219+
// TODO: In future this should use urDeviceSelectBinary
220+
auto result = ur_getenv("UR_OFFLOAD_TARGET_NAME");
221+
if (!result) {
222+
error = "For offload testing, please specify a target in "
223+
"`UR_OFFLOAD_TARGET_NAME`";
224+
return {};
225+
}
226+
return *result;
227+
}
218228
case UR_PLATFORM_BACKEND_NATIVE_CPU:
219229
error = "native_cpu doesn't support kernel tests yet";
220230
return {};
@@ -297,7 +307,8 @@ void KernelsEnvironment::CreateProgram(
297307
sizeof(ur_platform_backend_t), &backend,
298308
nullptr));
299309
if (backend == UR_PLATFORM_BACKEND_HIP ||
300-
backend == UR_PLATFORM_BACKEND_CUDA) {
310+
backend == UR_PLATFORM_BACKEND_CUDA ||
311+
backend == UR_PLATFORM_BACKEND_OFFLOAD) {
301312
// The CUDA and HIP adapters do not support urProgramCreateWithIL so we
302313
// need to use urProgramCreateWithBinary instead.
303314
auto size = binary.size();

0 commit comments

Comments
 (0)