Repository navigation
[Refactor 1/9] frontend/ is one package per torch.compile layer, driver/ is backend/, rewrite_fx_graph is post_grad_pass - #449
Merged
student-Jungmin merged 1 commit intoOct 24, 2026
Conversation
student-Jungmin
force-pushed
the
refactor/r441-1-layout
branch
from
October 24, 2026 07:32
ca1ed67 to
fb09d09
Compare
student-Jungmin
force-pushed
the
refactor/r441-1-layout
branch
from
October 24, 2026 08:17
fb09d09 to
2113c7b
Compare
…is backend/, and rewrite_fx_graph is post_grad_pass Moves and renames only, no behavior change. inductor_patches.py splits by kind into frontend/inductor/ (choices, selection, npu as a Triton GPU); topk, grouped_mm and attention go to frontend/dispatcher/; each layer's install() applies what npu plugs into it. driver/ is backend/: what compiles and launches a kernel after the frontend. scripts/op_coverage.py goes, and tests/_pytorchsim_utils.py is tests/result_check.py with check_result. Comments and docstrings in the files this part changes are at most three lines, none inside a function body. What they no longer say: backend/compiler_bridge.py: run_pipeline stops at the ELF since spike and verify want tensors and a per-kernel reference this route has no graph-level answer for. This part also carries what #440 and #441 (split from #433, last as #458 and #459) did, so the refactor starts from pytorchsim-triton-backend itself: transformers' grouped_mm_fallback takes aten._grouped_mm's npu kernel (registered at AutogradPrivateUse1 and PrivateUse1 of transformers::grouped_mm_fallback; the dense rewrite goes), and rewrite_fx_graph is post_grad_pass, the npu's device_custom_pass, judging complex values per component, counting histc on the device, making its nodes through FX's tracer and keeping its complex ops in one table, _REAL_PAIR. test_grouped_mm's fallback case pins the first.
student-Jungmin
force-pushed
the
refactor/r441-1-layout
branch
from
October 24, 2026 11:15
2113c7b to
75aab75
Compare
student-Jungmin
changed the base branch from
split/433-post-grad-pass
to
pytorchsim-triton-backend
October 24, 2026 11:16
student-Jungmin
marked this pull request as ready for review
October 24, 2026 13:59
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.
Draft: waiting for verification (CI and the validation reports) before review.
Part 1 of 9 of the frontend refactor. It is one commit (fb09d09) of this part's final state, so each part reviews on its own. Based on
pytorchsim-triton-backend(dd80d8c, #443).What
This part also carries what #440 and #441 (split from #433; rebased as #458 and #459, now closed) did, so the refactor starts from
pytorchsim-triton-backenditself:grouped_mm_fallbacktakes aten._grouped_mm's npu kernel. It is registered at AutogradPrivateUse1 and PrivateUse1 oftransformers::grouped_mm_fallback, and the dense rewrite goes. This is a behavior change, pinned by test_grouped_mm's fallback case.rewrite_fx_graphispost_grad_pass, the npu'sdevice_custom_pass. It judges complex values per component, counts histc on the device, makes its nodes through FX's tracer and keeps its complex ops in one table,_REAL_PAIR.Moves and renames only, no behavior change. inductor_patches.py splits by kind into
frontend/inductor/ (choices, selection, npu as a Triton GPU); topk, grouped_mm and attention go
to frontend/dispatcher/; each layer's install() applies what npu plugs into it. driver/ is
backend/: what compiles and launches a kernel after the frontend. scripts/op_coverage.py goes,
and tests/_pytorchsim_utils.py is tests/result_check.py with check_result.
Behavior change
grouped_mm_fallback's route (above). Everything else here is a move or a rename.
Checked locally
At this PR's tip, with PTB 522042a (this branch's pin) and TOGSim b9c9519, everything passes: test_add 5/5, test_matmul 11/11, test_histc, test_eager, test_patch_scope 8/8.
No cycle numbers here: nothing in this part is meant to change a kernel's cycles. The CI validation report is the check.
Comments and docstrings in the files these parts change are at most three lines, none inside a function body. What they no longer say is in the commit message. Test files whose only change here is an import rename (test_result -> check_result) and scripts/ keep their comments, as this change did not touch that code.