Repository navigation
[fix] Size the custom all-reduce input pool from AITER_CAR_POOL_BYTES - #7367
karverma-amd wants to merge 3 commits into
Conversation
The registered pool caps the largest custom all-gather. On gfx1250 the copy-in path stages the whole input into it and throws when it does not fit, which a DP-attention allgather LM head hits at large decode batches. The default stays 1 GiB. Co-authored-by: Cursor <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
valarLip
left a comment
There was a problem hiding this comment.
The default path is unchanged, and the C++ side checks the registered size (int64) before staging, so an input bigger than the pool fails loudly rather than overflowing. A few small changes before merge:
- When
AITER_CAR_POOL_BYTESis below 64 MiB andAITER_CUSTOM_AR_MAX_SIZEis unset,_resolve_car_max_sizestill returns the 64 MiB default.should_custom_arthen accepts inputs the pool cannot hold, and the kernel throws "registered buffer is too small" instead of falling back to RCCL, which breaks graph capture. Please cap the default at the pool size, or enforce a lower bound on the pool. - The variable applies to every arch. On gfx942/950,
_init_ipcalso allocates2*max_sizeof uncached meta, so 16 GiB costs about 48 GiB per rank. Please document this in the comment, or read the variable only on gfx1250. - Please parse it like
AITER_CUSTOM_AR_MAX_SIZE: strip the value, warn and fall back on non-integer or <= 0 values, and log the effective pool size. A small unit test for the parsing and the default (1 << 30) would help.
|
Setting the pool size through AITER_CAR_POOL_BYTES can leave it out of sync with AITER_CUSTOM_AR_MAX_SIZE; the two have to be kept consistent by hand. It also applies to every arch, and on gfx942/950 _init_ipc allocates another 2 * max_size of meta, so a 16 GiB pool costs about 48 GiB per rank. I think a more robust fix is to give all-gather and reduce-scatter their own cutoffs (AITER_CUSTOM_AG_MAX_SIZE / AITER_CUSTOM_RS_MAX_SIZE) and size the pool from the largest of the three, with no separate pool variable. The pool only grows on gfx1250; gfx9 stays at 1 GiB and routes larger inputs to RCCL. See #7433 For your case, AITER_CUSTOM_AG_MAX_SIZE= should be enough. Could you check that DeepSeek-V4.1-Flash capture works on #7433? If it works, we can close this PR. |
…250 only. A pool below 64 MiB left should_custom_ar accepting inputs the copy-in path cannot stage. The unset cutoff is now capped at the pool. AITER_CAR_POOL_BYTES is parsed like AITER_CUSTOM_AR_MAX_SIZE and ignored off gfx1250, where the IPC meta buffer also holds 2 * pool of uncached memory.
|
The three points from the review are in 03152ea.
On #7433: sizing the pool from |
The aiter logger does not propagate, so pytest's caplog stays empty while the warning is on stderr. The three failing assertions now use capfd. Co-authored-by: Cursor <[email protected]>
|
The Standard Tests failure is the new unit test, not the pool logic. The warnings are on stderr ( |
Summary
Let
CudaCommunicatorsize the custom all-reduce / all-gather registered input pool fromAITER_CAR_POOL_BYTES. The default stays 1 GiB, so nothing changes unless the variable is set.Motivation
CudaCommunicatorcreatesCustomAllreducewith its defaultmax_sizeof 1 GiB, and there is no way to raise it. That pool caps the largest custom all-gather. Ongfx1250, CUDA-graph buffer registration is not available, so the copy-in path stages the whole input into the pool, and the kernel throwsregistered buffer is too small to contain the input(csrc/kernels/custom_all_reduce_gfx1250.cu) when it does not fit.A DP-attention model with an allgather LM head (ATOM
ATOM_DP_LM_HEAD_MODE=allgather,ATOM_USE_CUSTOM_ALL_GATHER=1) gathers[dp * rows, vocab / dp]logits in every decode graph. For DeepSeek-V4.1-Flash on 4x MI455X that input passes 1 GiB at large decode batches, and graph capture fails.Changes
_resolve_car_pool_bytesreadsAITER_CAR_POOL_BYTESonce whenCudaCommunicatorbuildsCustomAllreduce. Unset, empty, non-integer, or<= 0keeps the 1 GiB default and warns on a bad value. The variable is honored only on gfx1250. Off gfx1250 it is ignored, because_init_ipcalso allocates2 * max_sizeof uncached meta (about 3x the pool per rank). The custom-AR cutoff from an unsetAITER_CUSTOM_AR_MAX_SIZEismin(64 MiB, pool), soshould_custom_arcannot accept an input the pool cannot hold.Performance (if applicable)
registered buffer is too small to contain the inputAITER_CAR_POOL_BYTES=17179869184Batch 1024 then stops at a separate limit (the gfx1250 all-gather's int32 element count), so serving caps decode graphs at 640.
Testing
Documentation
The variable is opt-in with an unchanged default; the in-code comment states what it controls.
Dependencies
Breaking Changes
None. Unset, the pool is 1 GiB, as today.
PR Self-Review
Reviewed revision
b8c347f
Behavior and intent
CudaCommunicatorsizes the custom all-reduce pool fromAITER_CAR_POOL_BYTES(default1 << 30) on gfx1250 only. The 1 GiB pool is otherwise hard-coded, and on gfx1250 a custom all-gather larger than the pool fails during CUDA-graph capture. Unset, the pool stays 1 GiB. A value below the 64 MiB AR cutoff no longer leavesshould_custom_araccepting inputs the pool cannot stage: the unset cutoff ismin(64 MiB, pool). Off gfx1250 the variable is ignored so the IPC meta buffer does not grow by2 * pool.Validation and unverified scope
One gfx1250 node (4x MI455X), 20261102 Atom image, DeepSeek-V4.1-Flash TP+EP4 with DP attention and the allgather LM head. Unset (1 GiB), with decode graphs through batch 1024: capture fails with
registered buffer is too small to contain the input. WithAITER_CAR_POOL_BYTES=17179869184that error is gone; with graphs through 640, concurrency 1024 served 10 min at 54,395 tok/s with 0 failed samples. What remains unverified: a 1 GiB pool with graphs capped at 640, and a re-run on the per-op cutoff design in #7433.tests/test_car_pool_bytes.pycovers parsing, the gfx1250-only gate, the 1 GiB default, and the cutoff cap. gfx9 no longer grows the pool, so the 3x meta cost does not apply to this variable.PR-specific question
What sets the pool size, and can this change default behavior? Only
AITER_CAR_POOL_BYTES, and only on gfx1250. Unset, non-integer, or<= 0,max_sizeis1 << 30, the same default as before. Off gfx1250 the variable is ignored and the pool stays 1 GiB.Changed op tests
None. The new coverage is
tests/test_car_pool_bytes.py, not an op test: it checks pool parsing, the 1 GiB default, the gfx1250-only gate, and that an unsetAITER_CUSTOM_AR_MAX_SIZEcannot exceed the pool.