Skip to content

Commit 29ee45c

Browse files
authored
Merge pull request #1291 from JackAKirk/cuda-seq-cst-b
[CUDA] Report that devices with cc >= sm_70 support seq_cst
2 parents db4b0c1 + 4f5d005 commit 29ee45c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

source/adapters/cuda/device.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
201201
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE |
202202
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE |
203203
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL;
204+
205+
int Major = 0;
206+
UR_CHECK_ERROR(cuDeviceGetAttribute(
207+
&Major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, hDevice->get()));
208+
if (Major >= 7)
209+
Capabilities |= UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST;
210+
204211
return ReturnValue(Capabilities);
205212
}
206213
case UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: {
@@ -228,6 +235,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
228235
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE |
229236
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE |
230237
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL;
238+
239+
int Major = 0;
240+
UR_CHECK_ERROR(cuDeviceGetAttribute(
241+
&Major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, hDevice->get()));
242+
if (Major >= 7)
243+
Capabilities |= UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST;
244+
231245
return ReturnValue(Capabilities);
232246
}
233247
case UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: {

0 commit comments

Comments
 (0)