@@ -11,18 +11,16 @@ using urMemBufferCreateWithNativeHandleTest = uur::urMemBufferTest;
11
11
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P (urMemBufferCreateWithNativeHandleTest);
12
12
13
13
TEST_P (urMemBufferCreateWithNativeHandleTest, Success) {
14
- UUR_KNOWN_FAILURE_ON (uur::CUDA{}, uur::LevelZeroV2{}, uur::HIP{},
15
- uur::NativeCPU{});
16
-
17
14
ur_native_handle_t hNativeMem = 0 ;
18
- ASSERT_SUCCESS (urMemGetNativeHandle (buffer, device, &hNativeMem));
15
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED (
16
+ urMemGetNativeHandle (buffer, device, &hNativeMem));
19
17
20
18
// We cannot assume anything about a native_handle, not even if it's
21
19
// `nullptr` since this could be a valid representation within a backend.
22
20
// We can however convert the native_handle back into a unified-runtime handle
23
21
// and perform some query on it to verify that it works.
24
22
ur_mem_handle_t mem = nullptr ;
25
- ASSERT_SUCCESS (
23
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED (
26
24
urMemBufferCreateWithNativeHandle (hNativeMem, context, nullptr , &mem));
27
25
ASSERT_NE (mem, nullptr );
28
26
@@ -34,20 +32,18 @@ TEST_P(urMemBufferCreateWithNativeHandleTest, Success) {
34
32
}
35
33
36
34
TEST_P (urMemBufferCreateWithNativeHandleTest, SuccessWithOwnedNativeHandle) {
37
- UUR_KNOWN_FAILURE_ON (uur::CUDA{}, uur::LevelZeroV2{}, uur::HIP{},
38
- uur::NativeCPU{});
39
-
40
35
ur_native_handle_t native_handle = 0 ;
41
- ASSERT_SUCCESS (urMemGetNativeHandle (buffer, device, &native_handle));
36
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED (
37
+ urMemGetNativeHandle (buffer, device, &native_handle));
42
38
43
39
ur_mem_handle_t mem = nullptr ;
44
40
ur_mem_native_properties_t props = {
45
41
/* .stype =*/ UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES,
46
42
/* .pNext =*/ nullptr ,
47
43
/* .isNativeHandleOwned =*/ true ,
48
44
};
49
- ASSERT_SUCCESS (urMemBufferCreateWithNativeHandle (native_handle, context,
50
- &props, &mem));
45
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED (urMemBufferCreateWithNativeHandle (
46
+ native_handle, context, &props, &mem));
51
47
ASSERT_NE (nullptr , mem);
52
48
53
49
ur_context_handle_t mem_context = nullptr ;
@@ -58,20 +54,18 @@ TEST_P(urMemBufferCreateWithNativeHandleTest, SuccessWithOwnedNativeHandle) {
58
54
}
59
55
60
56
TEST_P (urMemBufferCreateWithNativeHandleTest, SuccessWithUnOwnedNativeHandle) {
61
- UUR_KNOWN_FAILURE_ON (uur::CUDA{}, uur::LevelZeroV2{}, uur::HIP{},
62
- uur::NativeCPU{});
63
-
64
57
ur_native_handle_t native_handle = 0 ;
65
- ASSERT_SUCCESS (urMemGetNativeHandle (buffer, device, &native_handle));
58
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED (
59
+ urMemGetNativeHandle (buffer, device, &native_handle));
66
60
67
61
ur_mem_handle_t mem = nullptr ;
68
62
ur_mem_native_properties_t props = {
69
63
/* .stype =*/ UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES,
70
64
/* .pNext =*/ nullptr ,
71
65
/* .isNativeHandleOwned =*/ false ,
72
66
};
73
- ASSERT_SUCCESS (urMemBufferCreateWithNativeHandle (native_handle, context,
74
- &props, &mem));
67
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED (urMemBufferCreateWithNativeHandle (
68
+ native_handle, context, &props, &mem));
75
69
ASSERT_NE (nullptr , mem);
76
70
77
71
ur_context_handle_t mem_context = nullptr ;
@@ -82,36 +76,36 @@ TEST_P(urMemBufferCreateWithNativeHandleTest, SuccessWithUnOwnedNativeHandle) {
82
76
}
83
77
84
78
TEST_P (urMemBufferCreateWithNativeHandleTest, InvalidNullHandle) {
85
- UUR_KNOWN_FAILURE_ON (uur::LevelZeroV2{}, uur::NativeCPU{});
86
-
87
79
ur_native_handle_t hNativeMem = 0 ;
88
- ASSERT_SUCCESS (urMemGetNativeHandle (buffer, device, &hNativeMem));
80
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED (
81
+ urMemGetNativeHandle (buffer, device, &hNativeMem));
89
82
90
83
ur_mem_handle_t mem = nullptr ;
91
84
ur_mem_native_properties_t props = {
92
85
/* .stype =*/ UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES,
93
86
/* .pNext =*/ nullptr ,
94
87
/* .isNativeHandleOwned =*/ false ,
95
88
};
96
- ASSERT_EQ (
97
- urMemBufferCreateWithNativeHandle (hNativeMem, nullptr , &props, &mem),
98
- UR_RESULT_ERROR_INVALID_NULL_HANDLE);
89
+ auto err =
90
+ urMemBufferCreateWithNativeHandle (hNativeMem, nullptr , &props, &mem);
91
+ ASSERT_TRUE (err == UR_RESULT_ERROR_INVALID_NULL_HANDLE ||
92
+ err == UR_RESULT_ERROR_UNSUPPORTED_FEATURE);
99
93
}
100
94
101
95
TEST_P (urMemBufferCreateWithNativeHandleTest, InvalidNullPointer) {
102
- UUR_KNOWN_FAILURE_ON (uur::LevelZeroV2{}, uur::NativeCPU{});
103
-
104
96
ur_native_handle_t hNativeMem = 0 ;
105
- ASSERT_SUCCESS (urMemGetNativeHandle (buffer, device, &hNativeMem));
97
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED (
98
+ urMemGetNativeHandle (buffer, device, &hNativeMem));
106
99
107
100
ur_mem_native_properties_t props = {
108
101
/* .stype =*/ UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES,
109
102
/* .pNext =*/ nullptr ,
110
103
/* .isNativeHandleOwned =*/ false ,
111
104
};
112
- ASSERT_EQ (
113
- urMemBufferCreateWithNativeHandle (hNativeMem, context, &props, nullptr ),
114
- UR_RESULT_ERROR_INVALID_NULL_POINTER);
105
+ auto err =
106
+ urMemBufferCreateWithNativeHandle (hNativeMem, context, &props, nullptr );
107
+ ASSERT_TRUE (err == UR_RESULT_ERROR_INVALID_NULL_POINTER ||
108
+ err == UR_RESULT_ERROR_UNSUPPORTED_FEATURE);
115
109
}
116
110
117
111
using urMemBufferMultiQueueMemBufferTest = uur::urMultiDeviceMemBufferQueueTest;
0 commit comments