Skip to content

Commit c09dbef

Browse files
author
Georgi Mirazchiyski
committed
[HIP] Enable seq_cst memory ordering for atomic fences
1 parent 4f13cd1 commit c09dbef

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

source/adapters/hip/device.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
806806
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE |
807807
UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE |
808808
UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL;
809+
#if __HIP_PLATFORM_NVIDIA__
810+
// Nvidia introduced fence.sc for seq_cst only since SM 7.0.
811+
int Major = 0;
812+
UR_CHECK_ERROR(hipDeviceGetAttribute(
813+
&Major, hipDeviceAttributeComputeCapabilityMajor, hDevice->get()));
814+
if (Major >= 7)
815+
Capabilities |= UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST;
816+
#else
817+
Capabilities |= UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST;
818+
#endif
809819
return ReturnValue(Capabilities);
810820
}
811821
case UR_DEVICE_INFO_DEVICE_ID: {

0 commit comments

Comments
 (0)