Skip to content

Commit cc698e7

Browse files
committed
Improvements to align CTS and Spec for Context:
- Add test for urContextCreate returning UR_RESULT_ERROR_INVALID_ENUMERATION - Added testing in urContextGetInfo for the atomic memory enums, checking against the type mask or UR_RESULT_ERROR_UNSUPPORTED_ENUM (as some adapters don't support this currently)
1 parent 7f1332e commit cc698e7

File tree

15 files changed

+82
-23
lines changed

15 files changed

+82
-23
lines changed

source/adapters/cuda/context.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextGetInfo(
9898
UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE;
9999
return ReturnValue(Capabilities);
100100
}
101+
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
102+
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
103+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
104+
}
101105
case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT:
102106
// 2D USM memcpy is supported.
103107
return ReturnValue(true);

source/adapters/hip/context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
7575
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
7676
// These queries should be dealt with in context_impl.cpp by calling the
7777
// queries of each device separately and building the intersection set.
78-
return UR_RESULT_ERROR_INVALID_ENUMERATION;
78+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
7979
}
8080
case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT:
8181
// 2D USM memcpy is supported.

source/adapters/level_zero/context.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,16 @@ ur_result_t urContextGetInfo(
126126
UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST;
127127
return ReturnValue(Capabilities);
128128
}
129+
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
130+
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
131+
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
132+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
133+
}
129134

130135
default:
131136
// TODO: implement other parameters
132-
die("urGetContextInfo: unsuppported ParamName.");
137+
return UR_RESULT_ERROR_INVALID_ENUMERATION;
133138
}
134-
135-
return UR_RESULT_SUCCESS;
136139
}
137140

138141
ur_result_t urContextGetNativeHandle(

source/adapters/level_zero/v2/context.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,14 @@ ur_result_t urContextGetInfo(ur_context_handle_t hContext,
109109
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:
110110
// 2D USM fill is not supported.
111111
return ReturnValue(uint8_t{false});
112+
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
113+
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
114+
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
115+
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
116+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
117+
}
112118
default:
113-
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
119+
return UR_RESULT_ERROR_INVALID_ENUMERATION;
114120
}
115121
}
116122
} // namespace ur::level_zero

source/adapters/native_cpu/context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
6464
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
6565
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
6666
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
67-
return UR_RESULT_ERROR_ADAPTER_SPECIFIC;
67+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
6868
}
6969
default:
7070
return UR_RESULT_ERROR_INVALID_ENUMERATION;

source/adapters/opencl/context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
8888
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
8989
/* These queries should be dealt with in context_impl.cpp by calling the
9090
* queries of each device separately and building the intersection set. */
91-
return UR_RESULT_ERROR_INVALID_ARGUMENT;
91+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
9292
}
9393
case UR_CONTEXT_INFO_NUM_DEVICES:
9494
case UR_CONTEXT_INFO_DEVICES:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{{NONDETERMINISTIC}}
22
urContextCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
3-
urContextSetExtendedDeleterTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
3+
{{OPT}}urContextSetExtendedDeleterTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
urContextSetExtendedDeleterTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}__
1+
{{OPT}}urContextSetExtendedDeleterTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}__
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
urContextSetExtendedDeleterTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
1+
{{OPT}}urContextSetExtendedDeleterTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}

test/conformance/context/urContextCreate.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ TEST_P(urContextCreateTest, InvalidNullPointerContext) {
3636
urContextCreate(1, &device, nullptr, nullptr));
3737
}
3838

39+
TEST_P(urContextCreateTest, InvalidEnumeration) {
40+
auto device = GetParam();
41+
42+
ur_context_properties_t properties{UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES,
43+
nullptr, UR_CONTEXT_FLAGS_MASK};
44+
uur::raii::Context context = nullptr;
45+
46+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION,
47+
urContextCreate(1, &device, &properties, context.ptr()));
48+
}
49+
3950
using urContextCreateMultiDeviceTest = uur::urAllDevicesTest;
4051
TEST_F(urContextCreateMultiDeviceTest, Success) {
4152
if (devices.size() < 2) {

0 commit comments

Comments
 (0)