Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,12 @@ int DestroyEvent(BenchArgs *args) {
// https://github.com/ROCmSoftwarePlatform/rccl/blob/5c8380ff5b5925cae4bce00b1879a5f930226e8d/src/collectives/device/common_kernel.h#L268
inline __device__ void FetchULong2(ulong2 &v, const ulong2 *p) {
#if defined(__HIP_PLATFORM_HCC__) || defined(__HCC__) || defined(__HIPCC__)
v.x = p->x;
v.y = p->y;
// ROCm clang drops volatile when ulong2 members are accessed through a volatile ulong2 pointer,
// so use volatile scalar member pointers to prevent compiler elision or reordering.
const volatile decltype(p->x) *x_pointer = &p->x;
const volatile decltype(p->y) *y_pointer = &p->y;
v.x = *x_pointer;
v.y = *y_pointer;
#else
asm volatile("ld.volatile.global.v2.u64 {%0,%1}, [%2];" : "=l"(v.x), "=l"(v.y) : "l"(p) : "memory");
#endif
Expand All @@ -614,8 +618,12 @@ inline __device__ void FetchULong2(ulong2 &v, const ulong2 *p) {
// https://github.com/ROCmSoftwarePlatform/rccl/blob/5c8380ff5b5925cae4bce00b1879a5f930226e8d/src/collectives/device/common_kernel.h#L276
inline __device__ void StoreULong2(ulong2 *p, ulong2 &v) {
#if defined(__HIP_PLATFORM_HCC__) || defined(__HCC__) || defined(__HIPCC__)
p->x = v.x;
p->y = v.y;
// ROCm clang drops volatile when ulong2 members are accessed through a volatile ulong2 pointer,
// so use volatile scalar member pointers to prevent compiler elision or reordering.
volatile decltype(p->x) *x_pointer = &p->x;
volatile decltype(p->y) *y_pointer = &p->y;
*x_pointer = v.x;
*y_pointer = v.y;
#else
asm volatile("st.volatile.global.v2.u64 [%0], {%1,%2};" ::"l"(p), "l"(v.x), "l"(v.y) : "memory");
#endif
Expand Down
Loading