Repository navigation
hip-tests: zero-initialize host atomics buffer before __atomic_fetch_add onto it - #8967
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
There was a problem hiding this comment.
Pull request overview
This PR fixes nondeterministic failures in HIP atomics “*_Host_And_GPU” tests by ensuring the host-side competitor buffer allocated via hipHostMalloc is explicitly zero-initialized before any host atomic operations run.
Changes:
- Add
<cstring>include to supportstd::memset. - Zero-initialize the
hipHostMallochost competitor buffer inTestCore()before launching host threads.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This pull request has been inactive for 25 days and will be marked as stale. If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs. |
|
This pull request has been automatically closed due to inactivity (30 days with no updates). If you'd like to continue working on this, feel free to reopen the PR or create a new one. |
de26228 to
a179f34
Compare
|
🤖 AI-assisted pre-review (for @mangupta) Re-reviewed the updated head ( |
TheRock Submodule Bump ActivityNewest first
|
hipHostMalloc does not guarantee zeroed memory. The host competitor buffer
in the *_Host_And_GPU atomics tests was used uninitialized.
Motivation
The
atomicAdd/Sub/CAS_system_Positive_Host_And_GPUtests allocate thehost competitor buffer with
hipHostMallocand immediately run host__atomic_fetch_addon it — without initializing to zero. The devicebuffers are
hipMemset'd, but the host buffer is not. SincehipHostMallocdoes not guarantee zeroed memory (same as
malloc), the test accumulatesonto undefined contents and fails the final comparison.
Technical Details
One-line fix in
arithmetic_common.hhTestCore(): addstd::memset(host_ptr, 0, size)afterhipHostMalloc, before hostthreads run. Uses host-side
memset(nothipMemset) since the bufferis only touched by host threads.
Issue Tracking
JIRA ID : ROCM-28378
Test Plan
Ran all affected tests:
atomicAdd_system_Positive_Host_And_GPU(6 typesections),
atomicSub_system_Positive_Host_And_GPU,atomicCAS_system_Positive_Host_And_GPU(4 type variants) — all pass.Tests using other common headers (atomicExch, And/Or/Xor, Min/Max) are
not affected.
Test Result
All pass. No regressions.
Submission Checklist