[ROCm] Fix SymmetricMemory build error on NAVI arch (#152838)

NAVI arch doesn't support `__builtin_amdgcn_s_memtime()`, using `clock64()` instead which works for both NAVI and MI archs.

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/152838
Approved by: https://github.com/jeffdaily
This commit is contained in:
Prachi Gupta
2025-05-06 19:37:55 +00:00
committed by PyTorch MergeBot
parent 8faa0b18c3
commit ed63cb20ec

View File

@ -60,7 +60,7 @@ __device__ __forceinline__ void trap() {
__device__ __forceinline__ size_t global_timer_ns() {
#if defined(USE_ROCM)
static constexpr double MI300_FREQ_GHZ = 2.1;
return __builtin_amdgcn_s_memtime() / MI300_FREQ_GHZ;
return clock64() / MI300_FREQ_GHZ;
#else
size_t val;
asm volatile("mov.u64 %0, %globaltimer;" : "=l"(val) : : "memory");