Skip to content

[Repo] Remove TOGSim/ and configs/: they are the TOGSim repository now - #349

Merged
YWHyuk merged 9 commits into
pytorchsim-triton-backendfrom
togsim-remove
Oct 13, 2026
Merged

YWHyuk merged 9 commits into
pytorchsim-triton-backendfrom
togsim-remove

Conversation

@YWHyuk

@YWHyuk YWHyuk commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

About PyTorchSim #346. #346 ("A load of what a buffer already holds is not read again") changed the in-tree TOGSim/ after TOGSim became its own repository, and the TOGSim repository does not carry it yet (PSAL-POSTECH/TOGSim#22). From this change on PyTorchSim runs the TOGSim the compiler pins, so that behaviour is absent until TOGSim carries it and the pin moves.

Branch togsim-remove (9 commits) -> togsim-dir (stacked, head 5ab54226, itself on pytorchsim-triton-backend at aaa3ee84). Head d293e1b7.

Do not merge before #346's TOGSim change is in PSAL-POSTECH/TOGSim (see "#346"): this PR deletes its only copy on this branch line.

What this is

Stacked on the TOGSIM_DIR / TOG names PR. After that PR nothing reads the copy of TOGSim in this tree: TOGSIM_DIR defaults to the compiler's third_party/TOGSim with no fallback, and the in-tree copy is ABI 15 while the frontend speaks ABI 16. This PR deletes the copy, the machine configs beside it, and everything that existed only to build or find them. It changes no name and no behaviour of the timing path.

PSAL-POSTECH/TOGSim holds both, with one exception. Its history carries TOGSim/ as it stood here at 7b61c1d2 (tree ee50e4a5, its commit 42e39ee), then 13540211 as its commit b190fc1 (tree 5e4ad4c5). It imported configs/ as one snapshot (tree 76a8bbe9, its commit cb457fb, the tree deleted here).

#346

The TOGSim/ tree this PR deletes is 4c5d50d9: 5e4ad4c5 plus ee5f8a48 (#346, "A load of what a buffer already holds is not read again"; include/Instruction.h, src/Core.cc, src/togsim_trace_bridge.cc), merged here after the split. TOGSim does not have that change at 83f43c8 (v1.3.0): nothing under its src/ or include/ contains tag_scope, wait_scope or struct Resident. The patch conflicts in Core.cc and togsim_trace_bridge.cc against both v1.2.0 and v1.3.0, so it needs a port, not a cherry-pick. This PR does not port it. The removal commit's message says the same.

Order

  1. togsim-dir merges into pytorchsim-triton-backend.
  2. This PR's base is changed to pytorchsim-triton-backend, which is also what lets CI run on it.
  3. [TOGSim] A load of what a buffer already holds is not read again #346's change is in TOGSim and the compiler pin has moved to a commit that carries it, or the loss is accepted.
  4. This PR merges.

docker-image.yml only runs for PRs against master, develop and pytorchsim-triton-backend, so no CI runs while this PR is stacked.

Removed

  • TOGSim/ (80 files) and configs/ (56 files).
  • .gitmodules. Its two entries were TOGSim/extern/booksim and TOGSim/extern/ramulator2, so this repository has no submodule left. The six submodules: recursive keys in the workflows go with it.
  • The TOGSim/build/ line of .gitignore and of the two dockerignore files.
  • docker/Dockerfile: the conan, cmake and make step for TOGSim, and rm -rf /workspace/PyTorchSim. The compiler image has not laid a PyTorchSim checkout there since it took PyTorchSim as a submodule.
  • docker/Dockerfile.base: libboost-all-dev (with it the file's only apt-get, and the DEBIAN_FRONTEND line the base image sets anyway) and conan==1.56.0.
  • scripts/setup_worktree.sh: the block that symlinked a Simulator into each new worktree.
  • tests/models/MobileNet/test_mobilenet.py, tests/models/Yolov5/test_yolov5.py: a config argument and its default path, which neither function body read.

Kept, and why

  • cmake==3.26.4 in docker/Dockerfile.base. device/setup.py runs cmake to build torch_openreg, so it is not TOGSim's alone. The compiler image already has that version, so the line installs nothing; it can go if relying on the base image is preferred.

Repointed

Sixteen files named $TORCHSIM_DIR/configs/<name>.yml: the eight experiments, tests/system/test_scheduler.py, scripts/ci/triton_route_sweep.py and six artifact shell scripts. They take the directory from pytorchsim.config.CONFIG_TOGSIM_CONFIG_DIR. The shell scripts ask the same module with python3 -c rather than derive the default a second time in bash. File names are unchanged, and every config this repository names exists in TOGSim's configs/.

experiments/tpu_validation/configs/tpuv6e_nocache.yml (added by #345) named $TORCHSIM_DIR/configs/ramulator2_configs/HBM3_TPUv6e.yaml; it names $TOGSIM_DIR/configs/... and run.py expands it with config.CONFIG_TOGSIM_DIR. Any other open PR that names $TORCHSIM_DIR/configs or TOGSim/ needs the same treatment.

The README, docs/worktrees.md and .claude/CLAUDE.md say where TOGSim and its configs are, and how to run a TOGSim under development: its own checkout, named by TOGSIM_DIR.

Behaviour to know about

  • docker/Dockerfile.base changes, so the base image tag changes and CI rebuilds it once more (the pin in the first PR rebuilds it once before that). The tag at this head is third_party-447a8350e8ea; neither it nor the first PR's third_party-6a7b2e2e905c is in the registry yet.
  • The fallback this PR used to remove is not in the first PR any more, so pytorchsim/config.py is not touched here.

Verified locally, at head d293e1b7

Same setup as the first PR: the published image of the pin (688388c7, TOGSim v1.2.0 built in it), this branch mounted as TORCHSIM_DIR, TORCHSIM_TRITON_CODEGEN=1; "v1.3.0" is the same image with TOGSIM_DIR naming a TOGSim v1.3.0 checkout built in it.

  • Rebase. Onto the new togsim-dir with one conflict: the removal commit deletes three files that [TOGSim] A load of what a buffer already holds is not read again #346 modified (modify/delete); resolved by deleting them, and the commit message now says what that loses and names TOGSim's commits as they are after its history was rewritten. The nine commits were then moved onto togsim-dir at 5ab54226 unchanged (git range-diff marks all nine =). The tree at the head differs from the branch as first cut (db243e8a) in the pin line and in what togsim-dir gained since (its commits 16-17: a Simulator that exits non-zero is a RuntimeError).
  • TOGSim/ and configs/ do not exist at the head and the tree has no gitlink.
  • git grep for the old paths ($TORCHSIM_DIR/configs, $TORCHSIM_DIR/TOGSim, PyTorchSim/(TOGSim|configs), TOGSim/(src|include|extern|build), TORCHSIM_COMPILE_TOGSIM_DIR) finds two lines, both in .claude/CLAUDE.md and both describing the new location (third_party/TOGSim/build/bin/Simulator). Two comments still name TOGSim's files without being paths in this tree: experiments/artifact/speedup/run_speedup.sh:46 ("Current TOGSim/main.cc") and experiments/tpu_validation/configs/tpuv6e_nocache.yml:2 ("TOGSim's configs/...").
  • git grep -n -i 'trace producer\|trace_so\|trace\.so\|trace_abi' finds three lines: the old names _STALE_PATTERNS still clears (codecache.py:39) and the --trace_so that util_viewer.py still accepts from old logs (lines 9 and 25).
  • The 12 config file names this repository names all exist in TOGSim's configs/ at v1.2.0 and at v1.3.0.
  • tests/ops/elementwise/test_add.py, timing on (tpuv6e): five of five passed on v1.2.0 and on v1.3.0; totals 81, 326, 5889, 639866, 5642 on both, the same as on togsim-dir. No refusal, no TOGSim warning.
  • experiments/gemm.py, timing on (tpuv6e), a session plus autotune, its config found through CONFIG_TOGSIM_CONFIG_DIR: finished on v1.2.0 and on v1.3.0, 1799 cycles on both, the same as on togsim-dir. The typed-grouping deprecation warning appears once per Simulator process, twice in the run (the autotune candidate and the session).
  • tests/system/test_togsim_result.py and tests/system/test_togsim_exit.py: PASS.
  • A kernel v1.3.0 refuses (TOGSim's own spad_capacity/refused.one_byte_over TOG, not a compiler-emitted kernel), as on togsim-dir: run_standalone in autotune mode raises a RuntimeError that autotune's except catches, python3 -m pytorchsim.simulator.togsim exits 1, and a torch.npu.simulator block that launches it raises.
  • The 24 changed Python files parse, the 9 changed shell scripts pass bash -n, the five workflows load as YAML.

Verified on this branch as first cut and not repeated at this head:

  • A second run on the same dump path (no rebuild) and a run on a dump path written by the old names (five kernels rebuilt).
  • experiments/tpu_validation run.build_config expanding the DRAM path and TOGSim loading the result.
  • device/ building with python3 setup.py build_ext --inplace in a compiler image that has no libboost-all-dev.
  • Both Dockerfiles under docker buildx build --check.

Not verified

  • The base and app image builds and CI on a runner. The gate runs with TORCHSIM_TIMING_MODE=0 and does not start TOGSim.
  • The allowlist, and the other two CI machines (32x32, 8x8).
  • run_cycle.sh, run_speedup.sh, the ILS scripts, test_scheduler.py, test_mobilenet.py and test_yolov5.py were not run.
  • A kernel this compiler emitted being refused by v1.3.0 (see the first PR's "Not verified").

Both tests built a default TOGSIM_CONFIG path under $TORCHSIM_DIR/configs and
passed it to a function whose body has no use of the name (checked on the AST:
no load of `config` in either body, one call site each). The machine these
tests run on is TOGSIM_CONFIG, or config.py's default, as before. The
argument and the path go.
… in config.CONFIG_TOGSIM_CONFIG_DIR

Sixteen files spelled $TORCHSIM_DIR/configs/<name>.yml for a default machine:
the eight experiments, tests/system/test_scheduler.py, the route sweep, and
six artifact shell scripts. The directory is moving to the TOGSim repository,
so each now takes it from the one place that knows where TOGSim is. The
Python files import CONFIG_TOGSIM_CONFIG_DIR; the shell scripts ask the same
module (`python3 -c` from $TORCHSIM_DIR) rather than derive the default a
second time in bash. The file names are unchanged, and all nine that are
named exist in TOGSim's configs/ at 5926a38.

CONFIG_TOGSIM_CONFIG_DIR is $TOGSIM_DIR/configs, so with this commit these
sixteen stop reading the configs/ still in this tree.

Checked: every edited .py parses, every edited .sh passes bash -n, and the
shell line prints TOGSim's configs/ with TOGSIM_DIR set to a TOGSim checkout.
No experiment or test was run.
…fig from the TOGSim checkout

setup_worktree.sh symlinked TOGSim/build/bin/Simulator from the worktree it
was run in, so each worktree had a Simulator without a ten-minute build. The
Simulator is one build in the compiler checkout now, the same for every
worktree, so the block and its message go.

The .envrc it writes named $_self/configs/..._tpuv6e.yml; it asks
pytorchsim/config.py for the config directory instead, and its MISSING
message names the TOGSim checkout rather than the worktree's branch.

Checked with bash -n, and by sourcing the generated .envrc with TOGSIM_DIR at
a TOGSim checkout: TOGSIM_CONFIG is that checkout's v6e file and exists.
…carries one

docker/Dockerfile ran conan, cmake and make in PyTorchSim/TOGSim on every
build. The Simulator the tests start is the compiler's
third_party/TOGSim/build/bin/Simulator, built once in the compiler's toolchain
image, so the step goes.

`rm -rf /workspace/PyTorchSim` goes with it. It cleared the PyTorchSim checkout
the compiler image used to lay under /workspace for its own TOGSim; the
compiler's image has had no such directory since it took PyTorchSim as a
submodule (checked in ghcr.io/psal-postech/pytorchsim-triton-backend:670ae217,
where /workspace holds no PyTorchSim), and an image that carries
third_party/TOGSim is later than that.

Not built: it needs a base on a compiler image that carries TOGSim.
…ly the TOGSim build used them

Dockerfile.base added three things for the TOGSim build that ran in the app
image, and that build is gone.

libboost-all-dev, "boost headers for TOGSim's cmake probe": nothing outside
TOGSim/ names boost, and TOGSim itself takes boost from conan (its
find_package(Boost) is commented out; the compiler's image builds the same
TOGSim without the package). With it goes the only apt-get of the file, and
the DEBIAN_FRONTEND line that was there for apt, which the compiler image
sets anyway.

conan 1.56.0: TOGSim's conanfile was its one user.

cmake 3.26.4 stays. device/setup.py runs cmake to build torch_openreg, so it
is this repository's own requirement; the compiler image already has that
version, so the line installs nothing.

Checked: device/ at this commit configured and built with
`python3 setup.py build_ext --inplace` in
ghcr.io/psal-postech/pytorchsim-triton-backend:670ae217, which has no
libboost-all-dev (torch 2.10 there, not the 2.14 this file installs). The
base image itself was not built. The tag of the base image changes with this
file, so CI rebuilds it once.
PSAL-POSTECH/TOGSim holds both, with one exception named below. Its history
carries TOGSim/ as it stood here at 7b61c1d (tree ee50e4a at its commit
42e39ee), then 1354021 as its commit b190fc1 (tree 5e4ad4c); that
repository's src/ and include/ differ from it only by what it changed
afterwards. It imported configs/ as one snapshot (tree 76a8bbe at its commit
cb457fb, the tree deleted here). The compiler pins that repository as
third_party/TOGSim and this repository reaches it through the compiler:
PyTorchSim -> PyTorchSim-Triton-Backend -> TOGSim, one line, where the two
repositories used to pin each other.

The exception: the TOGSim/ tree this commit deletes is 4c5d50d, which is
5e4ad4c plus ee5f8a4 (#346, a load of what a buffer already holds is not
read again; Instruction.h, Core.cc, togsim_trace_bridge.cc). TOGSim does not
hold that change at 83f43c8 (v1.3.0). It has to be carried there, and the
compiler pin moved to a commit that carries it, or this commit deletes its
only copy on this branch line.

Removed: TOGSim/ (80 files), configs/ (56 files), .gitmodules (its two
entries were TOGSim/extern/booksim and TOGSim/extern/ramulator2, so this
repository has no submodule left), and the TOGSim/build/ line of .gitignore
and of the two dockerignore files.

The compiler pin must be one that carries third_party/TOGSim before this
lands; third_party/pytorchsim-triton-backend.json is not moved here.
Six actions/checkout steps (two each in docker-image.yml,
pytorchsim_triton_backend.yml and tag_release.yml) said `submodules:
recursive` for TOGSim/extern/booksim and TOGSim/extern/ramulator2. .gitmodules
is gone with them, so the key fetched nothing.

Checked: the three files load as YAML and each checkout step keeps its ref and
persist-credentials. Not run on a runner.
…GSim and its configs are

Each named TOGSim/ or configs/ as a directory of this repository. The README's
configuration section points at the TOGSim repository and $TOGSIM_DIR/configs
(and no longer at pytorchsim/extension_config.py, which has been config.py
for some time). docs/worktrees.md loses the section on the symlinked binary
and says how a modified TOGSim is run instead: its own checkout, named by
TOGSIM_DIR. .claude/CLAUDE.md's layout table, environment table, build notes
and "where to look" list follow, and its line of conan packages goes, since
that list is TOGSim's conanfile and was already one package out of date.
…eckout

configs/tpuv6e_nocache.yml named $TORCHSIM_DIR/configs/ramulator2_configs/
HBM3_TPUv6e.yaml, a directory this repository no longer has. The line names
$TOGSIM_DIR/configs/... and run.py expands it with config.CONFIG_TOGSIM_DIR,
so it resolves whether TOGSIM_DIR is set or the compiler's third_party/TOGSim
is used.
@YWHyuk
YWHyuk changed the base branch from togsim-dir to pytorchsim-triton-backend October 13, 2026 05:11
@YWHyuk
YWHyuk marked this pull request as ready for review October 13, 2026 05:11
@YWHyuk
YWHyuk merged commit 916c756 into pytorchsim-triton-backend Oct 13, 2026
YWHyuk added a commit that referenced this pull request Oct 13, 2026
The in-tree simulator and its machine configs are removed. Both come from the
TOGSim checkout the compiler carries (TOGSIM_DIR).

- A config named by a test, an experiment or the sweep is found in
  config.CONFIG_TOGSIM_CONFIG_DIR; run_mobilenet and run_yolo no longer take a
  config they never read; tpu_validation reads its DRAM config from the TOGSim
  checkout.
- A new worktree links no TOGSim binary and reads its v6e config from the
  TOGSim checkout.
- The app image builds no TOGSim: the compiler image it stands on carries one.
  The base image installs neither libboost-all-dev nor conan, which only the
  TOGSim build used. The checkouts ask for no submodules: this repository has
  none.
- The README, the worktree notes and the repo guide say where TOGSim and its
  configs are.

This removes the in-tree copy of PyTorchSim #346 as well; see the pin commit.

PyTorchSim #349.
@YWHyuk
YWHyuk deleted the togsim-remove branch October 23, 2026 03:03
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