docs(audit): FORGE assessment + residency-aware epilogue-fusion track - #565
Merged
Merged
Conversation
Assessment of FORGE (arXiv:2606.22932v2, fusing the optimizer step into the weight-gradient GEMM epilogue at tile granularity) and the generalization it opens for Tessera: fuse a consumer into its producer's tiled epilogue when the consumer's read-locality is no coarser than the producer's tile partition, and prove statically that the intermediate never materializes. Math verified numerically, not asserted. Nine propositions (P1-P6) are stated in the plan and shipped as an executable contract, so the pass that implements W3/W4 inherits a gate rather than an argument: * P1 per-tile exactness is bitwise and partition-independent; the single-use + consumer-is-optimizer guard subsumes FORGE Rem. 2 structurally, because our optimizer ops are value-semantic and Pure (FORGE's PyTorch in-place ordering hazard cannot occur at Graph IR). * P2 exact global-norm clipping provably cannot be fused, and BOTH candidate approximations leave the second moment inflated 3.18x after a spike -- identical to no clipping. grad_clip_scope must fail closed (Decision #21a). FORGE ships with clipping switched off and says so only in two appendix protocol lines. * P5 folding state decay into the GEMM's beta breaks conditionally-routed weights (2.24x error at 50% routing); a verifier condition, given tessera.moe_swiglu_block. * P6 the fp32-accumulator precision benefit is worth ~900x with fp32 state and ~1x with bf16 state. The paper measures it inside a recipe that masks it and reports 4.4%. Whether the benefit is realizable is a numeric_policy question, which is the measured motivation for the Decision #32 carrier work. Also records what is already in tree and easy to miss: the weight-gradient GEMM reaches Graph IR via LinearTransposeInterface, NOT AdjointInterface (MatmulOp does not implement the latter), so grepping only for adjoints yields a false "no compiled matmul VJP" conclusion; TrainingStepFusionPass already implements the identical pattern one level down, with a negative fixture and a LOWER-COUNT-1 check that proves non-materialization in the IR rather than by peak-memory measurement -- which makes this track gateable on any host. Direction only (Decision #26). INTEGRATED_COMPILER_PLAN.md keeps global order; routed from the compiler README's question table and scoped-plan catalog. MASTER_AUDIT/COMPILER_AUDIT deliberately untouched: nothing is built yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Assessment of FORGE (arXiv:2606.22932v2, dk4248/FORGE) — fusing the optimizer step into the weight-gradient GEMM epilogue at tile granularity, so
grad_Wnever reaches HBM — and the generalization it opens for Tessera:FORGE is one instance (optimizer ← weight-gradient GEMM). Eight workstreams W1–W8 generalize it to N consumers × M producers with declared legality, arbiter admission, and a compiler that reports when the win isn't there.
Files
docs/audit/compiler/FORGE_ASSESSMENT.mdaudit_role: plan,plan_state: open, 371 linestests/unit/test_fused_wgrad_optimizer_contract.pydocs/audit/compiler/README.mdMath verified, not asserted
Nine propositions are stated in the plan and shipped as an executable contract, so W3/W4 inherit a gate rather than an argument. Identifiers match §2 of the doc.
single-use ∧ consumer-is-optimizerguard subsumes FORGE Rem. 2 (tied weights) structurally: a tied weight's%g1is consumed by anadd, so the match cannot fire. Because our optimizer ops are value-semantic andPure, FORGE's in-place ΔX-before-update hazard — which its repo guards with a comment and a correctness script — cannot occur at Graph IR.m_t(c) − c·m_t(1) = (1−c)β₁m_{t−1}needs an O(P) tensor). Both candidate approximations fail:clip-the-updateanddelayed-normeach leave √v̄ inflated 3.18× ten steps after a spike — identical to no clipping at all.grad_clip_scopemust fail closed (Decision #21a). FORGE ships with clipping switched off and says so only in two appendix protocol lines.βbreaks conditionally-routed weights: 2.24× error at 50% routing. A verifier condition, giventessera.moe_swiglu_block.numeric_policyquestion — the measured motivation for the Decision docs: scope GPU-resident activations / persistent device-handle model #32 carrier work.What's already in tree and easy to miss
LinearTransposeInterface, notAdjointInterface—MatmulOpdoesn't implement the latter, so grepping only for adjoints yields a false "no compiled matmul VJP" conclusion.MatmulOp::buildLinearTransposeemitsdRhs = matmul(lhs, dy, transposeA=true); fixtureautodiff_paired_matmul.mlir.TrainingStepFusionPassalready implements the identical pattern one level down (loss_backward → adamw), with a negative fixture and aLOWER-COUNT-1: linalg.genericcheck that proves non-materialization in the IR rather than by peak-memory measurement. That makes this track gateable on any host — no 8B model or 141 GB card needed.MatmulOp::getLoopIteratorTypes()→{parallel, parallel}with K kept whole, stampedtessera.full_k— that is FORGE Prop. 1's legality condition, currently with no consumer (a live Decision Apple GPU MLA: native f16/bf16 for the absorbed decode kernel #29 gap this closes).MatmulLoweringalready does "bf16 accumulate in f32 thentruncf" — thattruncfis exactly the rounding FORGE deletes, testable on CPU.Claim hygiene on the source
The public repo ships AdamW and SGD only — no
torch.distributed, noall_reduce, no bucket coordinator, and none of Muon/LAMB/Lion/Adafactor/SM3. §4 and Appendices I, K–N are not reproducible from the release. Recorded in §0; the single-GPU mechanism is an evidence row, the distributed and multi-optimizer results are not.Scope
Direction only (Decision #26).
INTEGRATED_COMPILER_PLAN.mdkeeps global order.MASTER_AUDIT.md/COMPILER_AUDIT.mddeliberately untouched — nothing is built yet, so the all-up picture hasn't shifted.Verification
test_audit_docs.py— caught two real routing obligations on first run; both fixed. 11 pass.check_generated_docs.sh— 25 generated docs in sync (also passed the pre-push hook).ruffclean.37 failed, 1212 passed→37 failed, 1226 passed— exactly the +14 new tests, same pre-existing failures (they need a builttessera-opt/ fresh Apple dylib, absent on this Mac).🤖 Generated with Claude Code