Skip to content

Commit 0a8855e

Browse files
committed
Remove CONTEXT_INFO_ATOMIC queries.
These were used as dummy values in the sycl runtime to implement meta-queries for each device in the given context. The affiliated LLVM change for this PR updates that to use __SYCL_TRAIT_HANDLED_IN_RT instead. Fixes #2119
1 parent b0f9293 commit 0a8855e

File tree

13 files changed

+21
-201
lines changed

13 files changed

+21
-201
lines changed

include/ur_api.h

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,27 +2270,17 @@ urContextRetain(
22702270
///////////////////////////////////////////////////////////////////////////////
22712271
/// @brief Supported context info
22722272
typedef enum ur_context_info_t {
2273-
UR_CONTEXT_INFO_NUM_DEVICES = 0, ///< [uint32_t] The number of the devices in the context
2274-
UR_CONTEXT_INFO_DEVICES = 1, ///< [::ur_device_handle_t[]] The array of the device handles in the
2275-
///< context
2276-
UR_CONTEXT_INFO_REFERENCE_COUNT = 2, ///< [uint32_t] Reference count of the context object.
2277-
///< The reference count returned should be considered immediately stale.
2278-
///< It is unsuitable for general use in applications. This feature is
2279-
///< provided for identifying memory leaks.
2280-
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT = 3, ///< [::ur_bool_t] to indicate if the ::urEnqueueUSMMemcpy2D entrypoint is
2281-
///< supported.
2282-
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT = 4, ///< [::ur_bool_t] to indicate if the ::urEnqueueUSMFill2D entrypoint is
2283-
///< supported.
2284-
UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES = 5, ///< [::ur_memory_order_capability_flags_t] return a bit-field of atomic
2285-
///< memory order capabilities.
2286-
UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES = 6, ///< [::ur_memory_scope_capability_flags_t] return a bit-field of atomic
2287-
///< memory scope capabilities.
2288-
UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES = 7, ///< [::ur_memory_order_capability_flags_t] return a bit-field of atomic
2289-
///< memory fence order capabilities.
2290-
///< Zero is returned if the backend does not support context-level fences.
2291-
UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES = 8, ///< [::ur_memory_scope_capability_flags_t] return a bit-field of atomic
2292-
///< memory fence scope capabilities.
2293-
///< Zero is returned if the backend does not support context-level fences.
2273+
UR_CONTEXT_INFO_NUM_DEVICES = 0, ///< [uint32_t] The number of the devices in the context
2274+
UR_CONTEXT_INFO_DEVICES = 1, ///< [::ur_device_handle_t[]] The array of the device handles in the
2275+
///< context
2276+
UR_CONTEXT_INFO_REFERENCE_COUNT = 2, ///< [uint32_t] Reference count of the context object.
2277+
///< The reference count returned should be considered immediately stale.
2278+
///< It is unsuitable for general use in applications. This feature is
2279+
///< provided for identifying memory leaks.
2280+
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT = 3, ///< [::ur_bool_t] to indicate if the ::urEnqueueUSMMemcpy2D entrypoint is
2281+
///< supported.
2282+
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT = 4, ///< [::ur_bool_t] to indicate if the ::urEnqueueUSMFill2D entrypoint is
2283+
///< supported.
22942284
/// @cond
22952285
UR_CONTEXT_INFO_FORCE_UINT32 = 0x7fffffff
22962286
/// @endcond
@@ -2340,7 +2330,7 @@ urContextRelease(
23402330
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
23412331
/// + `NULL == hContext`
23422332
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
2343-
/// + `::UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES < propName`
2333+
/// + `::UR_CONTEXT_INFO_USM_FILL2D_SUPPORT < propName`
23442334
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
23452335
/// + If `propName` is not supported by the adapter.
23462336
/// - ::UR_RESULT_ERROR_INVALID_SIZE

include/ur_print.hpp

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5335,18 +5335,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_context_info_t value)
53355335
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:
53365336
os << "UR_CONTEXT_INFO_USM_FILL2D_SUPPORT";
53375337
break;
5338-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
5339-
os << "UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES";
5340-
break;
5341-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
5342-
os << "UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES";
5343-
break;
5344-
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
5345-
os << "UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES";
5346-
break;
5347-
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES:
5348-
os << "UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES";
5349-
break;
53505338
default:
53515339
os << "unknown enumerator";
53525340
break;
@@ -5426,58 +5414,6 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_inf
54265414

54275415
os << ")";
54285416
} break;
5429-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: {
5430-
const ur_memory_order_capability_flags_t *tptr = (const ur_memory_order_capability_flags_t *)ptr;
5431-
if (sizeof(ur_memory_order_capability_flags_t) > size) {
5432-
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) << ")";
5433-
return UR_RESULT_ERROR_INVALID_SIZE;
5434-
}
5435-
os << (const void *)(tptr) << " (";
5436-
5437-
ur::details::printFlag<ur_memory_order_capability_flag_t>(os,
5438-
*tptr);
5439-
5440-
os << ")";
5441-
} break;
5442-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: {
5443-
const ur_memory_scope_capability_flags_t *tptr = (const ur_memory_scope_capability_flags_t *)ptr;
5444-
if (sizeof(ur_memory_scope_capability_flags_t) > size) {
5445-
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) << ")";
5446-
return UR_RESULT_ERROR_INVALID_SIZE;
5447-
}
5448-
os << (const void *)(tptr) << " (";
5449-
5450-
ur::details::printFlag<ur_memory_scope_capability_flag_t>(os,
5451-
*tptr);
5452-
5453-
os << ")";
5454-
} break;
5455-
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: {
5456-
const ur_memory_order_capability_flags_t *tptr = (const ur_memory_order_capability_flags_t *)ptr;
5457-
if (sizeof(ur_memory_order_capability_flags_t) > size) {
5458-
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) << ")";
5459-
return UR_RESULT_ERROR_INVALID_SIZE;
5460-
}
5461-
os << (const void *)(tptr) << " (";
5462-
5463-
ur::details::printFlag<ur_memory_order_capability_flag_t>(os,
5464-
*tptr);
5465-
5466-
os << ")";
5467-
} break;
5468-
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
5469-
const ur_memory_scope_capability_flags_t *tptr = (const ur_memory_scope_capability_flags_t *)ptr;
5470-
if (sizeof(ur_memory_scope_capability_flags_t) > size) {
5471-
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) << ")";
5472-
return UR_RESULT_ERROR_INVALID_SIZE;
5473-
}
5474-
os << (const void *)(tptr) << " (";
5475-
5476-
ur::details::printFlag<ur_memory_scope_capability_flag_t>(os,
5477-
*tptr);
5478-
5479-
os << ")";
5480-
} break;
54815417
default:
54825418
os << "unknown enumerator";
54835419
return UR_RESULT_ERROR_INVALID_ENUMERATION;

scripts/core/context.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,6 @@ etors:
101101
desc: "[$x_bool_t] to indicate if the $xEnqueueUSMMemcpy2D entrypoint is supported."
102102
- name: USM_FILL2D_SUPPORT
103103
desc: "[$x_bool_t] to indicate if the $xEnqueueUSMFill2D entrypoint is supported."
104-
- name: ATOMIC_MEMORY_ORDER_CAPABILITIES
105-
desc: "[$x_memory_order_capability_flags_t] return a bit-field of atomic memory order capabilities."
106-
- name: ATOMIC_MEMORY_SCOPE_CAPABILITIES
107-
desc: "[$x_memory_scope_capability_flags_t] return a bit-field of atomic memory scope capabilities."
108-
- name: ATOMIC_FENCE_ORDER_CAPABILITIES
109-
desc: |
110-
[$x_memory_order_capability_flags_t] return a bit-field of atomic memory fence order capabilities.
111-
Zero is returned if the backend does not support context-level fences.
112-
- name: ATOMIC_FENCE_SCOPE_CAPABILITIES
113-
desc: |
114-
[$x_memory_scope_capability_flags_t] return a bit-field of atomic memory fence scope capabilities.
115-
Zero is returned if the backend does not support context-level fences.
116104
--- #--------------------------------------------------------------------------
117105
type: function
118106
desc: "Releases the context handle reference indicating end of its usage"

source/adapters/cuda/context.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -74,34 +74,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextGetInfo(
7474
hContext->getDevices().size());
7575
case UR_CONTEXT_INFO_REFERENCE_COUNT:
7676
return ReturnValue(hContext->getReferenceCount());
77-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: {
78-
uint32_t Capabilities = UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED |
79-
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE |
80-
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE |
81-
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL;
82-
return ReturnValue(Capabilities);
83-
}
84-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: {
85-
int Major = 0;
86-
UR_CHECK_ERROR(cuDeviceGetAttribute(
87-
&Major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR,
88-
hContext->getDevices()[0]->get()));
89-
uint32_t Capabilities =
90-
(Major >= 7) ? UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM |
91-
UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP |
92-
UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP |
93-
UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE |
94-
UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM
95-
: UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM |
96-
UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP |
97-
UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP |
98-
UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE;
99-
return ReturnValue(Capabilities);
100-
}
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-
}
10577
case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT:
10678
// 2D USM memcpy is supported.
10779
return ReturnValue(true);

source/adapters/hip/context.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,6 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
6969
hContext->getDevices().size());
7070
case UR_CONTEXT_INFO_REFERENCE_COUNT:
7171
return ReturnValue(hContext->getReferenceCount());
72-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
73-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
74-
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
75-
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
76-
// These queries should be dealt with in context_impl.cpp by calling the
77-
// queries of each device separately and building the intersection set.
78-
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
79-
}
8072
case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT:
8173
// 2D USM memcpy is supported.
8274
return ReturnValue(true);

source/adapters/level_zero/context.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,6 @@ ur_result_t urContextGetInfo(
116116
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:
117117
// 2D USM fill is not supported.
118118
return ReturnValue(uint8_t{false});
119-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: {
120-
121-
ur_memory_order_capability_flags_t Capabilities =
122-
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED |
123-
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE |
124-
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE |
125-
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL |
126-
UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST;
127-
return ReturnValue(Capabilities);
128-
}
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-
}
134119

135120
default:
136121
// TODO: implement other parameters

source/adapters/level_zero/v2/context.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,6 @@ ur_result_t urContextGetInfo(ur_context_handle_t hContext,
180180
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:
181181
// 2D USM fill is not supported.
182182
return ReturnValue(uint8_t{false});
183-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
184-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
185-
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
186-
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
187-
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
188-
}
189183
default:
190184
return UR_RESULT_ERROR_INVALID_ENUMERATION;
191185
}

source/adapters/native_cpu/context.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
6060
// case UR_CONTEXT_INFO_USM_MEMSET2D_SUPPORT:
6161
// 2D USM operations currently not supported.
6262
return returnValue(false);
63-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
64-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
65-
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
66-
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
67-
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
68-
}
6963
default:
7064
return UR_RESULT_ERROR_INVALID_ENUMERATION;
7165
}

source/adapters/opencl/context.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,6 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
8383
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT: {
8484
return ReturnValue(false);
8585
}
86-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
87-
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
88-
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
89-
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
90-
/* These queries should be dealt with in context_impl.cpp by calling the
91-
* queries of each device separately and building the intersection set. */
92-
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
93-
}
9486
case UR_CONTEXT_INFO_NUM_DEVICES:
9587
case UR_CONTEXT_INFO_DEVICES:
9688
case UR_CONTEXT_INFO_REFERENCE_COUNT: {

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ __urdlllocal ur_result_t UR_APICALL urContextGetInfo(
931931
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
932932
}
933933

934-
if (UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES < propName) {
934+
if (UR_CONTEXT_INFO_USM_FILL2D_SUPPORT < propName) {
935935
return UR_RESULT_ERROR_INVALID_ENUMERATION;
936936
}
937937

0 commit comments

Comments
 (0)