Repository navigation
[Attention] Name inner attention implementations explicitly - #4533
Merged
Merged
Conversation
[ghstack-poisoned]
fegin
requested review from
IvanKobzarev,
SherlockNoMad,
aditvenk,
sanketpurandare,
tianyu-l,
wconstab and
wwwjn
as code owners
September 9, 2026 08:06
This was referenced Sep 9, 2026
tianyu-l
approved these changes
Sep 9, 2026
acisseJZhong
pushed a commit
to acisseJZhong/torchtitan
that referenced
this pull request
Sep 11, 2026
ghstack-source-id: ae36e09 Pull-Request: pytorch#4533
[ghstack-poisoned]
[ghstack-poisoned]
fegin
added a commit
that referenced
this pull request
Sep 11, 2026
…rst example (#4322) Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.15.0) (oldest at bottom): * #4459 * #4450 * #4533 * #4449 * __->__ #4322 1. Implement ModelTransform interface . 2. Rewrite the current CP: Move the K/V all-gather from local-map redistribution in `Module.forward()` into AllGatherCPFlexAttention. Add kernel selection and validation, then update CP recipes and tests. All CP implementation will follow this approach.
fegin
added a commit
that referenced
this pull request
Sep 11, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.15.0) (oldest at bottom): * #4459 * #4450 * #4533 * __->__ #4449 * #4322 Switch to use `spmd_types.redistribute` instead of using `flex_cp_allgather`. The backward of the gather is a reduce-scatter, and the API requires an explicit dtype for it under reduced precision. `AllGatherCPFlexAttention.Config.reduce_dtype` exposes that choice. It defaults to None, which keeps the reduction in the input dtype and so matches `flex_cp_allgather`. Set it to float32 to trade two casts for accuracy, which matters as the CP degree grows and the reduce-scatter sums more contributions. **Numerics Verification** Loss and grad_norm are bitwise identical before and after, with the default `reduce_dtype`. `scripts/loss_compare.py` over `llama3_debugmodel_fsdp2_cp2` (FSDP 2 + CP 2, 4 H100s, spmd_types, bf16 params), shared seed checkpoint, `--debug.seed=42 --debug.deterministic`, 10 steps, values read from the TensorBoard scalars: metric max |before - after| loss 0.0 grad_norm 0.0 Step 1 loss is 8.048094749450684 on both sides and step 10 is 4.038208961486816. `--assert-equal` passed for both metrics.
[ghstack-poisoned]
saforem2
added a commit
to saforem2/torchtitan
that referenced
this pull request
Sep 15, 2026
…moke.sh Same two phases as the sunspot original (fail-fast import probe, then seeded deterministic train steps ending in a greppable VERDICT), with three deliberate differences: 1. next-eval queue + flare filesystem. next-eval has no acl_users, 6h walltime, 20 queued/user, and runs bkc_definition compute_aurora_test_* where every other queue pins compute_aurora_prod_*. /opt/aurora/26.181.0 exists on those compute nodes and NOT on login nodes. 2. No ezpz yeet-env. The sunspot script broadcasts a .venv.tar.gz to /tmp; a freshly cloned sync tree has none. Activates the project venv directly -- irrelevant at 2 nodes and removes a moving part from a run whose only job is to isolate the merge. 3. Keeps the TP=2 arm. That is the arm that catches the pytorch#4533 class of break: the local_map/SPMD contract matches by positional-arg NAME and fires only under TP>1, so a TP=1-only smoke passes straight over the bug this sync was most likely to introduce. Also dumps per-step losses at the end for eyeball comparison against the pre-merge baseline.
saforem2
added a commit
to saforem2/torchtitan
that referenced
this pull request
Sep 15, 2026
Two jobs on next-eval: 8829080 (merged) and 8829104 (the merge commit's first parent), same venv, same script, so a difference in the run is a difference in the code. Both trees verified to import 12/12 on that venv before submitting. Notes why the TP=2 arm carries the weight: pytorch#4533 rekeyed a contract that matches by positional-arg name and asserts only under TP>1, so a TP=1-only smoke would pass over the most likely break in this sync.
saforem2
added a commit
to saforem2/torchtitan
that referenced
this pull request
Sep 15, 2026
8829243 on the pre-merge tree: all three arms rc=0, zero DTensor errors, real losses (agpt TP=1 10.88382->10.48337, agpt TP=2 10.88071->10.56243, moe 12.90379->11.45320). Same machine, venv, script and seed as 8829185, which died in FSDP setup on all three arms. The trees differ on one line: config_registry.py:252 pins partial_dtensor pre-merge; pytorch#4419 deleted the pin and the backend. So pytorch#4419 is the cause and the sync ports are clean -- the merged tree reached FSDP setup, well past import, tokenizer and model construction. Also records that no configuration workaround exists: merged core has ZERO references to partial_dtensor and ZERO to spmd_backend, the config field included. The backend is deleted, not unselected. The TP=2 arm passing is worth its own note -- that is the configuration the pytorch#4533 local_map contract asserts under, so there is now a known-good reference to diff against once a torch carrying #181519 lands.
saforem2
added a commit
to saforem2/torchtitan
that referenced
this pull request
Sep 16, 2026
Job 12477656, torch 2.14.0+xpu, 2N/24 ranks: agpt TP=1 rc=0 10.87743 -> 10.75458 -> 10.48057 agpt TP=2 rc=0 10.88015 moe rc=143 RuntimeError: Cannot unflatten unevenly sharded tensor TP=2 passing matters most: that is the arm the pytorch#4533 local_map contract asserts under, and it only fires at TP>1. Losses track the pre-merge baseline to ~3 decimals (10.88382 vs 10.87743; 10.48337 vs 10.48057). Different torch versions so not bitwise, but the merge did not move the math -- consistent with the Perlmutter numerics A/B. Records the full blocker chain. Only two were sync-84 issues (the float global_valid_tokens and the torch floor); the other five were environment. The moe failure is open and NOT yet attributable to the merge: the pre-merge baseline ran moe on torch 2.13, so it is not a controlled comparison.
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.
Stack from ghstack (oldest at bottom):