Skip to content

Commit 5038fe9

Browse files
committed
Port remaining tests and replace match files with KNOWN_FAILURE macro
1 parent 097fba6 commit 5038fe9

File tree

172 files changed

+1256
-1654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+1256
-1654
lines changed

source/adapters/hip/device.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
903903
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
904904
return ReturnValue(ur_bool_t{false});
905905
case UR_DEVICE_INFO_USM_POOL_SUPPORT:
906+
#ifdef UMF_ENABLE_POOL_TRACKING
906907
return ReturnValue(ur_bool_t{true});
908+
#else
909+
return ReturnValue(ur_bool_t{false});
910+
#endif
907911
case UR_DEVICE_INFO_BFLOAT16:
908912
return ReturnValue(true);
909913
case UR_DEVICE_INFO_ASYNC_BARRIER:

test/adapters/cuda/urDeviceCreateWithNativeHandle.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
#include "fixtures.h"
77

8-
using urCudaDeviceCreateWithNativeHandle = uur::urSelectedPlatformTest;
8+
using urCudaDeviceCreateWithNativeHandle = uur::urPlatformTest;
9+
UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urCudaDeviceCreateWithNativeHandle);
910

10-
TEST_F(urCudaDeviceCreateWithNativeHandle, Success) {
11+
TEST_P(urCudaDeviceCreateWithNativeHandle, Success) {
1112
// get a device from cuda
1213
int nCudaDevices;
1314
ASSERT_SUCCESS_CUDA(cuDeviceGetCount(&nCudaDevices));
@@ -16,7 +17,12 @@ TEST_F(urCudaDeviceCreateWithNativeHandle, Success) {
1617
ASSERT_SUCCESS_CUDA(cuDeviceGet(&cudaDevice, 0));
1718

1819
ur_native_handle_t nativeCuda = static_cast<ur_native_handle_t>(cudaDevice);
19-
ur_device_handle_t urDevice;
20+
21+
ur_adapter_handle_t adapter = nullptr;
22+
ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_ADAPTER,
23+
sizeof(adapter), &adapter, nullptr));
24+
25+
ur_device_handle_t urDevice = nullptr;
2026
ASSERT_SUCCESS(urDeviceCreateWithNativeHandle(nativeCuda, adapter, nullptr,
2127
&urDevice));
2228
}

test/adapters/level_zero/multi_device_event_cache_tests.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
// See LICENSE.TXT
44
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
#include "ur_print.hpp"
76
#include "uur/fixtures.h"
87
#include "uur/raii.h"
98

10-
#include <map>
11-
#include <string>
12-
139
#include "ze_tracer_common.hpp"
1410

1511
size_t zeCommandListAppendWaitOnEventsCount = 0;
@@ -27,7 +23,9 @@ static std::shared_ptr<_zel_tracer_handle_t> tracer = [] {
2723
}();
2824

2925
using urMultiQueueMultiDeviceEventCacheTest = uur::urAllDevicesTest;
30-
TEST_F(urMultiQueueMultiDeviceEventCacheTest,
26+
UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urMultiQueueMultiDeviceEventCacheTest);
27+
28+
TEST_P(urMultiQueueMultiDeviceEventCacheTest,
3129
GivenMultiSubDeviceWithQueuePerSubDeviceThenEventIsSharedBetweenQueues) {
3230
uint32_t max_sub_devices = 0;
3331
ASSERT_SUCCESS(
@@ -83,7 +81,7 @@ TEST_F(urMultiQueueMultiDeviceEventCacheTest,
8381
ASSERT_SUCCESS(urQueueRelease(queue1));
8482
}
8583

86-
TEST_F(urMultiQueueMultiDeviceEventCacheTest,
84+
TEST_P(urMultiQueueMultiDeviceEventCacheTest,
8785
GivenMultiDeviceWithQueuePerDeviceThenMultiDeviceEventIsCreated) {
8886
if (devices.size() < 2) {
8987
GTEST_SKIP();

test/adapters/level_zero/urKernelCreateWithNativeHandle.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ TEST_P(urLevelZeroKernelNativeHandleTest, OwnedHandleRelease) {
1919
urDeviceGetNativeHandle(device, (ur_native_handle_t *)&native_device);
2020

2121
std::shared_ptr<std::vector<char>> il_binary;
22-
uur::KernelsEnvironment::instance->LoadSource("foo", il_binary);
22+
uur::KernelsEnvironment::instance->LoadSource("foo", platform, il_binary);
2323

2424
auto kernel_name =
2525
uur::KernelsEnvironment::instance->GetEntryPointNames("foo")[0];
@@ -79,7 +79,7 @@ TEST_P(urLevelZeroKernelNativeHandleTest, NullProgram) {
7979
urDeviceGetNativeHandle(device, (ur_native_handle_t *)&native_device);
8080

8181
std::shared_ptr<std::vector<char>> il_binary;
82-
uur::KernelsEnvironment::instance->LoadSource("foo", il_binary);
82+
uur::KernelsEnvironment::instance->LoadSource("foo", platform, il_binary);
8383

8484
auto kernel_name =
8585
uur::KernelsEnvironment::instance->GetEntryPointNames("foo")[0];

test/adapters/level_zero/v2/event_pool_test.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct ProviderParams {
8888
template <typename T>
8989
inline std::string
9090
printParams(const testing::TestParamInfo<typename T::ParamType> &info) {
91-
const auto device_handle = std::get<0>(info.param);
91+
const auto device_handle = std::get<0>(info.param).device;
9292
const auto platform_device_name =
9393
uur::GetPlatformAndDeviceName(device_handle);
9494
auto params = std::get<1>(info.param);
@@ -144,8 +144,8 @@ static ProviderParams test_cases[] = {
144144
//{TEST_PROVIDER_COUNTER, EVENT_COUNTER, QUEUE_IMMEDIATE},
145145
};
146146

147-
UUR_TEST_SUITE_P(EventPoolTest, testing::ValuesIn(test_cases),
148-
printParams<EventPoolTest>);
147+
UUR_DEVICE_TEST_SUITE_P(EventPoolTest, testing::ValuesIn(test_cases),
148+
printParams<EventPoolTest>);
149149

150150
TEST_P(EventPoolTest, InvalidDevice) {
151151
auto pool = cache->borrow(MAX_DEVICES, getParam().flags);
@@ -237,8 +237,8 @@ TEST_P(EventPoolTest, ProviderNormalUseMostFreePool) {
237237

238238
using EventPoolTestWithQueue = uur::urQueueTestWithParam<ProviderParams>;
239239

240-
UUR_TEST_SUITE_P(EventPoolTestWithQueue, testing::ValuesIn(test_cases),
241-
printParams<EventPoolTest>);
240+
UUR_DEVICE_TEST_SUITE_P(EventPoolTestWithQueue, testing::ValuesIn(test_cases),
241+
printParams<EventPoolTest>);
242242

243243
// TODO: actual min version is unknown, retest after drivers on CI are
244244
// updated.

test/adapters/level_zero/v2/memory_residency.cpp

+9-18
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,34 @@
33
// See LICENSE.TXT
44
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
#include "ur_print.hpp"
76
#include "uur/fixtures.h"
8-
#include "uur/raii.h"
97
#include "uur/utils.h"
108

11-
#include <map>
12-
#include <string>
13-
149
using urMemoryResidencyTest = uur::urMultiDeviceContextTestTemplate<1>;
10+
UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urMemoryResidencyTest);
1511

16-
TEST_F(urMemoryResidencyTest, allocatingDeviceMemoryWillResultInOOM) {
12+
TEST_P(urMemoryResidencyTest, allocatingDeviceMemoryWillResultInOOM) {
1713
static constexpr size_t allocSize = 1024 * 1024;
1814

19-
if (!uur::isPVC(uur::DevicesEnvironment::instance->devices[0])) {
15+
if (!uur::isPVC(devices[0])) {
2016
GTEST_SKIP() << "Test requires a PVC device";
2117
}
2218

2319
size_t initialMemFree = 0;
24-
ASSERT_SUCCESS(
25-
urDeviceGetInfo(uur::DevicesEnvironment::instance->devices[0],
26-
UR_DEVICE_INFO_GLOBAL_MEM_FREE, sizeof(size_t),
27-
&initialMemFree, nullptr));
20+
ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_GLOBAL_MEM_FREE,
21+
sizeof(size_t), &initialMemFree, nullptr));
2822

2923
if (initialMemFree < allocSize) {
3024
GTEST_SKIP() << "Not enough device memory available";
3125
}
3226

3327
void *ptr = nullptr;
34-
ASSERT_SUCCESS(
35-
urUSMDeviceAlloc(context, uur::DevicesEnvironment::instance->devices[0],
36-
nullptr, nullptr, allocSize, &ptr));
28+
ASSERT_SUCCESS(urUSMDeviceAlloc(context, devices[0], nullptr, nullptr,
29+
allocSize, &ptr));
3730

3831
size_t currentMemFree = 0;
39-
ASSERT_SUCCESS(
40-
urDeviceGetInfo(uur::DevicesEnvironment::instance->devices[0],
41-
UR_DEVICE_INFO_GLOBAL_MEM_FREE, sizeof(size_t),
42-
&currentMemFree, nullptr));
32+
ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_GLOBAL_MEM_FREE,
33+
sizeof(size_t), &currentMemFree, nullptr));
4334

4435
// amount of free memory should decrease after making a memory allocation resident
4536
ASSERT_LE(currentMemFree, initialMemFree);

test/conformance/CMakeLists.txt

+13-26
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,16 @@ function(add_test_adapter name adapter backend)
1414
set(TEST_NAME ${name}-${adapter})
1515

1616
set(TEST_COMMAND
17-
"${PROJECT_BINARY_DIR}/bin/${TEST_TARGET_NAME} --backend=${backend} --devices_count=${UR_TEST_DEVICES_COUNT} --platforms_count=${UR_TEST_PLATFORMS_COUNT}"
17+
"${PROJECT_BINARY_DIR}/bin/${TEST_TARGET_NAME} --gtest_filter=*${backend}*"
1818
)
19-
set(MATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${name}_${adapter}.match")
2019

2120
function(do_add_test tname env)
22-
if(${UR_CONFORMANCE_ENABLE_MATCH_FILES} AND EXISTS ${MATCH_FILE})
23-
add_test(NAME ${tname}
24-
COMMAND ${Python3_EXECUTABLE} ${UR_CONFORMANCE_TEST_DIR}/cts_exe.py
25-
--failslist ${MATCH_FILE}
26-
--test_command ${PROJECT_BINARY_DIR}/bin/${TEST_TARGET_NAME}
27-
--
28-
--backend=${backend}
29-
--devices_count=${UR_TEST_DEVICES_COUNT}
30-
--platforms_count=${UR_TEST_PLATFORMS_COUNT}
31-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
32-
)
33-
else()
34-
separate_arguments(TEST_COMMAND)
35-
add_test(NAME ${tname}
36-
COMMAND ${TEST_COMMAND}
37-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
38-
)
39-
endif()
21+
separate_arguments(TEST_COMMAND)
22+
add_test(NAME ${tname}
23+
COMMAND ${TEST_COMMAND}
24+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
25+
)
4026

41-
if(UR_CONFORMANCE_ENABLE_MATCH_FILES)
42-
list(APPEND env GTEST_COLOR=yes)
43-
endif()
4427
set_tests_properties(${tname} PROPERTIES
4528
ENVIRONMENT "${env}"
4629
LABELS "conformance;${adapter}")
@@ -67,20 +50,24 @@ function(add_conformance_test name)
6750
GTest::gtest_main
6851
unit_tests_helpers)
6952

53+
if(UR_USE_CFI)
54+
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE UR_USE_CFI)
55+
endif()
56+
7057
if(UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_ALL)
7158
add_test_adapter(${name} adapter_cuda CUDA)
7259
endif()
7360
if(UR_BUILD_ADAPTER_HIP OR UR_BUILD_ADAPTER_ALL)
7461
add_test_adapter(${name} adapter_hip HIP)
7562
endif()
7663
if(UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_ALL)
77-
add_test_adapter(${name} adapter_level_zero LEVEL_ZERO)
64+
add_test_adapter(${name} adapter_level_zero Level_Zero)
7865
endif()
7966
if(UR_BUILD_ADAPTER_L0_V2)
80-
add_test_adapter(${name} adapter_level_zero_v2 LEVEL_ZERO)
67+
add_test_adapter(${name} adapter_level_zero_v2 Level_Zero)
8168
endif()
8269
if(UR_BUILD_ADAPTER_OPENCL OR UR_BUILD_ADAPTER_ALL)
83-
add_test_adapter(${name} adapter_opencl OPENCL)
70+
add_test_adapter(${name} adapter_opencl OpenCL)
8471
endif()
8572
if(UR_BUILD_ADAPTER_NATIVE_CPU OR UR_BUILD_ADAPTER_ALL)
8673
add_test_adapter(${name} adapter_native_cpu NATIVE_CPU)

test/conformance/context/context_adapter_level_zero.match

-1
This file was deleted.

test/conformance/context/context_adapter_level_zero_v2.match

-1
This file was deleted.

test/conformance/context/context_adapter_native_cpu.match

-1
This file was deleted.

test/conformance/context/urContextGetInfo.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ TEST_P(urContextGetInfoTest, SuccessDevices) {
3535
size_t devices_count = size / sizeof(ur_device_handle_t);
3636
ASSERT_EQ(devices_count, 1);
3737
ASSERT_EQ(queried_device, device);
38-
39-
for (uint32_t i = 0; i < devices_count; i++) {
40-
auto &devices = uur::DevicesEnvironment::instance->devices;
41-
auto queried_device =
42-
std::find(devices.begin(), devices.end(), devices[i]);
43-
EXPECT_TRUE(queried_device != devices.end())
44-
<< "device associated with the context is not valid";
45-
}
4638
}
4739

4840
TEST_P(urContextGetInfoTest, SuccessUSMMemCpy2DSupport) {

test/conformance/context/urContextSetExtendedDeleter.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

66
#include "uur/fixtures.h"
7+
#include "uur/known_failure.h"
78
#include "uur/raii.h"
89

910
using urContextSetExtendedDeleterTest = uur::urDeviceTest;
1011

1112
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urContextSetExtendedDeleterTest);
1213

1314
TEST_P(urContextSetExtendedDeleterTest, Success) {
15+
UUR_KNOWN_FAILURE_ON(uur::LevelZero{}, uur::LevelZeroV2{},
16+
uur::NativeCPU{});
17+
1418
bool called = false;
1519
{
1620
uur::raii::Context context = nullptr;

test/conformance/device/device_adapter_cuda.match

-2
This file was deleted.

test/conformance/device/device_adapter_hip.match

-1
This file was deleted.

test/conformance/device/device_adapter_level_zero.match

-2
This file was deleted.

test/conformance/device/device_adapter_level_zero_v2.match

-2
This file was deleted.

test/conformance/device/device_adapter_native_cpu.match

-16
This file was deleted.

test/conformance/device/urDeviceCreateWithNativeHandle.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See LICENSE.TXT
44
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55
#include <uur/fixtures.h>
6+
#include <uur/known_failure.h>
67

78
using urDeviceCreateWithNativeHandleTest = uur::urDeviceTest;
89
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urDeviceCreateWithNativeHandleTest);
@@ -56,6 +57,8 @@ TEST_P(urDeviceCreateWithNativeHandleTest, SuccessWithUnOwnedNativeHandle) {
5657
}
5758

5859
TEST_P(urDeviceCreateWithNativeHandleTest, InvalidNullHandlePlatform) {
60+
UUR_KNOWN_FAILURE_ON(uur::NativeCPU{});
61+
5962
ur_native_handle_t native_handle = 0;
6063
ASSERT_SUCCESS(urDeviceGetNativeHandle(device, &native_handle));
6164

@@ -66,6 +69,8 @@ TEST_P(urDeviceCreateWithNativeHandleTest, InvalidNullHandlePlatform) {
6669
}
6770

6871
TEST_P(urDeviceCreateWithNativeHandleTest, InvalidNullPointerDevice) {
72+
UUR_KNOWN_FAILURE_ON(uur::NativeCPU{});
73+
6974
ur_native_handle_t native_handle = 0;
7075
ASSERT_SUCCESS(urDeviceGetNativeHandle(device, &native_handle));
7176

test/conformance/device/urDeviceGetGlobalTimestamps.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <thread>
88
#include <type_traits>
99
#include <uur/fixtures.h>
10+
#include <uur/known_failure.h>
1011

1112
// WARNING - This is the precision that is used in the OpenCL-CTS.
1213
// - We might need to modify this value per-adapter.
@@ -30,6 +31,8 @@ using urDeviceGetGlobalTimestampTest = uur::urDeviceTest;
3031
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urDeviceGetGlobalTimestampTest);
3132

3233
TEST_P(urDeviceGetGlobalTimestampTest, Success) {
34+
UUR_KNOWN_FAILURE_ON(uur::OpenCL{"Intel(R) FPGA"});
35+
3336
uint64_t device_time = 0;
3437
uint64_t host_time = 0;
3538
ASSERT_SUCCESS(
@@ -39,16 +42,25 @@ TEST_P(urDeviceGetGlobalTimestampTest, Success) {
3942
}
4043

4144
TEST_P(urDeviceGetGlobalTimestampTest, SuccessHostTimer) {
45+
UUR_KNOWN_FAILURE_ON(uur::OpenCL{"Intel(R) FPGA"});
46+
4247
uint64_t host_time = 0;
4348
ASSERT_SUCCESS(urDeviceGetGlobalTimestamps(device, nullptr, &host_time));
4449
ASSERT_NE(host_time, 0);
4550
}
4651

4752
TEST_P(urDeviceGetGlobalTimestampTest, SuccessNoTimers) {
53+
UUR_KNOWN_FAILURE_ON(uur::OpenCL{"Intel(R) FPGA"});
54+
4855
ASSERT_SUCCESS(urDeviceGetGlobalTimestamps(device, nullptr, nullptr));
4956
}
5057

5158
TEST_P(urDeviceGetGlobalTimestampTest, SuccessSynchronizedTime) {
59+
UUR_KNOWN_FAILURE_ON(uur::CUDA{}, uur::HIP{}, uur::LevelZero{},
60+
uur::LevelZeroV2{}, uur::NativeCPU{},
61+
uur::OpenCL{"Intel(R) FPGA"},
62+
uur::OpenCL{"Intel(R) UHD Graphics 770"});
63+
5264
// get the timer resolution of the device
5365
size_t deviceTimerResolutionNanoSecs = 0;
5466
ASSERT_SUCCESS(uur::GetDeviceProfilingTimerResolution(

0 commit comments

Comments
 (0)