Skip to content

rccl/gin: fix inverted system-scope fence guard on HIP backends - #3

Closed
dlamd1dai wants to merge 2 commits into
users/dondai/gin-gda-a2a-unittestsfrom
users/dondai/gin-scope-fence-guard-fix
Closed

rccl/gin: fix inverted system-scope fence guard on HIP backends#3
dlamd1dai wants to merge 2 commits into
users/dondai/gin-gda-a2a-unittestsfrom
users/dondai/gin-scope-fence-guard-fix

Conversation

@dlamd1dai

@dlamd1dai dlamd1dai commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • The GIN Put/PutValue device templates gate the pre-put system fence on (required==system && given>required). On HIP, hip_compat.h orders thread_scope_system as the max value, so given>required is never true when required==system — the __threadfence_system() branch is dead code, and a caller that only guaranteed a weaker scope (e.g. block) silently skips the system fence it requested.
  • Flip the guard to (required==system && given<required) on the two HIP backends (anvil_sdma, rocshmem_gda), routed through a new NCCL_GIN_THREADFENCE_SYSTEM() seam in gin_device_common.h (expands to __threadfence_system() in production; unit tests can override it to observe the branch).
  • gdaki intentionally left as given>required: it is CUDA-only (NCCL_GIN_GDAKI_ENABLE=0 on HIP) and libcu++ orders thread_scope_system as the lowest value — the opposite of HIP — so given>required is correct there, and flipping it would make its DOCA system release dead code. Its comment is expanded to document this.
  • Tests: install a counting override of the fence seam and replace the former Put_WeakerGivenScopeStillPuts with Put_WeakerGivenScopeFencesAndPuts (required=system, given=block → asserts the fence ran exactly once and the put landed), plus Put_EqualScopeTakesNoFence (required=given=system → asserts no fence and the put landed).

Follow-up to review on #2 (stacked on that branch).

JIRA ID: AICOMRCCL-1527

Stacking

Branch Tip Notes
Base #2 39a05ff GIN device-template unit tests + CI wiring
This PR 3b66d26 2 commits, 5 files (+75/−19 vs #2)

Merge order: ROCm#10420#1#2 → this PR → #4.

Test plan

  • Rebased onto rccl: GIN AllToAll device-template unit tests (gin-gda + gin-sdma shadow fix) #2 (39a05ff); branch now stacks correctly (was previously a sibling off meta-repro).
  • Fence-counting GDA template tests: Put_WeakerGivenScopeFencesAndPuts and Put_EqualScopeTakesNoFence.
  • Prior MI300X (gfx942) fixture run: 34/34 PASS (13 GDA + 12 SDMA + 9 IPC); log pr3-fixtures-full-20260822-001621.log.
  • MI355 functional validation sufficient; not chasing fork CI timeouts.
  • gdaki path unchanged (CUDA-only; not built/tested in this AMD/HIP tree).

Made with Cursor

@dlamd1dai
dlamd1dai force-pushed the users/dondai/gin-gda-a2a-unittests branch from 3dba9fc to 3471bf3 Compare August 21, 2026 21:21
@dlamd1dai
dlamd1dai force-pushed the users/dondai/gin-scope-fence-guard-fix branch 2 times, most recently from 9d72e71 to 019a879 Compare August 22, 2026 16:01
@dlamd1dai
dlamd1dai force-pushed the users/dondai/gin-gda-a2a-unittests branch from 7879919 to 39a05ff Compare August 22, 2026 16:01
@dlamd1dai
dlamd1dai changed the base branch from users/dondai/gin-gda-a2a-unittests to users/dondai/gin-sdma-a2a-meta-repro-pr9927 August 22, 2026 16:01
@dlamd1dai
dlamd1dai force-pushed the users/dondai/gin-scope-fence-guard-fix branch from 019a879 to 3b66d26 Compare August 23, 2026 18:07
@dlamd1dai
dlamd1dai changed the base branch from users/dondai/gin-sdma-a2a-meta-repro-pr9927 to users/dondai/gin-gda-a2a-unittests August 23, 2026 18:07
@dlamd1dai
dlamd1dai force-pushed the users/dondai/gin-gda-a2a-unittests branch from 39a05ff to 11fb115 Compare August 24, 2026 22:56
dlamd1dai and others added 2 commits August 24, 2026 19:17
Flip the pre-put system fence guard to (required==system && given<required)
on anvil_sdma and rocshmem_gda. Add NCCL_GIN_THREADFENCE_SYSTEM() seam in
gin_device_common.h. Expand gdaki comment documenting opposite libcu++ ordering.

Test updates for GinRocshmemGdaTemplate_test.cpp remain in the gin-gda-a2a-unittests PR.

Co-authored-by: Cursor <cursoragent@cursor.com>
Count NCCL_GIN_THREADFENCE_SYSTEM invocations in GDA template tests so
G7 validates the corrected given<required guard fires once when required
is system and given is block, and does not fire when scopes match.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dlamd1dai

Copy link
Copy Markdown
Owner Author

Superseded by upstream PR ROCm/rocm-systems#10675, stacked on #10672. Branch users/dondai/gin-scope-fence-guard-fix rebased onto users/dondai/gin-gda-a2a-unittests @ 11fb115 (2 commits, tip a2899ae). Post-rebase MI300X validation: 34/34 PASS (log ~/rocm-systems/ddai-artifacts/logs/pr3-fixtures-full-20260824-231854.log). Closing this fork PR.

@dlamd1dai dlamd1dai closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant