Skip to content

Commit 2eae687

Browse files
authored
Merge pull request #2112 from martygrant/martin/context-cts-spec-gap
Improvements to align CTS and Spec for Context
2 parents 1ba7f39 + 2a08189 commit 2eae687

15 files changed

+77
-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
@@ -173,8 +173,14 @@ ur_result_t urContextGetInfo(ur_context_handle_t hContext,
173173
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:
174174
// 2D USM fill is not supported.
175175
return ReturnValue(uint8_t{false});
176+
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
177+
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
178+
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
179+
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
180+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
181+
}
176182
default:
177-
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
183+
return UR_RESULT_ERROR_INVALID_ENUMERATION;
178184
}
179185
}
180186
} // 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
@@ -89,7 +89,7 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
8989
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
9090
/* These queries should be dealt with in context_impl.cpp by calling the
9191
* queries of each device separately and building the intersection set. */
92-
return UR_RESULT_ERROR_INVALID_ARGUMENT;
92+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
9393
}
9494
case UR_CONTEXT_INFO_NUM_DEVICES:
9595
case UR_CONTEXT_INFO_DEVICES:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{{NONDETERMINISTIC}}
2-
urContextSetExtendedDeleterTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
2+
{{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)