Skip to content

[Frontend] PyTorchSimFrontend, PyTorchSimCodegen and Simulator: one package per layer - #326

Merged
student-Jungmin merged 1 commit into
pytorchsim-triton-backendfrom
split-codegen-simulator
Oct 9, 2026
Merged

student-Jungmin merged 1 commit into
pytorchsim-triton-backendfrom
split-codegen-simulator

Conversation

@student-Jungmin

Copy link
Copy Markdown
Collaborator

Splits PyTorchSimFrontend/triton_backend/ (22 modules) by role. The name only distinguished it from the MLIR route, which is gone, and it held both the codegen route and the devices that run its kernels.

PyTorchSimFrontend/   the graph side: extension_config, rewrite_fx_graph, extension_functional_verify
PyTorchSimCodegen/    Inductor's Triton codegen for npu (scheduling, wrapper_codegen, inductor_templates,
                      hardware), kernel spec and source fixups, and the bridge that runs
                      PyTorchSim-Triton-Backend and caches its kernel objects (compiler_bridge, codecache)
Simulator/            what runs a kernel object: Spike (functional, spike_run), gem5 (gem5, trace_build),
                      TOGSim (timing, beside simulator.py), session, breakdown

Dependencies run Frontend -> Codegen -> Simulator; Simulator still reads the kernel object through Codegen's compiler_bridge, launch and layout. Code is unchanged beyond imports, the generated wrapper's logger name and the spec header's path. References in torch_openreg, tests, scripts, workflows, Dockerfile.base comment, docs/worktrees.md and CLAUDE.md follow; README is untouched.

Verified (cleared cache, PTB main a65cc41, ABI 15)

  • functional: test_add, test_matmul, test_gqa, test_complex_to_real, test_topk, test_eager, test_patch_scope pass
  • timing: test_add and test_matmul_vector pass with the same cycles as before the move (100/336/6056/637233/5475, 1559/1570)

…ackage per layer

PyTorchSimFrontend/triton_backend/ held the whole codegen route and the
devices that run its kernels, under a name that only distinguished it from
the MLIR route, which is gone. Its 22 modules move by role:

  PyTorchSimCodegen/  Inductor's Triton codegen for npu, the kernel spec and
                      source fixups, and the bridge that runs
                      PyTorchSim-Triton-Backend and caches its kernel objects
  Simulator/          what runs a kernel object: Spike (functional,
                      spike_run), gem5 (gem5, trace_build), TOGSim (timing,
                      beside simulator.py), and session/breakdown

PyTorchSimFrontend keeps the graph side: extension_config and
rewrite_fx_graph. Dependencies run Frontend -> Codegen -> Simulator; the
Simulator modules still read the kernel object through Codegen's
compiler_bridge, launch and layout. No module's code changes beyond its
imports, the generated wrapper's logger name and the spec header's path.

Verified on a cleared cache: test_add, test_matmul, test_gqa,
test_complex_to_real, test_topk, test_eager, test_patch_scope pass; in
timing mode test_add and test_matmul_vector pass with the same cycles as
before the move (100/336/6056/637233/5475, 1559/1570).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant