Repository navigation
torch.npu.TOGSimulator, and usage docs that match the code - #413
Merged
Merged
Conversation
The device-side context manager is torch.npu.TOGSimulator again, as in v1; torch.npu.simulator is gone, with no alias. The backend class it builds, pytorchsim.simulator.togsim.TOGSimulator, is renamed TOGSimProcess so the two no longer share a name. Callers in select.py, timing.py, verify.py, the tests and experiments follow. The "no TOGSim is open" error now says to launch inside the with block; it said to call torch.npu.init(), which opens no session.
- torch.npu.TOGSimulator in the README and CLAUDE.md examples. - The machine is TORCHSIM_TARGET; TOGSIM_CONFIG is refused at import, and README, CLAUDE.md and docs/worktrees.md still told users to set it. - Run settings (timing, functional, per-kernel verify, GEMM tile top-k) are environment variables; the YAML keys the docs named are not read. - Timing is off by default: the matmul example sets TORCHSIM_TIMING_MODE=1, and its log is $TORCHSIM_LOG_PATH/<stamp>_<hash>.log, not togsim_result/. - The reference YAML is the shipped tpuv6e machine; the old block lacked isa and address_map and was refused. Keys nothing reads are dropped (vpu_vector_length_bits, STONNE, scheduler, codegen_compiler_optimization). - Removed: tests/system/test_scheduler.py, SRAM_BUFFER_PLAN_PATH, TORCHSIM_USE_TIMING_POOLING, TORCHSIM_COMPILE_VCIX_MODEL (none exist or are read). booksim is booksim2 with booksim_config_path; the test helper is tests/_pytorchsim_utils.py; tpu_validation's --config defaults to tpuv6e.
This was referenced Oct 22, 2026
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.
What
torch.npu.TOGSimulatoragain, as in v1.torch.npu.simulatoris removed and has no alias. The backend class,pytorchsim.simulator.togsim.TOGSimulator, becomesTOGSimProcess, so the device-side and backend names are now different. Every caller is updated:select.py,timing.py,verify.py, the tests and the experiments. The "no TOGSim is open" error used to tell users to calltorch.npu.init(), which opens no session; it now tells them to launch inside thewithblock..claude/CLAUDE.md,docs/worktrees.mdandexperiments/tpu_validation/README.mdagainst the code, and fixed the instructions that fail or silently do nothing:TOGSIM_CONFIG: setting it raisesNoTarget ... is retiredatimport torch. The docs now say to setTORCHSIM_TARGET.pytorchsim_timing_mode,pytorchsim_functional_mode,pytorchsim_functional_verify_per_kernelandcodegen_autotune_template_topkare only read from env vars (config.pyRUN_SETTINGS). The docs now give those env vars.TORCHSIM_TIMING_MODE=1, and the log path is corrected; there is notogsim_result/subdirectory.isaandaddress_map. It is replaced with the shippedtpuv6emachine, and the optional keys kept are only those TOGSim reads.tests/system/test_scheduler.pySRAM_BUFFER_PLAN_PATHandtpuv4/TORCHSIM_USE_TIMING_POOLINGTORCHSIM_COMPILE_VCIX_MODELvpu_vector_length_bitscore_type: stonne)schedulercodegen_compiler_optimizationbooksimis nowbooksim2withbooksim_config_path,tests/_utils.pyis nowtests/_pytorchsim_utils.py, and the tpu_validation--configdefault istpuv6e.Verification
Docker
local/torchsim_base:ptb-9618c0e:test_togsim_exit,test_togsim_result,test_gqa_decode(timing 1) and an a@b inside thewithblock (timing 0 and 1) all pass, with identical results before and after.torch.npu.simulatornow raisesAttributeError.test_addand TOGSim writes its log.TORCHSIM_TIMING_MODE=1 python tests/ops/gemm/test_matmul.pypasses, with the log at the documented path.TORCHSIM_FUNCTIONAL_VERIFY_PER_KERNEL=1runs[FuncVerify].TORCHSIM_FUNCTIONAL_MODE=0skips Spike and leaves outputs uncomputed. The docs now say so.Not in this PR (tracked as FIXME issues #414–#417)
torchsim-ci:v1.1.0(andv1.0.1in CLAUDE.md) is the v1 tree. No release image exists for this branch yet.run_cycle.sh,run_speed_ils_*.sh) exportTOGSIM_CONFIGand namesystolic_ws_*configs, which are no longer shipped. The README scopes them to the v1.0.0 image.experiments/*.pyfail at lowering unlessTORCHSIM_TIMING_MODEis set in the environment: the scripts'setdefaultruns afterimport torch.scripts/util_viewer.py --breakdown <dir>globs forbreakdown.json, but the run writesbreakdown_<stamp>.json.