Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194873
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 64f85c6 with merge base 96043a9 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
AI-Review
No verified issues found. |
karthickai
left a comment
There was a problem hiding this comment.
could you add test coverage for this PR? also my agent found three blocking issues and it looks legitimate and also repro in my local machine.
The explicit reduction check validates the index strides but not its constant offset. Since
stride_vars()drops that offset, an index such as... + 1can be mistaken for an unshifted reduction, causing the generated kernel to reduce the wrong elements. Could we validate the complete affine index or reject non-zero offsets?
source_from_expression()creates a unarysource(value)callback, but the accepted expression can contain differently indexed GEMM loads. Becauselower()discards the load index, an expression such asa * bbecomesvalue * value. Could we require all loads to reference the same logical lane or reject the fusion?
_output_scale_name()stripsto_dtypeoperations even when the cast changes the value. For example,alpha=1.75andalpha.to(int32)=1are not equivalent, but the later native output-scale path receives raw1.75. Could we only allow direct scalar loads or proven no-op conversions?
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 jobs have failed, first few of them are: torchtitan-test / torchtitan-x-pytorch-test / test (torchtitan_models_integration, 1, 1, mt-l-x86aavx2-189-704-a10g-8) Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge -f "unrelated failures" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…h#194873) <human note needed> > Introduce the semantic lowering and CuTeDSL emission layer for scheduler-owned > GEMM epilogues. A candidate sequence of scheduler nodes is captured as Loop IR, > classified from iteration ranges and access strides, and represented as one > `NVGemmEpilogueProgram` containing pointwise work, grouped reduction regions, > output ownership, and any callbacks required by the kernel. > > ## Architecture > > `NVGemmEpilogueCapture` interprets the candidate nodes without selecting a > named reduction algorithm. `reduction_type` identifies only the associative > primitive; the captured expressions define source transforms, finalizers, > consumers, and compositions of multiple reductions with pointwise operations. > > `LoopIRCuteDSLCodegen` replays those expressions through the shared CuTeDSL > operation overrides. Fragment-local reductions remain in the generated tensor > epilogue. When a reduction crosses fragments or threads, the generated plan > supplies combine and finalize callbacks while the vendored kernel owns > traversal, synchronization, and storage. > > `NVGemmEpilogueProgram` is the validation boundary used by scheduling. It > records which nodes belong to reduction regions, which outputs remain visible, > whether a reduction feeds the main GEMM output, and whether every reduction in > the candidate prefix has a supported lowering. > > ## Examples > > A pointwise epilogue becomes one generated callback: > > ```python > result = a @ b > return torch.relu(result.float() + bias) > ``` > > Multiple reductions and pointwise consumers remain one semantic program: > > ```python > result = a @ b > grouped = result.float().view(m, n // 4, 4) > scale = grouped.sum(-1) + grouped.amax(-1) > return (grouped / scale.unsqueeze(-1)).reshape(m, n), scale > ``` > > The second example is represented as an N-axis reduction with group size four. > The generated epilogue computes both primitive reductions and the division; a > larger or cross-thread geometry additionally receives generated physical > reduction callbacks. > > ## Test Plan > > ```bash > spin lint torch/_inductor/codegen/nv_universal_gemm/epilogue_lowering.py torch/_inductor/kernel/loop_ir_cutedsl_codegen.py > lintrunner -a > python -m py_compile torch/_inductor/codegen/nv_universal_gemm/epilogue_lowering.py torch/_inductor/kernel/loop_ir_cutedsl_codegen.py > ``` > > Description drafted with an AI assistant. Pull Request resolved: pytorch#194873 Approved by: https://github.com/drisspg ghstack dependencies: pytorch#194792, pytorch#194793, pytorch#190821, pytorch#195231
…h#194873) <human note needed> > Introduce the semantic lowering and CuTeDSL emission layer for scheduler-owned > GEMM epilogues. A candidate sequence of scheduler nodes is captured as Loop IR, > classified from iteration ranges and access strides, and represented as one > `NVGemmEpilogueProgram` containing pointwise work, grouped reduction regions, > output ownership, and any callbacks required by the kernel. > > ## Architecture > > `NVGemmEpilogueCapture` interprets the candidate nodes without selecting a > named reduction algorithm. `reduction_type` identifies only the associative > primitive; the captured expressions define source transforms, finalizers, > consumers, and compositions of multiple reductions with pointwise operations. > > `LoopIRCuteDSLCodegen` replays those expressions through the shared CuTeDSL > operation overrides. Fragment-local reductions remain in the generated tensor > epilogue. When a reduction crosses fragments or threads, the generated plan > supplies combine and finalize callbacks while the vendored kernel owns > traversal, synchronization, and storage. > > `NVGemmEpilogueProgram` is the validation boundary used by scheduling. It > records which nodes belong to reduction regions, which outputs remain visible, > whether a reduction feeds the main GEMM output, and whether every reduction in > the candidate prefix has a supported lowering. > > ## Examples > > A pointwise epilogue becomes one generated callback: > > ```python > result = a @ b > return torch.relu(result.float() + bias) > ``` > > Multiple reductions and pointwise consumers remain one semantic program: > > ```python > result = a @ b > grouped = result.float().view(m, n // 4, 4) > scale = grouped.sum(-1) + grouped.amax(-1) > return (grouped / scale.unsqueeze(-1)).reshape(m, n), scale > ``` > > The second example is represented as an N-axis reduction with group size four. > The generated epilogue computes both primitive reductions and the division; a > larger or cross-thread geometry additionally receives generated physical > reduction callbacks. > > ## Test Plan > > ```bash > spin lint torch/_inductor/codegen/nv_universal_gemm/epilogue_lowering.py torch/_inductor/kernel/loop_ir_cutedsl_codegen.py > lintrunner -a > python -m py_compile torch/_inductor/codegen/nv_universal_gemm/epilogue_lowering.py torch/_inductor/kernel/loop_ir_cutedsl_codegen.py > ``` > > Description drafted with an AI assistant. Pull Request resolved: pytorch#194873 Approved by: https://github.com/drisspg ghstack dependencies: pytorch#194792, pytorch#194793, pytorch#190821, pytorch#195231
Stack from ghstack (oldest at bottom):
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo