Skip to content

Commit

Permalink
Report that devices with cc >= sm_70 support seq_cst
Browse files Browse the repository at this point in the history
cuda ptx 6.0 memory consistency model is implemented in dpc++
for devices > sm_70.

Signed-off-by: JackAKirk <jack.kirk@codeplay.com>
  • Loading branch information
JackAKirk committed Mar 14, 2024
1 parent 9b97a5f commit 4f5d005
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE |
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE |
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL;

int Major = 0;
UR_CHECK_ERROR(cuDeviceGetAttribute(
&Major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, hDevice->get()));
if (Major >= 7)
Capabilities |= UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST;

return ReturnValue(Capabilities);
}
case UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: {
Expand Down Expand Up @@ -228,6 +235,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE |
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE |
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL;

int Major = 0;
UR_CHECK_ERROR(cuDeviceGetAttribute(
&Major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, hDevice->get()));
if (Major >= 7)
Capabilities |= UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST;

return ReturnValue(Capabilities);
}
case UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {
Expand Down

0 comments on commit 4f5d005

Please sign in to comment.