Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CONTEXT_INFO_ATOMIC queries. #2374

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -2270,27 +2270,17 @@ urContextRetain(
///////////////////////////////////////////////////////////////////////////////
/// @brief Supported context info
typedef enum ur_context_info_t {
UR_CONTEXT_INFO_NUM_DEVICES = 0, ///< [uint32_t] The number of the devices in the context
UR_CONTEXT_INFO_DEVICES = 1, ///< [::ur_device_handle_t[]] The array of the device handles in the
///< context
UR_CONTEXT_INFO_REFERENCE_COUNT = 2, ///< [uint32_t] Reference count of the context object.
///< The reference count returned should be considered immediately stale.
///< It is unsuitable for general use in applications. This feature is
///< provided for identifying memory leaks.
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT = 3, ///< [::ur_bool_t] to indicate if the ::urEnqueueUSMMemcpy2D entrypoint is
///< supported.
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT = 4, ///< [::ur_bool_t] to indicate if the ::urEnqueueUSMFill2D entrypoint is
///< supported.
UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES = 5, ///< [::ur_memory_order_capability_flags_t] return a bit-field of atomic
///< memory order capabilities.
UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES = 6, ///< [::ur_memory_scope_capability_flags_t] return a bit-field of atomic
///< memory scope capabilities.
UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES = 7, ///< [::ur_memory_order_capability_flags_t] return a bit-field of atomic
///< memory fence order capabilities.
///< Zero is returned if the backend does not support context-level fences.
UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES = 8, ///< [::ur_memory_scope_capability_flags_t] return a bit-field of atomic
///< memory fence scope capabilities.
///< Zero is returned if the backend does not support context-level fences.
UR_CONTEXT_INFO_NUM_DEVICES = 0, ///< [uint32_t] The number of the devices in the context
UR_CONTEXT_INFO_DEVICES = 1, ///< [::ur_device_handle_t[]] The array of the device handles in the
///< context
UR_CONTEXT_INFO_REFERENCE_COUNT = 2, ///< [uint32_t] Reference count of the context object.
///< The reference count returned should be considered immediately stale.
///< It is unsuitable for general use in applications. This feature is
///< provided for identifying memory leaks.
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT = 3, ///< [::ur_bool_t] to indicate if the ::urEnqueueUSMMemcpy2D entrypoint is
///< supported.
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT = 4, ///< [::ur_bool_t] to indicate if the ::urEnqueueUSMFill2D entrypoint is
///< supported.
/// @cond
UR_CONTEXT_INFO_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down Expand Up @@ -2340,7 +2330,7 @@ urContextRelease(
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hContext`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES < propName`
/// + `::UR_CONTEXT_INFO_USM_FILL2D_SUPPORT < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down
64 changes: 0 additions & 64 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5335,18 +5335,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_context_info_t value)
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:
os << "UR_CONTEXT_INFO_USM_FILL2D_SUPPORT";
break;
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
os << "UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES";
break;
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
os << "UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES";
break;
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
os << "UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES";
break;
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES:
os << "UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -5426,58 +5414,6 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_inf

os << ")";
} break;
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: {
const ur_memory_order_capability_flags_t *tptr = (const ur_memory_order_capability_flags_t *)ptr;
if (sizeof(ur_memory_order_capability_flags_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

ur::details::printFlag<ur_memory_order_capability_flag_t>(os,
*tptr);

os << ")";
} break;
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: {
const ur_memory_scope_capability_flags_t *tptr = (const ur_memory_scope_capability_flags_t *)ptr;
if (sizeof(ur_memory_scope_capability_flags_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

ur::details::printFlag<ur_memory_scope_capability_flag_t>(os,
*tptr);

os << ")";
} break;
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: {
const ur_memory_order_capability_flags_t *tptr = (const ur_memory_order_capability_flags_t *)ptr;
if (sizeof(ur_memory_order_capability_flags_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

ur::details::printFlag<ur_memory_order_capability_flag_t>(os,
*tptr);

os << ")";
} break;
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
const ur_memory_scope_capability_flags_t *tptr = (const ur_memory_scope_capability_flags_t *)ptr;
if (sizeof(ur_memory_scope_capability_flags_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

ur::details::printFlag<ur_memory_scope_capability_flag_t>(os,
*tptr);

os << ")";
} break;
default:
os << "unknown enumerator";
return UR_RESULT_ERROR_INVALID_ENUMERATION;
Expand Down
12 changes: 0 additions & 12 deletions scripts/core/context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,6 @@ etors:
desc: "[$x_bool_t] to indicate if the $xEnqueueUSMMemcpy2D entrypoint is supported."
- name: USM_FILL2D_SUPPORT
desc: "[$x_bool_t] to indicate if the $xEnqueueUSMFill2D entrypoint is supported."
- name: ATOMIC_MEMORY_ORDER_CAPABILITIES
desc: "[$x_memory_order_capability_flags_t] return a bit-field of atomic memory order capabilities."
- name: ATOMIC_MEMORY_SCOPE_CAPABILITIES
desc: "[$x_memory_scope_capability_flags_t] return a bit-field of atomic memory scope capabilities."
- name: ATOMIC_FENCE_ORDER_CAPABILITIES
desc: |
[$x_memory_order_capability_flags_t] return a bit-field of atomic memory fence order capabilities.
Zero is returned if the backend does not support context-level fences.
- name: ATOMIC_FENCE_SCOPE_CAPABILITIES
desc: |
[$x_memory_scope_capability_flags_t] return a bit-field of atomic memory fence scope capabilities.
Zero is returned if the backend does not support context-level fences.
--- #--------------------------------------------------------------------------
type: function
desc: "Releases the context handle reference indicating end of its usage"
Expand Down
28 changes: 0 additions & 28 deletions source/adapters/cuda/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,34 +74,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextGetInfo(
hContext->getDevices().size());
case UR_CONTEXT_INFO_REFERENCE_COUNT:
return ReturnValue(hContext->getReferenceCount());
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: {
uint32_t Capabilities = UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED |
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE |
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE |
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL;
return ReturnValue(Capabilities);
}
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: {
int Major = 0;
UR_CHECK_ERROR(cuDeviceGetAttribute(
&Major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR,
hContext->getDevices()[0]->get()));
uint32_t Capabilities =
(Major >= 7) ? UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM |
UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP |
UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP |
UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE |
UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM
: UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM |
UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP |
UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP |
UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE;
return ReturnValue(Capabilities);
}
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
}
case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT:
// 2D USM memcpy is supported.
return ReturnValue(true);
Expand Down
8 changes: 0 additions & 8 deletions source/adapters/hip/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
hContext->getDevices().size());
case UR_CONTEXT_INFO_REFERENCE_COUNT:
return ReturnValue(hContext->getReferenceCount());
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
// These queries should be dealt with in context_impl.cpp by calling the
// queries of each device separately and building the intersection set.
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
}
case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT:
// 2D USM memcpy is supported.
return ReturnValue(true);
Expand Down
15 changes: 0 additions & 15 deletions source/adapters/level_zero/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,6 @@ ur_result_t urContextGetInfo(
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:
// 2D USM fill is not supported.
return ReturnValue(uint8_t{false});
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: {

ur_memory_order_capability_flags_t Capabilities =
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED |
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE |
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE |
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL |
UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST;
return ReturnValue(Capabilities);
}
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
}

default:
// TODO: implement other parameters
Expand Down
6 changes: 0 additions & 6 deletions source/adapters/level_zero/v2/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,6 @@ ur_result_t urContextGetInfo(ur_context_handle_t hContext,
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:
// 2D USM fill is not supported.
return ReturnValue(uint8_t{false});
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
}
default:
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}
Expand Down
6 changes: 0 additions & 6 deletions source/adapters/native_cpu/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
// case UR_CONTEXT_INFO_USM_MEMSET2D_SUPPORT:
// 2D USM operations currently not supported.
return returnValue(false);
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
}
default:
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}
Expand Down
8 changes: 0 additions & 8 deletions source/adapters/opencl/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT: {
return ReturnValue(false);
}
case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES:
case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
/* These queries should be dealt with in context_impl.cpp by calling the
* queries of each device separately and building the intersection set. */
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
}
case UR_CONTEXT_INFO_NUM_DEVICES:
case UR_CONTEXT_INFO_DEVICES:
case UR_CONTEXT_INFO_REFERENCE_COUNT: {
Expand Down
2 changes: 1 addition & 1 deletion source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ __urdlllocal ur_result_t UR_APICALL urContextGetInfo(
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
}

if (UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES < propName) {
if (UR_CONTEXT_INFO_USM_FILL2D_SUPPORT < propName) {
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}

Expand Down
2 changes: 1 addition & 1 deletion source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ ur_result_t UR_APICALL urContextRelease(
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hContext`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES < propName`
/// + `::UR_CONTEXT_INFO_USM_FILL2D_SUPPORT < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down
2 changes: 1 addition & 1 deletion source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ ur_result_t UR_APICALL urContextRelease(
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hContext`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES < propName`
/// + `::UR_CONTEXT_INFO_USM_FILL2D_SUPPORT < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down
35 changes: 6 additions & 29 deletions test/conformance/context/urContextGetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,7 @@ struct urContextGetInfoTestWithInfoParam
{UR_CONTEXT_INFO_DEVICES, sizeof(ur_device_handle_t)},
{UR_CONTEXT_INFO_REFERENCE_COUNT, sizeof(uint32_t)},
{UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT, sizeof(bool)},
{UR_CONTEXT_INFO_USM_FILL2D_SUPPORT, sizeof(bool)},
{UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES,
sizeof(ur_memory_order_capability_flags_t)},
{UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES,
sizeof(ur_memory_order_capability_flags_t)},
{UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES,
sizeof(ur_memory_order_capability_flags_t)},
{UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES,
sizeof(ur_memory_order_capability_flags_t)}};

ctx_info_mem_flags_map = {
{UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES,
UR_MEMORY_ORDER_CAPABILITY_FLAGS_MASK},
{UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES,
UR_MEMORY_SCOPE_CAPABILITY_FLAGS_MASK},
{UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES,
UR_MEMORY_ORDER_CAPABILITY_FLAGS_MASK},
{UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES,
UR_MEMORY_SCOPE_CAPABILITY_FLAGS_MASK},
};
{UR_CONTEXT_INFO_USM_FILL2D_SUPPORT, sizeof(bool)}};
}

void TearDown() override {
Expand All @@ -51,15 +32,11 @@ struct urContextGetInfoTestWithInfoParam
UUR_TEST_SUITE_P(urContextGetInfoTestWithInfoParam,
::testing::Values(

UR_CONTEXT_INFO_NUM_DEVICES, //
UR_CONTEXT_INFO_DEVICES, //
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT, //
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT, //
UR_CONTEXT_INFO_REFERENCE_COUNT, //
UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES, //
UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES, //
UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES, //
UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES //
UR_CONTEXT_INFO_NUM_DEVICES, //
UR_CONTEXT_INFO_DEVICES, //
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT, //
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT, //
UR_CONTEXT_INFO_REFERENCE_COUNT //
),
uur::deviceTestWithParamPrinter<ur_context_info_t>);

Expand Down
Loading