Repository navigation
[HIP] [Bugfix] Skip empty inputs in custom all-gather - #7302
Conversation
Return from dispatchAllGather before the buffer lookup when the input is empty, and skip the zero-byte hipMemcpyAsync in all_gather_unreg, whose source pointer is null for an empty tensor. Signed-off-by: Xinyu Jiang <xinyuj2@andrew.cmu.edu> Co-authored-by: Zhiyao Jiang <jessicajiang324@gmail.com>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
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 |
…usal - Pick up ROCm#7088's merge with main (ROCm#6983 Q-axis configs through ROCm#7302) so this stacked PR is conflict-free again. - Pick up ROCm#7088's SPLIT_BLOCK_M, which keeps q4 draft verify blocks at 16 rows under main's BLOCK_M 32 entry. - No textual conflicts; the CAUSAL constexpr composes with the merged split code.
…usal - Pick up ROCm#7088's merge with main (ROCm#6983 Q-axis configs through ROCm#7302) so this stacked PR is conflict-free again. - Pick up ROCm#7088's SPLIT_BLOCK_M, which keeps q4 draft verify blocks at 16 rows under main's BLOCK_M 32 entry. - No textual conflicts; the CAUSAL constexpr composes with the merged split code.
Summary
Skip empty inputs in the custom all-gather: return from
dispatchAllGatherbefore the buffer lookup, and skip the zero-bytehipMemcpyAsyncinall_gather_unreg.Motivation
With attention data parallelism (DP), a DP group that has no requests in a step still joins the collectives, with empty inputs. RL rollouts do this routinely: groups that finish early wait for the longest requests. When a DP group has more than one GPU (attention TP > 1), its all-gather then reaches AITER with an empty input, and
dispatchAllGatherlaunches its kernel with zero blocks. The next kernel that checks for errors fails withHIP runtime error: invalid configuration argument.should_custom_agaccepts size zero while the all-reduce and reduce-scatter checks reject it, so all-gather is the only path that gets here.Changes
dispatchAllGatherreturns before the buffer lookup when the input is empty, so no zero-block kernel is launched.all_gather_unregskips the zero-bytehipMemcpyAsync, whose source pointer is null for an empty tensor.Testing
Tested on MI355X (gfx950); see "Validation and unverified scope" below.
Documentation
This is an internal guard for empty inputs; no API changes.
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
5a40117
Behavior and intent
An empty all-gather input now returns immediately instead of launching a kernel with zero blocks. Before, the next kernel that checked for errors failed with
HIP runtime error: invalid configuration argument, which stopped RL rollouts with attention DP whenever a DP group was idle. Non-empty inputs are unchanged.Validation and unverified scope
On MI355X with AITER e7d2453 plus this change:
all_gather_unreg) path.Unverified: graph replay on the registered (
all_gather_reg) path, which was tested in eager mode only, and runs on MI250X and MI300X.PR-specific question
The main boundary is that every rank has to skip together. A standard all-gather requires the same input size on every rank, so an empty collective is empty on all ranks of the group and they all return early; no rank waits at a barrier the others skipped. For non-empty inputs the only change is one extra size check.
Changed op tests
None.
Co-author-with: @JessicaJiang-123