Repository navigation
PP gloo parity test: size gemma3's grad bounds to its noise on AVX2 kernels - #15286
Merged
Merged
Conversation
#15273 set gemma3's per-element bound from this host's AVX-512 MKL, where its pp x tp step-0 grads differ from the reference by up to 2.8e-5. With MKL and oneDNN held to AVX2 the same run reaches 1.6e-4 per element and 1.4e-4 relative L2, and a CI runner saw 2e-4 (#15275), so the test still failed there. llama and qwen3 on that AVX2 run stay at 2.6e-6 and 5.8e-6. gemma3 now gets 1e-3 per element and 5e-4 relative L2; llama and qwen3 keep 2e-5 and 5e-5 on the same tensor parallel code. Under AVX2, a 1e-2 error in one entry, 5e-3 noise over a tensor, a halved tensor and swapped tp shards each still fail.
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Follow-up to #15273.
tests/test_pp_fsdp2_gloo.py::test_pp2_x_tp2_matches_one_process[gemma3]still fails on some CI runners, for example #15275, whose base includes #15273:Cause
The bound I set in #15273 came from this host's AVX-512 kernels. Gemma3's tensor-parallel fp32 noise depends on which kernels MKL and oneDNN dispatch to.
Worst step-0 grad difference against the one-process reference, as a fraction of the tensor max / relative L2, same seed:
The AVX2 run fails main's bounds the same way CI does: 18 of 168 tensors over gemma3's per-element bound, and the relative L2 over the shared 5e-5. A CI runner saw 2e-4 per element.
So gemma3 under tensor parallel sits about 30x above llama and qwen3 on the same code. The size moves with the instruction set, the signature of rounding amplified by the model's conditioning rather than a systematic error. The thread count makes no difference (1, 2 and 4 threads give identical numbers).
Fix
GRAD_ATOL_REL/ newGRAD_L2_REL)llama and qwen3 keep the strict bounds on the same tensor parallel code, which is architecture-generic. A gemma3-specific fault, such as a wrong shard or a missed reduction, is an O(1) difference.
Verification
test_pp2_x_tp2_matches_one_process, AVX2 emulation (DNNL_MAX_CPU_ISA=AVX2 MKL_ENABLE_INSTRUCTIONS=AVX2 ATEN_CPU_CAPABILITY=avx2): main 1 failed, 2 passed (the gemma3 case, as on CI); this PR 3 passed. On this host's default kernels both pass.v_proj.lora_Bgrad under AVX2. Each fails, and the clean results pass: