Repository navigation
Fix GQAttention input redistribution disabled by x -> x_BLD rename - #3708
Merged
acisseJZhong merged 1 commit intoJun 18, 2026
Merged
Conversation
…x rename The shape-suffix rename in pytorch#3443 changed GQAttention.forward's first parameter from `x` to `x_BLD`, but set_gqa_attention_sharding still keyed the input redistribution under "x". The redistribution engine matches in_src/in_dst keys against the actual forward parameter names (via inspect.signature), so in_*_shardings.get("x_BLD") returned None and the attention block's "gather x to Replicate on TP" became a silent no-op. Under SP this left the activation Shard(1) entering the QKV projection. The non-fused QKVLinear has no input check and silently tolerated it, but the fused path's in_src check rejected it, failing the 8-GPU qwen3_fsdp+tp+cp_no_sp_fused_qkv integration test: ValueError: FusedQKVLinear.x: input DTensor has placements (Shard(dim=1),), but in_src_shardings expects (Replicate(),). Fix: key the GQAttention input redistribution under "x_BLD" so the gather runs. With the gather restored, the FusedQKVLinear wrapper config is redundant -- the in_dst was a Replicate->Replicate no-op, and the tuple out_src is a no-op under default/full_dtensor and raises under spmd_types -- so remove it; the fused branch now mirrors the non-fused one (colwise on wqkv only). q/k/v outputs stay Shard(2) via DTensor view/split propagation and are validated at the inner-attention and qk-norm boundaries. Affects all GQAttention models (qwen3, llama3); gpt_oss is unaffected (its Attention.forward still uses `x`).
acisseJZhong
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
June 18, 2026 04:31
pianpwk
approved these changes
Jun 18, 2026
tianyu-l
approved these changes
Jun 18, 2026
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.
Summary
set_gqa_attention_shardingkeyed the attention input redistribution under"x", but #3443 renamedGQAttention.forward's first parameter tox_BLD.The redistribution engine looks up
in_src/in_dstby the actual forwardparameter name, so the lookup missed and the "gather x to Replicate on TP"
silently no-op'd. Under sequence parallelism the activation reached the QKV
projection still
Shard(1), which the fused path rejected:Changes
x_BLDso the gather runs.FusedQKVLinearwrapper config (itsin_dstwas ano-op and its tuple
out_srcdoes nothing in default/full_dtensor andraises under spmd_types); the fused branch now matches the non-fused one.