Skip to content

[Cleanup] Delete dead code, unused deps and retired-config paths (item 12) - #432

Merged
YWHyuk merged 6 commits into
pytorchsim-triton-backendfrom
item12/dead-code
Oct 23, 2026
Merged

YWHyuk merged 6 commits into
pytorchsim-triton-backendfrom
item12/dead-code

Conversation

@YWHyuk

@YWHyuk YWHyuk commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #429

Why

Item 12 of the cleanup list: code, files and dependencies that nothing calls or builds anymore, plus artifact/worktree scripts that still named retired configs or the non-existent develop branch. #241 (its predecessor list) was closed separately: PyTorchSimFrontend/ was deleted by 2de193f and a440dfd, extension_config.py became config.py (8c6cd16), and git grep finds 0 hits for every name it listed.

What changed (before -> after)

sha change
8f4acb9 Deleted code with no caller: scripts/trace_timeline.py _lane() and _LANE; togsim.py get_core_freq (load_yaml stays, __init__ uses it at togsim.py:77); compiler_bridge.doctor() (CI and the Dockerfile call the compiler's own doctor CLI); wallclock.GEM5_SAMPLE / GEM5_BUILD (GEM5_RUN stays); the trace.so / trace_*.tsv patterns in codecache._STALE_PATTERNS
a311d75 Deleted tests/models/MoE/test_moe_cpu.py
3279053 Deleted openreg example/, cmake/GTestTargets.cmake and the unused LIBRARY_TEST ortests; README trimmed to match
7022cd8 Dropped onnx, pydot and tabulate from docker/Dockerfile.base:25 (no imports in PTS or PTB main)
55ab93d run_cycle.sh sets TORCHSIM_TARGET=tpuv3 + TORCHSIM_FUNCTIONAL_MODE=0 (was the retired ..._tpuv3_timing_only.yml TOGSIM_CONFIG); run_speedup.sh / run_speed_ils_*.sh stop up front when their machine file is missing (pointing to v1.0.0) instead of printing NA and exiting 0; ILS scripts use TORCHSIM_TARGET; deleted ils_parser.sh; added tests/system/test_artifact_scripts.py (refs #415)
752e9a2 setup_worktree.sh (default + examples) and docs/worktrees.md default to origin/pytorchsim-triton-backend; added tests/system/test_setup_worktree.py

Tests (before / after)

Run in a container from topk-ptb:pts-base-92028c8; new tests from HEAD against git archive copies of each parent.

  • test_setup_worktree.py on parent 55ab93d: FAIL fatal: couldn't find remote ref develop (rc 128) -> PASS
  • test_artifact_scripts.py on parent 7022cd8: cycle test FAIL NoTarget: TOGSIM_CONFIG=...systolic_ws_128x128_c1_simple_noc_tpuv3_timing_only.yml is retired; ILS test FAIL assert proc.returncode != 0 (script exited 0) -> PASS
  • pytest tests/system/test_artifact_scripts.py tests/system/test_setup_worktree.py tests/system/test_cache_identity.py tests/system/test_togsim_exit.py: 10 passed

Verification

  • Clean pip install --no-build-isolation -e device builds libopenreg.so, libtorch_bindings.so, libtorch_openreg.so.
  • tests/ops/elementwise/test_add.py: 5/5 functional and 5/5 with TORCHSIM_TIMING_MODE=1, with onnx/pydot/tabulate uninstalled.
  • Refactor parts unchanged: parent vs new trace_timeline.py give byte-identical JSON on 10 TOGSim trace logs; TORCHSIM_BREAKDOWN table rows identical.
  • git grep at HEAD returns 0 hits for get_core_freq, _lane(, _LANE, GEM5_SAMPLE, GEM5_BUILD, trace.so, test_moe_cpu, ils_parser, GTestTargets, ortests, pydot, tabulate. Remaining doctor/onnx hits are the compiler CLI and file names.
  • Independent review re-ran all of the above: ACCEPT.

Stacking / dependencies

Based on origin/pytorchsim-triton-backend 069878a; #421 and #423 are already in the base, so nothing is stacked. The base has since moved one commit (5fb15ee, pin bump only in third_party/pytorchsim-triton-backend.json, no overlap). PTB pin unchanged (1b35878).

Open issues

  • Cycle validation still cannot run on this branch: the PTB compiler only knows vcix_tpuv6e (pytorchsim_triton_compiler/contract/target.py:37, at 1b35878 / 30fbce3 / main) and the image builds only libtpuv6e.so, so run_cycle.sh stops with vcix_tpuv3 is no array unit TOGSim knows. Until PTB supports tpuv3 the script runs only on v1.0.0; its comment says so.
  • TORCHSIM_FUNCTIONAL_MODE=0 in run_cycle.sh:65 mirrors the retired timing_only config but is not pinned by a test.
  • run_cycle.sh:59-63 comment block is 5 lines.
  • CycleSimulator was on the delete list but timing.py:48 calls it, so it stays.
  • .github/CONTRIBUTING.md:27 and .claude/CLAUDE.md:220 still say PRs go against develop (out of scope).
  • The two new tests are not in any CI list ([CI] An allowlisted route test that regresses fails the route job #421 keeps the allowlist to kernel-emitting tests).
  • Docker image not rebuilt; the package drop was checked by uninstalling the three packages in the existing image.
  • TOGSimProcess.config_yaml is assigned in __init__ and never read.
  • Whether FIXME artifact scripts export TOGSIM_CONFIG and name configs that are not shipped #415 can close now was not checked.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UnJWSTNtd6944XAzy4bhk5

@YWHyuk YWHyuk self-assigned this Oct 23, 2026
git grep over the tree (workflows, docs and string imports included) finds no
caller for any of these:

  scripts/trace_timeline.py   _lane() and the _LANE table only it read
  simulator/togsim.py         TOGSimProcess.get_core_freq. load_yaml stays: __init__
                              validates the machine file with it (togsim.py:77)
  driver/compiler_bridge.py   doctor(). CI and Dockerfile.base run the compiler's own
                              `pytorchsim-triton-compiler doctor`, not this wrapper
  simulator/wallclock.py      GEM5_SAMPLE, GEM5_BUILD: no span() records them, and
                              the report prints only components that were recorded
  driver/codecache.py         the trace.so / trace_cycles.tsv / trace_units.tsv stale
                              patterns: nothing reads those names since TOGSim ABI 16
                              (the artifact is tog_so)

timing.py's CycleSimulator was on the list and stays: run_cycle_binary calls it.

Outputs are unchanged: trace_timeline.py of the parent and of this commit write
byte-identical JSON for all ten TOGSim trace logs of two test_add timing runs, and
the TORCHSIM_BREAKDOWN table of test_add lists the same rows. test_add (functional
and timing), test_cache_identity and test_togsim_exit pass.

Refs #429
It builds the MoE layer on cpu or cuda and asserts nothing; no workflow, allowlist
or doc names it. tests/models/MoE/test_moe.py is the npu test of the same layer.

Refs #429
example/example.cpp and cmake/GTestTargets.cmake are not reached from
device/third_party/openreg/CMakeLists.txt, which also set LIBRARY_TEST ortests and
never used it. The README's directory tree and its example section go with them
(its tests/ entries named files that were never vendored).

`pip install --no-build-isolation -e device` from a clean tree builds libopenreg.so,
libtorch_bindings.so and libtorch_openreg.so as before, and test_add passes on it.

Refs #429
Nothing in this repository or in PyTorchSim-Triton-Backend's main imports them
(git grep for import, import_module and __import__, plus torch.onnx, print_tabular
and FxGraphDrawer, which would pull them in through torch). The tile_graph.onnx
paths in select.py, timing.py and test_togsim_exit.py are file names, not ONNX.

With the three uninstalled from the base image, test_add (functional and timing),
test_cache_identity and test_togsim_exit pass.

Refs #429
…M_TARGET

They exported TOGSIM_CONFIG, which compiler_bridge.target() refuses at import
torch, and named configs TOGSim's configs/ no longer ships (#415).

  run_cycle.sh       TORCHSIM_TARGET=tpuv3 (the shipped machine with the retired
                     c1 simple-NoC tpuv3 config's shape), functional mode off as the
                     timing_only config had it. The compiler at the pin refuses
                     tpuv3 (contract/target.py TOGSIM_UNITS knows only vcix_tpuv6e),
                     so the first workload stops on that NoTarget; the comment says
                     the paper's numbers are reproduced on the v1.0.0 image
  run_speedup.sh,    the 2-core and ILS machines they name have no shipped file.
  run_speed_ils_*    They now stop before running anything when the file is not
                     there, naming the v1.0.0 image, instead of reporting
                     simulation_time = NA five times per shape and exiting 0; the
                     ILS scripts hand the machine over as TORCHSIM_TARGET
  ils_parser.sh      deleted: nothing calls it, and it parses `launch ...
                     tile_graph.onnx` lines no log prints any more

tests/system/test_artifact_scripts.py fails on the parent for both reasons: the
environment run_cycle.sh exports raises "TOGSIM_CONFIG=... is retired", and
run_speed_ils_matmul.sh exits 0.

Refs #429, #415
…kend by default

Its default base was origin/develop, which this repository does not have, so
`scripts/setup_worktree.sh <purpose>` stopped at "fatal: couldn't find remote ref
develop". docs/worktrees.md said the same default.

tests/system/test_setup_worktree.py runs the script in a clone whose origin has only
pytorchsim-triton-backend; on the parent it fails with that fatal.

Refs #429
@YWHyuk
YWHyuk merged commit e40eb2a into pytorchsim-triton-backend Oct 23, 2026
@YWHyuk
YWHyuk deleted the item12/dead-code branch October 26, 2026 05:43
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