From 0a522c7a320cd4414ee97c87d244bc484b2bbbf6 Mon Sep 17 00:00:00 2001 From: andre Date: Fri, 22 May 2026 00:59:40 +0800 Subject: [PATCH] Fixed the swap operator for the double data type in Atomic memory operations --- src/include/device/nvshmem_defines.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/include/device/nvshmem_defines.h b/src/include/device/nvshmem_defines.h index 4ea30aab..dd9e4e68 100644 --- a/src/include/device/nvshmem_defines.h +++ b/src/include/device/nvshmem_defines.h @@ -1161,8 +1161,9 @@ NVSHMEM_TYPE_XOR_EMULATE(uint64, uint64_t) Type *target_actual = \ (Type *)((char *)peer_base_addr + \ ((char *)target - (char *)nvshmemi_device_state_d.heap_base)); \ - \ - return (Type)atomicExch_system((subType *)target_actual, *((subType *)&value)); \ + subType old_value = \ + atomicExch_system((subType *)target_actual, *((subType *)&value)); \ + return *((Type *)&old_value); \ } else { \ return nvshmemi_transfer_amo_fetch((void *)target, (Type)value, 0, pe, \ NVSHMEMI_AMO_SWAP); \