Skip to content

Replace deprecated __hip_atomic_* builtins with __scoped_atomic_* equivalents#4902

Open
srinivamd wants to merge 1 commit into
developfrom
fix/replace-deprecated-hip-atomics
Open

Replace deprecated __hip_atomic_* builtins with __scoped_atomic_* equivalents#4902
srinivamd wants to merge 1 commit into
developfrom
fix/replace-deprecated-hip-atomics

Conversation

@srinivamd
Copy link
Copy Markdown

@srinivamd srinivamd commented May 21, 2026

Summary

Replace deprecated __hip_atomic_load and __hip_atomic_compare_exchange_strong builtins in atomic.hpp with their non-deprecated equivalents __scoped_atomic_load_n and __scoped_atomic_compare_exchange, using __MEMORY_SCOPE_DEVICE instead of __HIP_MEMORY_SCOPE_AGENT.

Root cause: ROCm 7.14.0 HIP compiler deprecated the __hip_atomic_* builtins. Because MIGraphX JIT-compiles GPU kernels with -Werror,-Whip-deprecated-builtins, the deprecation warnings become hard errors, causing scatter_mul (and any other operation using atomic CAS) to fail at runtime. This is a regression from ROCm 7.13.0 (PASS) to 7.14.0 (FAIL).

Changes:

  • __hip_atomic_load__scoped_atomic_load_n
  • __hip_atomic_compare_exchange_strong__scoped_atomic_compare_exchange
  • __HIP_MEMORY_SCOPE_AGENT__MEMORY_SCOPE_DEVICE
  • Added #if __has_builtin(__scoped_atomic_load_n) / #else guard for backward compatibility with ROCm 7.13.x and earlier

Fixes: ROCM-24855test_verify_general abort on test_scatter_elements_mul_duplicate_index

Test plan

  • ctest -R test_verify_general passes on ROCm 7.14.0 (MI300/MI350)
  • ctest -R test_verify_general still passes on ROCm 7.13.0 (backward compat)
  • No new compiler warnings from atomic.hpp

@srinivamd srinivamd requested a review from causten as a code owner May 21, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant