Repository navigation
feat(rccl-tests): gin-sdma in-device (wall_clock64) A2A timing mechanism - #10658
Merged
Merged
Conversation
Adapt the in-kernel device-side timing instrumentation from gin-stage2j-sdma-A1457-a2av-wip to this branch's simpler two-kernel (GIN impl 3 / Hybrid impl 4) A2A architecture. Measures pure GPU device-function latency, excluding host launch/graph/teardown overhead. - gin_sdma_devtime.h: portable gin_devtime::measure() scaffold that queries the GPU wall-clock rate, allocates per-CTA start/end stamps, launches a persistent skip+loop timed kernel, reduces min(start)..max(end) over CTAs, takes the slowest local GPU, then MPI_MAX across ranks. - alltoall.cu: factor GIN/Hybrid collective bodies into reusable __device__ functions, add persistent GinAlltoAllTimedKernel/HybridAlltoAllTimedKernel loop variants, and implement AlltoAllDeviceTime hook (env-controlled loop/skip/autoreduce; selects timed kernel via deviceImpl). - common.h/common.cu: add optional testColl::deviceTime hook and expose deviceImpl (non-static) so per-collective hooks can pick the matching timed kernel. Integrate device-time-only mode into BenchTime: NCCL_GIN_ANVIL_DEVICE_TIMING=1 prints an extra #[a2a-devtime] line; =2 reports in-kernel device latency as the metric (skips host graph loop). - CMakeLists.txt: hipify/copy gin_sdma_devtime.h with the collective tests. Compile-verified on MI355X/gfx950: alltoall_perf builds and links (timed kernels + hook present), BUILD SANITY OK, GIN Anvil-SDMA smoke OK. Co-authored-by: Cursor <cursoragent@cursor.com> (cherry picked from commit 540956b) modified: projects/rccl-tests/src/CMakeLists.txt modified: projects/rccl-tests/src/alltoall.cu modified: projects/rccl-tests/src/common.cu modified: projects/rccl-tests/src/common.h new file: projects/rccl-tests/src/gin_sdma_devtime.h
Fixes from PR #1 review of the in-device (wall_clock64) A2A timing path: - gin_sdma_devtime.h: split measure() into launch-all then sync-all passes. Synchronizing GPU i before launching GPU i+1 deadlocks under -g N>1 because the collective bodies do an all-ranks device barrier and each local GPU is its own rank (GPU 0 waited on GPUs never launched). Mirrors the startColl()/completeColl() launch-then-complete split. - gin_sdma_devtime.h: reduce via the harness Allreduce() helper instead of a direct MPI_Allreduce on MPI_COMM_WORLD. MPI is MPI_THREAD_SINGLE, so under -t N>1 all threads would issue concurrent collectives (can hang); Allreduce() combines across threads, serializes MPI to the last thread, and broadcasts back -- also fixing localMaxUs not being combined across threads. - common.h/common.cu: declare Allreduce<T> and add double/long long explicit instantiations so gin_sdma_devtime.h (via alltoall.cu) can call it. - alltoall.cu: gate AlltoAllDeviceTime to deviceImpl 3/4 (GIN/Hybrid) only; -D1/-D2 (Nvl LSA) lack GIN provisioning and would fault/hang. - alltoall.cu: clamp skip to >= 0 so the start stamp is always written (a negative skip left start_time[] uninitialized, skewing the mode-2 metric). - common.cu: document that mode-2 datacheck validates the production path; the timed kernels reuse the same __device__ collective functions, so only the loop/skip/stamp wrapper is not exercised by datacheck. Co-authored-by: Cursor <cursoragent@cursor.com> modified: projects/rccl-tests/src/common.cu
Addresses PR #1 review (#5): in device-time-only mode the datacheck loop re-inits buffers and validates the PRODUCTION kernel, not the timed kernel. Add NCCL_GIN_ANVIL_DEVTIME_CHECK=1 (default off): after the deviceTime hook runs skip+loop back-to-back collectives into recvbuff, validate that output against `expected` before the datacheck loop overwrites it. Each timed iteration is a full deterministic collective over the unchanged sendbuff, so the final recvbuff equals `expected`. Wrong-element counts are summed across threads/ranks; any mismatch fails the run. Requires datacheck on (populates `expected`). Default behavior is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
Addresses three reviewer (pvallem) findings on the in-device timing path: 1. Silent 0.00 us / inf GB/s in device-time-only mode (mode 2). When the timing hook produced no measurement -- the timed kernel never ran (non-GIN impl -D1/-D2, unsupported op/type, count==0, or loop<1) -- deviceDeltaSec stayed 0 and was reported as THE metric, so getBw divided by zero and printed inf GB/s with no warning. AlltoAllDeviceTime now returns a negative sentinel (-1) when the grid produced no positive busy window, and BenchTime emits a one-line WARN and skips the row instead of a bogus metric. 2. NCCL_GIN_ANVIL_DEVTIME_CHECK validated the wrong buffer when the kernel did not run: on early-return the stale warmup/production result passed (false green), and under -w 0 the raw init scratch failed (false red). The check is now reached only after the WARN+skip guard above, i.e. only when the timed kernel actually ran and recvbuff holds its output. 3. Single wall-clock rate applied to all GPUs. wallClockRateKhz() sampled the rate once from the current device; on a mixed-clock node that skews the non-reference GPUs' cycle->us conversion. It now takes a device ordinal and is sampled per-GPU inside the Pass-2 stamp-reduction loop of measure(). Verified on smci355 (MI355X/gfx950), -DENABLE_DEVICE_API=ON -DENABLE_ROCSHMEM=ON, 8-GPU GIN-SDMA AllToAll (128 B..1 MiB): mode 1 augment lines and mode 2 device metric agree (~40.9 us @1 MiB); mode 2 + DEVTIME_CHECK passes with 0 wrong elements; mode 2 with -D1 now emits the WARN+skip for every size with zero inf and zero bogus 0.00 us rows. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace ANVIL-specific devtime env vars with rccl-tests CLI flags (-B/-L/-P tier overrides and -H datacheck) per review feedback, remove the legacy A2A env alias, and fail when wall-clock rate query fails. Co-authored-by: Cursor <cursoragent@cursor.com>
5 tasks done
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
3 tasks done
dlamd1dai
added a commit
to dlamd1dai/rocm-systems
that referenced
this pull request
Aug 25, 2026
Document end-state-B branch roles and record that upstream A2A devtime (PR ROCm#10658 @ b6b7c85) is already present on the NCCL 2.30.7 wip line via earlier merges; no functional cherry-pick required for this pass. Co-authored-by: Cursor <cursoragent@cursor.com>
The header is included from source before hipify, so CUDA runtime calls were undeclared in device-api CI. Use hip* host APIs to match the existing wallClockRateKhz helper. Co-authored-by: Cursor <cursoragent@cursor.com>
5 tasks done
Skip bandwidth rows when host-timed deltaSec is non-positive to avoid divide-by-zero in getBw, matching the existing device-timing=2 guard. Also avoid zero denominators in iter/graph normalization and per-iter stats. Co-authored-by: Cursor <cursoragent@cursor.com>
Extract pure host helpers into gin_sdma_devtime_host.h and add GTest coverage for the SIGFPE skip path and gin_sdma_devtime stamp-reduction math without GPU or MPI. Co-authored-by: Cursor <cursoragent@cursor.com>
5 of 9 tasks
amd-jiali
reviewed
Aug 25, 2026
…api CI Adds opt-in pytest coverage for in-kernel wall_clock64 timing (-B 1/2 and -B 2 -H 1) and wires it into run-device-api-ci.sh after the benchmark matrix. Co-authored-by: Cursor <cursoragent@cursor.com>
amd-jiali
self-requested a review
August 25, 2026 22:12
amd-jiali
approved these changes
Aug 25, 2026
TheRock sub-projects cannot call find_package(GTest) unless the dependency is declared in super-project BUILD_DEPS. Gate test/ behind BUILD_RCCL_TESTS_HOST_UNIT_TESTS and skip it when THEROCK_STAGE_INSTALL_ROOT is set so comm-libs configure succeeds; standalone cmake builds unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
pvallem
reviewed
Aug 26, 2026
common.cu includes this header; listing it in COMMON_FILES ensures hipify-perl copies it into the hipify build tree. Co-authored-by: Cursor <cursoragent@cursor.com>
pvallem
reviewed
Aug 26, 2026
pvallem
reviewed
Aug 26, 2026
Share skipped out-of-place column filler/JSON key between util.cu and host GTest. Replace predicate-only skip test with golden stdout/JSON layout checks; drop unreachable -K and khz<=0 edge cases. Co-authored-by: Cursor <cursoragent@cursor.com>
pvallem
reviewed
Aug 26, 2026
pvallem
reviewed
Aug 26, 2026
Zero recvbuff before timed-kernel hook when -H 1 is enabled so datacheck validates timed output instead of warmup residue. Buffer mode-1 #[a2a-devtime] line in threadArgs and flush after the row terminator. Brace the avg-bw divide guard. Co-authored-by: Cursor <cursoragent@cursor.com>
pvallem
reviewed
Aug 26, 2026
With -B 2 the host timed loop is skipped but initEvents still ran, so -I 1 queried unrecorded events. Gate record on !deviceOnly. Co-authored-by: Cursor <cursoragent@cursor.com>
pvallem
reviewed
Aug 26, 2026
Hybrid -D 4 uses split world/LSA sync domains; per-CTA __syncthreads() let LSA CTAs stamp end_time ahead of CTA 0. Add a per-GPU gridIterJoin barrier before start/end stamps in HybridAlltoAllTimedKernel. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace atomic gridIterJoin with per-CTA ncclBarrierSession(ncclTeamTagWorld) so CTA 0 and LSA CTAs align each iteration. Raise hybrid barrierCount to deviceCtaCount for per-CTA hybrid world barrier slots; ginSignalCount stays 1. Co-authored-by: Cursor <cursoragent@cursor.com>
pvallem
reviewed
Aug 27, 2026
pvallem
reviewed
Aug 27, 2026
Join hybrid timed kernel only at start/end stamps so barrier cost is not inside the measured window. Use testStreamSynchronize in gin_devtime::measure so mode 2 honors -T timeout and ncclCommAbort on GIN stalls. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
|
@pvallem — both Aug 27 review items are addressed in 7386034:
Replies are on the two threads. Could you take another look when you have a moment? CI: device-api (incl. AllToAll devtime smoke 3/3), GIN, host unit tests, and rccl precheckin are green. |
pvallem
reviewed
Aug 27, 2026
Split gin_devtime::measure() pass 1 so hipMalloc runs on every local GPU before any timed kernel is launched, keeping the error path safe if allocation fails mid-loop. Co-authored-by: Cursor <cursoragent@cursor.com>
pvallem
approved these changes
Aug 27, 2026
dlamd1dai
added a commit
to dlamd1dai/rocm-systems
that referenced
this pull request
Aug 27, 2026
…ates Reconcile PR #4 with merged upstream ROCm#10658 (A2A devtime host helpers, BenchTime skip/augment/check path) and ROCm#10672 (GDA/SDMA device template tests + GIN CI wiring). AllGather devtime now buffers via devtimeAugmentLine to match the A2A augment pattern; AllGather-specific unit test targets remain. Co-authored-by: Cursor <cursoragent@cursor.com>
dlamd1dai
added a commit
to dlamd1dai/rocm-systems
that referenced
this pull request
Aug 27, 2026
…ates Reconcile PR #4 with merged upstream ROCm#10658 (A2A devtime host helpers, BenchTime skip/augment/check path) and ROCm#10672 (GDA/SDMA device template tests + GIN CI wiring). AllGather devtime now buffers via devtimeAugmentLine to match the A2A augment pattern; AllGather-specific unit test targets remain. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
TheRock Submodule Bump ActivityNewest first
|
dlamd1dai
added a commit
to dlamd1dai/rocm-systems
that referenced
this pull request
Aug 28, 2026
…ates Reconcile PR #4 with merged upstream ROCm#10658 (A2A devtime host helpers, BenchTime skip/augment/check path) and ROCm#10672 (GDA/SDMA device template tests + GIN CI wiring). AllGather devtime now buffers via devtimeAugmentLine to match the A2A augment pattern; AllGather-specific unit test targets remain. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Aug 28, 2026
dlamd1dai
added a commit
to dlamd1dai/rocm-systems
that referenced
this pull request
Aug 29, 2026
…ates Reconcile PR #4 with merged upstream ROCm#10658 (A2A devtime host helpers, BenchTime skip/augment/check path) and ROCm#10672 (GDA/SDMA device template tests + GIN CI wiring). AllGather devtime now buffers via devtimeAugmentLine to match the A2A augment pattern; AllGather-specific unit test targets remain. Co-authored-by: Cursor <cursoragent@cursor.com>
dlamd1dai
added a commit
to dlamd1dai/rocm-systems
that referenced
this pull request
Aug 31, 2026
…ates Reconcile PR #4 with merged upstream ROCm#10658 (A2A devtime host helpers, BenchTime skip/augment/check path) and ROCm#10672 (GDA/SDMA device template tests + GIN CI wiring). AllGather devtime now buffers via devtimeAugmentLine to match the A2A augment pattern; AllGather-specific unit test targets remain. Co-authored-by: Cursor <cursoragent@cursor.com>
dlamd1dai
added a commit
to dlamd1dai/rocm-systems
that referenced
this pull request
Sep 1, 2026
…ates Reconcile PR #4 with merged upstream ROCm#10658 (A2A devtime host helpers, BenchTime skip/augment/check path) and ROCm#10672 (GDA/SDMA device template tests + GIN CI wiring). AllGather devtime now buffers via devtimeAugmentLine to match the A2A augment pattern; AllGather-specific unit test targets remain. Co-authored-by: Cursor <cursoragent@cursor.com>
dlamd1dai
added a commit
that referenced
this pull request
Sep 1, 2026
…ates Reconcile PR #4 with merged upstream #10658 (A2A devtime host helpers, BenchTime skip/augment/check path) and #10672 (GDA/SDMA device template tests + GIN CI wiring). AllGather devtime now buffers via devtimeAugmentLine to match the A2A augment pattern; AllGather-specific unit test targets remain. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes dlamd1dai/rocm-systems#1 (fork PR retargeted to upstream
develop).Summary
Adds device-side (in-kernel
wall_clock64) timing for the GIN-SDMA AllToAll collective, measuring pure GPU device-function latency (excludes host launch / graph capture / teardown overhead).gin_sdma_devtime.h— portablegin_devtime::measure()scaffold: queries the GPU wall-clock rate, allocates per-CTA start/end stamps, launches a persistentskip+looptimed kernel, reducesmin(start)..max(end)over CTAs, takes the slowest local GPU, thenMPI_MAXacross ranks. Fails if wall-clock rate query fails (no silent fallback).gin_sdma_devtime_host.h— pure host helpers shared byBenchTime,gin_sdma_devtime.h, and the new GTest target: elapsed normalization, cuda-graph scaling, zero/negativedeltaSecskip guard, iter-stats gating, and stamp-reduction math (reduceMinStart/reduceMaxEnd/gridBusyWindowPerIterUs).alltoall.cu— factors the GIN/Hybrid collective bodies into reusable__device__functions, adds persistentGinAlltoAllTimedKernel/HybridAlltoAllTimedKernelloop variants, and implements theAlltoAllDeviceTimehook (CLI-controlled loop/skip/tier overrides; selects the timed kernel viadeviceImpl).common.h/common.cu— adds the optionaltestColl::deviceTimehook and exposesdeviceImpl(non-static) so per-collective hooks can pick the matching timed kernel. Integrates device-time modes intoBenchTime:--device_timing 1(-B 1) — augment: normal run plus an extra#[a2a-devtime]line.--device_timing 2(-B 2) — device-time-only: reports in-kernel device latency as the metric (skips the host graph loop for the out-of-place pass).deltaSec <= 0(avoidsgetBwdivide-by-zero / SIGFPE on fast collectives or coarse timers).CMakeLists.txt— hipify/copygin_sdma_devtime.hwith the collective tests; enable CTest and addtest/host unit-test subdirectory.test/test_AllToAllDevtime.py— opt-in GPU smoke pytest (GIN-D 3,-g 1): exercises-B 1(#[a2a-devtime]),-B 2, and-B 2 -H 1; wired intorun-device-api-ci.shafter the device-api benchmark matrix.test/gin_sdma_devtime_host_test.cpp— CPU-only GTest (rccl-tests-GinSdmaDevtimeHostUnit, 6 cases) covering BenchTime zero-time guards and devtime stamp-reduction math; no GPU/MPI required.CLI flags (replaces env vars; per @abouteiller review)
-B/--device_timing-L/--devtime_loop-P/--devtime_skip-W/--devtime_loop_mid-L)-Q/--devtime_loop_large-j/--devtime_skip_mid-P, 2))-k/--devtime_skip_large-P, 1))-H/--devtime_checkExample (mode 1 augment, MI355 sweep):
JIRA ID: AICOMRCCL-1458
AICOMRCCL-1459, AICOMRCCL-1460
Stacking
Base branch:
develop. Depends on #10420 (128 MiB Anvil-SDMA put cap), merged 2026-08-24.Rebased onto upstream
develop@60ca803(2026-08-24). Devtime tip:9c17f5f. Zero diff inprojects/rccl/; changes inrccl-testsonly. Eight commits preserved (not squashed).Build gate
The timed path (
AlltoAllDeviceTime+ the*TimedKerneltemplates) is compiled only underENABLE_DEVICE_APIandNCCL_VERSION_CODE >= NCCL_VERSION(2,28,7); otherwise a#elsestub is compiled instead.ENABLE_DEVICE_APIdefaults OFF ininstall.sh/Makefile, so a default build does not compile this code. Build with--enable-device-api(cmake-DENABLE_DEVICE_API=ON) against RCCL >= 2.28.7 to exercise it; CI covering this collective should do the same.Compile-verified with
-DENABLE_DEVICE_API=ON:alltoall_perfbuilds & links;AlltoAllDeviceTime+GinAlltoAllTimedKernel/HybridAlltoAllTimedKernelpresent;Allreduce<T>cross-thread reduction resolves at link time.BUILD SANITY OK— GIN host plugins inlibrccl.so, Anvil SDMA factory linked,AlltoAllDeviceTimepresent inalltoall_perf. GIN Anvil-SDMA runtime smoke OK. Use the default device linker (do not pass--no-device-linkerto RCCLinstall.shon ROCm 7.13; otherwisecooperative_groups::this_cluster()duplicate symbols fail the link).Test plan
alltoall_perfbuilds & links (AlltoAllDeviceTime+ timed kernels present), GIN Anvil-SDMA smoke OK.-B 1 -L 20 -P 5, augment) on MI355X: normal numbers plus#[a2a-devtime]line per size (128 B–4 GB); datacheckOut of bounds values : 0 OK.-B 2 -L 20 -P 5, device-time-only) on MI355X: reported metric is in-kernel device latency;#wrong=0across 128 B–4 GB.-H 1on MI355X: timed-kernel output validated againstexpected— 0 wrong elements across all sizes through 4 GB; datacheck clean.-H 1validated earlier on MI300X (see below; pre-rebase stack).rccl-tests-GinSdmaDevtimeHostUnit(MI355X): 6/6 GTest cases pass — BenchTime zero-time skip, elapsed normalization, cuda-graph scaling, iter-stats gating, andgin_sdma_devtime.hstamp-reduction math.Build/run host unit test (no GPU/MPI):
Review updates
@pvallem (addressed on fork PR #1; review threads linked there)
measure()split into launch-all then sync-all passes to avoid the-g N>1device-barrier deadlock.Allreduce()helper (MPI serialized to the last thread; also combines across threads) instead of a directMPI_AllreduceonMPI_COMM_WORLD.AlltoAllDeviceTimegated todeviceImpl3/4 (GIN/Hybrid) only.skipclamped to>= 0so the start stamp is always written.--devtime_checkvalidates the timed kernel's output againstexpectedbefore the datacheck loop re-inits.khz=1fallback).@amd-jiali
test/test_AllToAllDevtime.py(GIN-D 3, modes-B 1/-B 2/-B 2 -H 1) and hooked it into device-api CI viarun-device-api-ci.sh.@abouteiller
NCCL_GIN_ANVIL_A2A_DEVICE_TIMINGand all other devtime env vars.AUTOREDUCEwith explicit--devtime_loop_mid/--devtime_loop_largetier knobs.Runtime validation (MI355X / gfx950, GIN Anvil-SDMA, CLI flags)
8-GPU MI355X node (
smci355-ccs-aus-m03-17), docker imagerccl-gin-devtime-pr9927:latest(ROCm 7.13,-DENABLE_DEVICE_API=ON).Config:
NCCL_GIN_TYPE=6,-D 3 -V 8 -g 1 -R 2 -w 5 -n 20, sweep 128 B–4 GB (-b 128 -e 4G -f 2).-B 1 -L 20 -P 5#wrong=0, 26#[a2a-devtime]lines; avg busbw 142.9 GB/s (host)-B 2 -L 20 -P 5#wrong=0; avg busbw 131.8 GB/s (device-time metric)-B 2 -L 20 -P 5 -H 1#wrong=0#[a2a-devtime]349.9 GB/s busbw @ 10.74 ms devtimeRuntime validation (MI300X / gfx942, earlier stack)
Ran on 8-GPU MI300X with
alltoall_perf -D3(NCCL_GIN_TYPE=5on the pre-pr9927 stack; current stack usesNCCL_GIN_TYPE=6),-n 8 -g 1, 128 B–1 MiB:-B 1, augment): normal numbers plus a#[a2a-devtime]line per size; datacheckOut of bounds values : 0 OK.-B 2, device-time-only): reported metric is the in-kernel device latency and tracks the mode-1#[a2a-devtime]value (e.g. 1 MiB: device ~40.9 µs vs host-graph ~28.7 µs); datacheck clean.-H 1: the timed-kernel output is validated againstexpected— 0 wrong elements across all sizes; datacheck clean.Made with Cursor