Repository navigation
[Simulator] PyTorchSim runs the TOGSim the compiler carries, and speaks its TOG names (ABI 16) - #348
Merged
Merged
Conversation
…r carries TOGSim is becoming its own repository, pinned by the compiler as third_party/TOGSim, and this repository reaches it through the compiler checkout it already pins. One variable says where it is: TOGSIM_DIR is the TOGSim repository root, with the header at $TOGSIM_DIR/include and the binary at $TOGSIM_DIR/build/bin/Simulator. Unset, it is $TORCHSIM_COMPILE_DIR/third_party/TOGSim. There is no fallback to the TOGSim/ still in this tree. That copy is ABI 15 and the TOGSim the compiler carries is ABI 16, with other file names and another flag, so a frontend that could reach either would have to speak both. It speaks one: the in-tree copy is no longer read by anything, and the stacked change deletes it. config.CONFIG_TOGSIM_DIR is that root and the three places that spelled $TORCHSIM_DIR/TOGSim read it: the header directory, the Simulator path of the session and of a standalone run. config.CONFIG_TOGSIM_CONFIG_DIR is its configs/, and the default TOGSIM_CONFIG is taken from it.
…runs The compiler builds trace.so against a togsim_runtime.h it finds on its own, and this process digests a header into the cache identity and starts a Simulator; nothing made the three the same checkout. compiler_env() now sets TOGSIM_DIR to config.CONFIG_TOGSIM_DIR for every compiler subprocess, which is the variable the compiler reads once it carries TOGSim as third_party/TOGSim. A compiler from before that carries no TOGSim, and this frontend does not run with one. Not run against a compiler: none that reads TOGSIM_DIR is published yet.
…that names TOGSIM_DIR A missing togsim_runtime.h used to digest to None: the cache identity then carried "trace_abi": null and a cached trace.so was admitted whatever header it had been built against. With the header in another repository that is the likeliest way to be wrong (a submodule that was never initialised), so _trace_abi() raises FileNotFoundError naming the path and TOGSIM_DIR instead. get_togsim_command() does the same for build/bin/Simulator, which before surfaced as the subprocess's bare "No such file or directory".
… TOGSIM_DIR With no TOGSim checkout the default config path does not exist, and reading any machine value raised FileNotFoundError with the path alone. It now says which checkout TOGSIM_DIR resolved to and that TOGSIM_CONFIG may name a config file instead, as the header and Simulator errors already do.
…image carries docker-image.yml named its three TOGSIM_CONFIG files under /workspace/PyTorchSim/configs. They are the same three names under /workspace/pytorchsim-triton-compiler/third_party/TOGSim/configs now, the directory the simulator the tests start comes from. This needs a compiler pin whose image carries third_party/TOGSim; with the pin at 65fb058 the paths do not exist. Not run: no such image is published.
The script left TOGSim out ("TOGSim is built from this repo") and the copy in
this tree was built by hand. It now initialises the compiler's
third_party/TOGSim submodule beside vcix-accelerator and runs the compiler's
togsim step, which fetches TOGSim's own submodules and builds
third_party/TOGSim/build/bin/Simulator, where config.CONFIG_TOGSIM_DIR
looks.
The step runs conan and cmake from PATH; the compiler's setup/system.sh
installs conan 1.56.0 and cmake 3.26.4 and sets the conan profile to
libstdc++, as root, and is not run from here.
Needs a compiler pin that has third_party/TOGSim and the togsim step: at
65fb058 neither exists and the script stops at the submodule update. Checked
with bash -n only.
…ild says it builds TOGSim The variable and its default go in the table of what config.py reads. The README and the build notes said build_from_source.sh builds the compiler, Spike, pk and gem5; it builds the compiler's TOGSim as well now.
third_party/pytorchsim-triton-backend.json is the only pin this repository keeps, and since the compiler carries TOGSim as a submodule its ref decides the Simulator, the runtime header and the machine configs too. The description says so. The ref is not moved here: it has to become a compiler commit that has third_party/TOGSim, and none is published yet.
…t an uncaught KernelObjectMismatch torchsim_compile read the cached ELF through contract.artifact before it compared identities, and contract.kernel_object raises KernelObjectMismatch on a kernel.json whose format it does not know. Nothing caught it, so a warm cache from a compiler with another manifest format stopped the run at import of the generated wrapper, where the identity check two lines below would have rebuilt it. cached_elf() decides it in one place. A manifest of another format in a workdir whose provenance.json is not this identity is a stale cache: it is cleared and rebuilt like any other, and clear_stale removes kernel.json with the stage artifacts so the rebuild starts without it. The same manifest in a workdir this identity wrote means contract.KERNEL_FORMAT and the pinned compiler disagree; rebuilding would write the same file again, so it is raised, saying that the two must move together. The reader's own message named "rebuild the kernel cache" without saying how; it names scripts/clear_codegen_cache.sh.
…og_so, and kernel.json format 2 What the compiler emits and TOGSim loads is a tile-operation-graph (TOG). TOGSim ABI 16 names its surface after it, and the compiler that carries that TOGSim names its artifacts the same way, so the frontend follows both at once: trace.so -> tog.so trace_cycles.tsv -> tog_cycles.tsv trace_units.tsv -> tog_units.tsv trace_shape.txt -> tog_shape.txt trace_tensors.txt -> tog_tensors.txt trace_tensor_shapes.txt -> tog_tensor_shapes.txt --trace_so -> --tog_so kernel.json "trace_so" -> "tog_so" The compiler made that last rename its kernel.json format 2, so contract.KERNEL_FORMAT is 2. A workdir holding a format-1 manifest is another identity's and is rebuilt (the commit before this one). trace_axes.txt, which only this repository reads, becomes tog_axes.txt. timing.TRACE_SO is timing.TOG_SO. clear_stale removes the new names and still removes the old ones, which a workdir written before this commit holds. There is no compatibility path: TOGSim 16 refuses --trace_so and an ABI-15 TOG, and the in-tree TOGSim/, which is ABI 15, is not read any more. The command stream's .trace file, the FIFO's trace_log and --log_level trace keep their names: they are a record of what was sent or replayed, not the TOG.
…TOG, this step measures it
timing.emit_trace emits nothing of the TOG. The compiler builds tog.so; this
function measures the tile under gem5 and writes tog_cycles.tsv and
tog_units.tsv beside it. It is named for that, and its wall-clock span follows:
wallclock.TOGSIM_TRACE ("togsim/trace") is wallclock.TOGSIM_TABLES
("togsim/tables"), which is also the key in breakdown_<run>.json and the row
in the TORCHSIM_BREAKDOWN table.
_trace_abi() and the "trace_abi" key of provenance.json are _tog_abi() and "tog_abi": the digest is of the header a TOG is compiled against. The key is part of the identity, so a provenance.json written before this commit matches no identity computed after it: every workdir from the old names is rebuilt on first use and none is reused. The docstring said TOGSim declares the refusal of a mismatched ABI and does not check. TOGSim 16 checks, at load; the digest turns the same condition into a cache miss first.
… from an older one util_viewer.py joins a TOGSim log to its kernel workdir by the path after the flag on the logged command line. TOGSim 16 logs --tog_so. The logs under togsim_results/ outlive the simulator that wrote them, so the pattern accepts either flag and the page still builds from a directory that holds both. trace_timeline.py's usage line and clear_codegen_cache.sh's list of what a workdir holds name the flag and the file as they are now. trace_timeline.py keeps its name: it draws a --log_level trace log.
triton_route_sweep.py places a failed kernel by the last stage file its workdir holds, and buckets a failure by its text. The last stage file is tog.so, labelled "TOG"; the togsim bucket matches tog\.so, and its owner reads "TOGSim / the TOG". TOGSim's own lines, now prefixed [TOGSim], were already matched by the bucket's first alternative.
…its files as they are .claude/CLAUDE.md said "trace producer", trace.so, trace_cycles.tsv, trace_shape.txt and trace_to_tilegraph. It says tile-operation-graph (TOG) on first mention and TOG after, with the file and symbol names of TOGSim ABI 16. Two statements were wrong beyond the names and are corrected: the compiler compiles the TOG to tog.so (this repository does not, it writes the two tables beside it), and the compiler's directory is lowering/tog/, not trace/. "trace" stays where it is one: the .trace command stream under togsim_results/, TOGSIM_DEBUG_LEVEL=trace and scripts/trace_timeline.py.
…rries its last line run_standalone answered a Simulator that exited non-zero with `assert 0`. Nothing catches an AssertionError: autotune's _time_tile, which scores a candidate that does not compile or run as inf, catches CompilerError, RuntimeError and FileNotFoundError, so the first candidate TOGSim refused ended the whole compile instead of being skipped. TOGSim 1.3.0 makes that exit ordinary. It refuses at load a work-item that needs more of the spad at once than a core has (601de86), a compute whose tile id the cycle table does not hold, and a run with no cycle table; before it, the first of these hung and met autotune's timeout, which is a RuntimeError already. The exit is now a RuntimeError with the status and the last line the Simulator printed, which for a refusal is the refusal. Outside autotune the whole output is still logged as an error first. tests/system/test_togsim_exit.py holds this with a stub Simulator, and joins the allowlist and the workflow matrix. On the tree before this commit it fails with the AssertionError. Run against the Simulator of TOGSim 83f43c80 (v1.3.0) on the TOG its spad_capacity case builds, one byte over a 48 kB spad: before, AssertionError; now, "TOGSim Simulator exited with status 1: ... work-item 0 (key 10) needs 49153 bytes in the spad at once, and a core's spad holds 49152". No kernel this compiler emitted has been seen refused.
shutdown waited for the Simulator and dropped its exit status, so a session TOGSim ended early returned as one that ran: `with torch.npu.simulator(...)` left its block quietly and the script went on to print that the simulation was done. A session Simulator stops at the first command it cannot process. TOGSim 1.3.0 adds three such commands that an earlier one ran or hung on: a launched kernel with no readable tog_cycles.tsv, a compute whose tile id the table does not hold, and a work-item over the spad. shutdown still writes the log and the trace and removes the FIFO, and then raises a RuntimeError with the status. The session's output is not captured, so the reason is on the Simulator's own output and the message says so. test_togsim_exit.py holds both ends with the stub Simulator: a status of 1 raises after the cleanup, a status of 0 does not. Run against the Simulator of TOGSim 83f43c80 (v1.3.0) on the refused spad_capacity TOG: `python -m pytorchsim.simulator.togsim` exited 0 before and exits 1 now, and a torch.npu.simulator block that launches it returned quietly before and raises now.
…t ABI 16 688388c7 is the head of PyTorchSim-Triton-Backend's main. It contains that repository's #59, the first commit that carries TOGSim as third_party/TOGSim (at af85f7b, v1.2.0, TOGSIM_ABI_VERSION 16) and that emits tog.so, "tog_so" and a kernel.json of format 2. Everything before this commit on the branch is written for such a compiler and runs with no earlier one: 65fb058, the pin until now, carries no TOGSim and writes trace.so. The image ghcr.io/psal-postech/pytorchsim-triton-backend:688388c7... is in the registry. This file is one of the three that decide the base image tag, so CI rebuilds the base once. Only the ref changes. A later compiler commit that moves its TOGSim submodule is followed by moving this one line again.
…le and the TPU v6e HBM3 address mapper 688388c7 -> 11ef9b00 of PyTorchSim-Triton-Backend. It carries TOGSim a1c4209 (v1.3.0 plus the MOP4CLXOR mapper of HBM3_TPUv6e) and one compiler change, 0f3ba03 (a dot's elementwise consumer runs at its last-K pops). ABI stays 16.
[Deps] The compiler pin moves to 11ef9b00: the TPU v6e HBM3 address mapper
YWHyuk
marked this pull request as ready for review
October 13, 2026 05:11
YWHyuk
added a commit
that referenced
this pull request
Oct 13, 2026
… TOGSIM_DIR TOGSim is its own repository (PSAL-POSTECH/TOGSim) and the compiler, PyTorchSim-Triton-Backend, pins it as third_party/TOGSim. The dependency line is PyTorchSim -> compiler -> TOGSim, so this repository pins the compiler only. - TOGSIM_DIR names the TOGSim checkout; by default it is the one inside the compiler checkout. The compiler is handed the same TOGSim this process digests and runs, so the header a TOG is built against is the Simulator's. - A TOGSim without its header or its Simulator, and a machine config that is not there, are errors that name TOGSIM_DIR. - The gate's three machine configs are read from the TOGSim the compiler image carries, and build_from_source.sh builds that TOGSim. - The environment table and the from-source notes say so, and the compiler pin's description says it is also what pins TOGSim. PyTorchSim #348.
YWHyuk
added a commit
that referenced
this pull request
Oct 13, 2026
…so, kernel.json format 2 What the compiler emits is a tile-operation-graph (TOG), and TOGSim's ABI 16 names it so. The frontend follows: tog.so and tog.cpp, tog_cycles.tsv, tog_units.tsv, tog_tensors.txt, tog_shape.txt, --tog_so, and kernel.json at format 2. - emit_trace is write_cycle_tables: the compiler emits the TOG, this step measures its tiles. - The cache identity's header digest is "tog_abi". A workdir that another kernel-object format wrote is rebuilt instead of raising an uncaught KernelObjectMismatch. - util_viewer reads --tog_so from a log, and still --trace_so from an older one. The route sweep looks for tog.so. - The repo guide calls what the compiler emits a TOG and names its files as they are. PyTorchSim #348.
YWHyuk
added a commit
that referenced
this pull request
Oct 13, 2026
…nd in a session TOGSim v1.3.0 refuses a run without a cycle table, a compute whose tile id the table does not hold and a work-item larger than the spad, each with exit 1. - run_standalone raised an AssertionError, which escaped autotune's except list. It is a RuntimeError that carries the Simulator's last line, so autotune drops that candidate and goes on. - A session whose Simulator exited non-zero returned as if it had succeeded. shutdown keeps the exit status and raises after the logs are written and the FIFOs are removed, so a torch.npu.simulator block raises. tests/system/test_togsim_exit.py pins both, and is in the route's passing list. PyTorchSim #348.
YWHyuk
added a commit
that referenced
this pull request
Oct 13, 2026
…t v1.3.0 with the TPU v6e HBM3 address mapper third_party/pytorchsim-triton-backend.json, ref 65fb0585 -> 11ef9b00, the head of the compiler's main. Its image is published. - third_party/TOGSim at a1c4209: TOG ABI 16, v1.3.0 (the three refusals), and PSAL-POSTECH/TOGSim #20, the TPU v6e HBM3 mapping addresses with MOP4CLXOR instead of RoBaRaCoCh. Every tpuv6e cycle count moves with the mapper. - The compiler's sync-by-default transfers (PTB #62), the pop rule of the accelerator model (PTB #63), and a dot's elementwise consumer running at its last-K pops. TOGSim does not carry PyTorchSim #346 (a load of what a buffer already holds is not read again) yet: PSAL-POSTECH/TOGSim #22, #23. That behaviour is absent from here on until TOGSim carries it and this pin moves. PyTorchSim #348, #350.
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.
Branch
togsim-dir(18 commits) ->pytorchsim-triton-backendataaa3ee84(#346 merged). Head5ab54226.One thing to settle before merging: #346 changed the in-tree
TOGSim/after the split, and PSAL-POSTECH/TOGSim does not have that change (see "#346"). With this PR the in-tree copy stops being run, so #346's effect is lost until TOGSim carries it.What this is
Two things that cannot land apart.
third_party/TOGSim, and this repository reaches it through the compiler checkout it already pins: PyTorchSim -> PyTorchSim-Triton-Backend -> TOGSim. One variable,TOGSIM_DIR, says where it is.--tog_so,tog.so,tog_*.tsv,tog_*.txt), and the compiler that carries that TOGSim writestog.soand"tog_so"in akernel.jsonof format 2. The frontend follows.They are one PR because the compiler commit this repository must pin does both: it is the first that carries TOGSim, and the TOGSim it carries is ABI 16. A frontend at the old names cannot run with it, and a frontend at the new names cannot run with any earlier compiler.
There is no fallback to the
TOGSim/in this tree. An earlier version of this branch kept one for compiler pins from before the split. That copy is ABI 15 (--trace_so,trace.so), so keeping it reachable would mean a frontend that speaks one set of names to the carried TOGSim and another to its own. It speaks one. After this PR nothing readsTOGSim/; the stacked PR deletes it together withconfigs/.Order
main,v1.2.0ataf85f7b. Done. (v1.3.0at83f43c8is out since; see "TOGSim v1.3.0".)third_party/TOGSimataf85f7b,tog.so,kernel.jsonformat 2. Merged asff9d399e; itsmainis688388c7, and the image for that commit is published.688388c7.togsim-remove), stacked on this one; once this one is merged its base is changed topytorchsim-triton-backend.The pin
The last commit,
[Deps] The compiler pin moves to 688388c7: TOGSim as its submodule, at ABI 16, changes one line:refinthird_party/pytorchsim-triton-backend.json, from65fb0585to688388c7f8aa322221ebbfef81f3f89f42966299, the head of the compiler'smain. That commit carriesthird_party/TOGSimataf85f7b(v1.2.0).ghcr.io/psal-postech/pytorchsim-triton-backend:688388c7f8aa322221ebbfef81f3f89f42966299is in the registry (pushed 2026-10-12T19:18Z, also taggedmain). The file is one of the three that decide the base image tag, so CI rebuilds the base once (third_party-6a7b2e2e905cwith this pin).When the compiler moves its TOGSim submodule (to v1.3.0, or to a commit that carries #346's change), this repository follows by moving that one line again.
#346
ee5f8a48(#346, "A load of what a buffer already holds is not read again") was merged intopytorchsim-triton-backendafter this branch was first cut. It changesTOGSim/include/Instruction.h,TOGSim/src/Core.ccandTOGSim/src/togsim_trace_bridge.ccin this tree (ABI 15). It is the only commit on the base sincec9a279be.PSAL-POSTECH/TOGSim does not have it: at
83f43c8(v1.3.0) no file undersrc/orinclude/containstag_scope,wait_scopeorstruct Resident, and no commit message mentions it. The patch does not apply tov1.2.0orv1.3.0as it is:Instruction.happlies,Core.ccandtogsim_trace_bridge.ccconflict under a 3-way apply.What that means here: after this PR the Simulator that runs is the compiler's
third_party/TOGSim(v1.2.0), so a repeated load is read again, as before #346 (its message gives 8192x768x3072 at 309622 cycles without the change and 269075 with it). Either TOGSim takes the change and the compiler pin is moved before this merges, or this merges knowing the regression and the pin follows later. That is a decision for the reviewers; nothing here ports it.TOGSim v1.3.0
The pinned compiler carries v1.2.0. v1.3.0 keeps
TOGSIM_ABI_VERSION16 and the sameinclude/togsim_runtime.h(SHA-2568d4d4a15...at both tags), and refuses three things it used to accept: a run without a cycle table, a compute whose tile id the cycle table does not hold, and a work-item that needs more of the spad at once than a core has. This branch was checked against it withTOGSIM_DIRnaming a v1.3.0 checkout:timing.runwritestog_cycles.tsvandtog_units.tsvwhen either is missing, andtiming.run_togsimraisesFileNotFoundErrorunlesstog.soand both tables are in the workdir;TOGSimulator.run_standalonepasses--cycle_tableand--unit_table; a session launch (--models_list) names a launch directory into whichcontract.link_sharedhas linked the three files.write_cycle_tableswrites one row per entry of the compiler'stile_types(overlap_offset), and raises when gem5 returns a different number of samples.run_standaloneanswered a non-zero exit withassert 0, which autotune does not catch, andshutdowndropped the session Simulator's exit status.Changes
TOGSIM_DIR(commits 1-8):pytorchsim/config.py:CONFIG_TOGSIM_DIRisTOGSIM_DIRif set, else$TORCHSIM_COMPILE_DIR/third_party/TOGSim. The header is$TOGSIM_DIR/include/togsim_runtime.h, the binary$TOGSIM_DIR/build/bin/Simulator, the machine configs$TOGSIM_DIR/configs(CONFIG_TOGSIM_CONFIG_DIR, from which the defaultTOGSIM_CONFIGis taken). A machine config that is not there raisesFileNotFoundErrornaming the path, the checkout and both variables.pytorchsim/simulator/togsim.py: the session, the standalone run andget_togsim_commandtake the Simulator fromCONFIG_TOGSIM_DIR; a missing Simulator is an error that namesTOGSIM_DIR.pytorchsim/driver/compiler_bridge.py:compiler_env()setsTOGSIM_DIRfor the compiler subprocess, so the header the TOG is compiled against, the header this process digests and the Simulator it starts are one checkout.pytorchsim/driver/codecache.py: a missingtogsim_runtime.hraises instead of digesting toNone, which admitted any cached artifact..github/workflows/docker-image.yml: the threetogsim_configpaths are under/workspace/pytorchsim-triton-compiler/third_party/TOGSim/configs/.scripts/build_from_source.sh: initialises the compiler'sthird_party/TOGSimand runs itstogsimstep (needsconan1.56 andcmakeonPATH).The names (commits 9-15; the pin is the last commit, 18):
trace.sotog.sotrace_cycles.tsv,trace_units.tsvtog_cycles.tsv,tog_units.tsvtrace_shape.txt,trace_tensors.txt,trace_tensor_shapes.txttog_shape.txt,tog_tensors.txt,tog_tensor_shapes.txttrace_axes.txttog_axes.txt--trace_so--tog_sokernel.jsonartifact key, format"trace_so", 1"tog_so", 2provenance.jsonkey"trace_abi""tog_abi"timing.pyTRACE_SO,emit_trace()TOG_SO,write_cycle_tables()wallclock.TOGSIM_TRACE,"togsim/trace"wallclock.TOGSIM_TABLES,"togsim/tables"timing.emit_traceemitted nothing of the TOG: the compiler buildstog.so, and this function measures the tile under gem5 and writes the two tables. It iswrite_cycle_tables.scripts/util_viewer.pyreads the workdir from--tog_soon a logged command line and still from--trace_so, because logs undertogsim_results/outlive the simulator that wrote them.scripts/ci/triton_route_sweep.py: the last stage file istog.so, thetogsimbucket matchestog\.so..claude/CLAUDE.md: "tile-operation-graph (TOG)" on first mention, "TOG" after. Two statements that were wrong beyond the name are corrected (the compiler, not this repository, compiles the TOG; its directory islowering/tog/)..tracecommand stream andtrace_logof a session,--log_level trace/TOGSIM_DEBUG_LEVEL=trace,scripts/trace_timeline.py.A Simulator that exits non-zero (commits 16-17):
TOGSimulator.run_standaloneraisesRuntimeError("TOGSim Simulator exited with status N: <the last line it printed>")instead ofassert 0. Autotune's_time_tilealready scoresRuntimeErrorasinf, so a candidate TOGSim refuses is skipped like one that times out; outside autotune the Simulator's whole output is logged as an error first.TOGSimulator.shutdownkeeps the status of the session Simulator and, after writing the log and the trace and removing the FIFO, raisesRuntimeErrorwhen it is not 0.torch.npu.simulator.__exit__calls it, so thewithblock raises. The session's output is not captured, so the reason is on the Simulator's own output.tests/system/test_togsim_exit.pyholds both with a stub Simulator (no TOGSim needed) and is added toscripts/ci/triton_route_passing.txtand the workflow matrix.Behaviour to know about
TORCHSIM_DUMP_PATHwritten before this PR holds a format-1kernel.jsonand aprovenance.jsonkeyedtrace_abi. Its identity matches none computed now, so it is cleared and recompiled on first use;clear_staleremoves the oldtrace.so/trace_*.tsvas well as the new names.trace.cppandtrace_axes.txtare left behind in such a workdir, unread.torchsim_compileread the manifest before comparing identities, andcontract.kernel_objectraisesKernelObjectMismatchon a format it does not know; nothing caught it. Commit 9 (cached_elf) makes a foreign-format manifest in a workdir of another identity a rebuild. The same manifest in a workdir this identity wrote still raises, saying thatcontract.KERNEL_FORMATand the pinned compiler must move together, because a rebuild would write the same file.TOGSIM_DIRnamed.TOGSIM_DIR=$TORCHSIM_DIR/TOGSimdoes not work. The in-tree Simulator refuses--tog_so. Nothing sets it that way; the directory goes in the next PR.with torch.npu.simulator(...)block used to return after the Simulator exited non-zero now gets aRuntimeErrorfrom the block. v1.3.0's three refusals end a session this way; only the spad one was run.togsim/traceistogsim/tablesinbreakdown_<run>.jsonand in theTORCHSIM_BREAKDOWNtable.typed, applies.typedis deprecated in the compiler and in TOGSim (a typed TOG that usescompute_type1-3 logs one warning per Simulator process before the simulation and replays with unchanged cycles). No option is added here; moving tosegmentis a separate change, and it changes cycle counts (gemm 24818 -> 24586, softmax 1589 -> 1722 on tpuv6e).docker/Dockerfilestill builds the in-treeTOGSim/that nothing runs, and its comment still says "trace producer". The next PR removes both.Verified locally, at head
5ab54226All runs are in the published image of the pin,
ghcr.io/psal-postech/pytorchsim-triton-backend:688388c7...(compiler, Spike, gem5 and the built TOGSim v1.2.0 as the image carries them), as a non-root user, with this branch mounted asTORCHSIM_DIR,TORCHSIM_TRITON_CODEGEN=1, torch 2.14 and adevice/built outside the image. "v1.3.0" means the same image withTOGSIM_DIRnaming a checkout of TOGSimv1.3.0built in that image with conan 1.56 and cmake.aaa3ee84with no conflict: the one commit merged since touches onlyTOGSim/. The tree differs from the branch as first cut (13e907de) by [TOGSim] A load of what a buffer already holds is not read again #346's three files, the pin line, and commits 16-17 (five files:togsim.py, the_time_tiledocstring inautotune.py, the new test and its two list entries).tests/ops/elementwise/test_add.py, timing on (tpuv6e), standalone launches (--tog_so ... --cycle_table ... --unit_table ...): five of five passed on v1.2.0 and on v1.3.0, the same totals on both: 81, 326, 5889, 639866, 5642. No refusal and no TOGSim warning in any log. The workdirs hold a format-2kernel.jsonwithtog_so.experiments/gemm.py, timing on (tpuv6e), a session (--models_list) plus the autotune path (write_cycle_tablesandrun_standalone): finished on v1.2.0 and on v1.3.0, autotune 1799 cycles andTotal execution cycles: 1799on both. The launch directory holdstog.so,tog_cycles.tsvandtog_units.tsvas links. TOGSim logs its typed-grouping deprecation warning once per Simulator process, so twice in this run: once for the autotune candidate's standalone Simulator (in its captured log underautotune/128x128x128/launch-7/togsim_result/) and once for the session (see "Grouping").tests/system/test_togsim_result.py: PASS.tests/system/test_togsim_exit.py: PASS; on the tree before commit 16 it fails withAssertionErrorfromrun_standalone, and before commit 17 its session case fails becauseshutdownreturns.spad_capacity/refused.one_byte_overcase builds (one byte over a 48 kB spad), not a kernel this compiler emitted. Before commits 16-17 (at79a07464) and at this head:run_standalone(..., autotune_mode=True): before,AssertionError, which escapes_time_tile'sexcept; nowRuntimeError: TOGSim Simulator exited with status 1: ... work-item 0 (key 10) needs 49153 bytes in the spad at once, and a core's spad holds 49152 (core_spad_size_kb: 48).python3 -m pytorchsim.simulator.togsim <kernel> <attribute> --config machine.yml: before, exit 0; now exit 1 with theRuntimeError.with torch.npu.simulator(config_path=...)block that callstorch.npu.launch_kernelon it andtorch.npu.synchronize(): before, the block returned; now it raises theRuntimeError.bash -n, the five workflows load as YAML.Verified on the branch as first cut and not repeated at this head: the stale-cache script (format-1 manifests rebuilt, the same-identity case raising),
scripts/util_viewer.pyon old and new logs, the sweep's bucket expression.The cycle totals differ from the ones recorded when the branch was first cut (81, 334, 5475, 6094, 650213): those were measured with the compiler at
87743844, these with688388c7. The base commit cannot be run with this compiler (it readstrace.so), so there is no same-compiler comparison against the base.Not verified
third_party-6a7b2e2e905cdoes not exist yet), the app image build, and the gate. The gate runs its tests withTORCHSIM_TIMING_MODE=0, so it does not start TOGSim; only the non-gating accuracy job does.scripts/build_from_source.shbeyondbash -n;scripts/ci/triton_route_sweep.pyas a whole; the allowlist; the other two CI machines (32x32, 8x8).core_spad_size_kbon a shipped machine config is not known.tog_cycles.tsvunder--models_list, a tile id the table does not hold) were not provoked; they leave the Simulator through the same non-zero exit._send_commandraisesRuntimeErrorfirst, and intorch.npu.simulator.__exit__a raise fromsynchronize()skipsshutdown. Unchanged here.git grep -n -i 'trace producer\|trace_so\|trace\.so\|trace_abi'at the head, outsideTOGSim/pytorchsim/driver/codecache.py:39:_STALE_PATTERNSkeepstrace.so,trace_cycles.tsv,trace_units.tsvso an old workdir is cleared.scripts/util_viewer.py:9,25: the pattern and its docstring accept--trace_sofrom old logs.docker/Dockerfile:6: a comment in the block the next PR deletes.Inside
TOGSim/the in-tree copy keeps its ABI-15 text (and #346's change); the next PR deletes it.