Repository navigation
[Refactor 7/9] One place for each fact: tool paths in config, the runtime attribute directory, build identity, launch hooks, template records - #462
Merged
student-Jungmin merged 1 commit intoOct 24, 2026
Conversation
…attribute directory, the build identity, launch hooks and template records Spike's and pk's paths and the Spike job count are config's (CONFIG_SPIKE_PATH, CONFIG_PK_PATH, CONFIG_SPIKE_JOBS), beside gem5's, and VCIX_ENV_ROOT's default is stated once (CONFIG_VCIX_ENV_ROOT); the variables, their order and their defaults are unchanged. The runtime attribute directory is compiler_bridge.runtime_attribute_dir, read by the functional replay and by timing; a kernel that declares none hands TOGSim no --attribute_path. codecache.py is three files: launch_hooks.py (the observers, torchsim_extern, notify_launch, which the launcher calls), build_identity.py (the stamp of what a workdir was built with, and cached_elf), and codecache.py (torchsim_compile and the launcher). The generated wrapper imports torchsim_extern from launch_hooks. template_timing.py keeps the timing (time_choices, time_module); template_record.py holds where a choice came from, the timed templates, the record and the digests. contract.py's four parts are listed in its docstring and sectioned, its docstrings three lines at most. Behavior: the identity's "the compiler" key is "compiler", so every cached workdir is rebuilt once. clear_stale raises a removal that fails for any reason but the file being gone already, and the breakdown's exit hook logs a write that fails. TOGSimProcess no longer reads the machine YAML it never used (load_yaml, config_yaml): a missing file is still refused, a malformed one by TOGSim. Tests pin each of these: test_cache_identity (the compiler key; a removal that fails is raised, one already gone is not), test_breakdown_viewer (a breakdown that cannot be written is logged), test_togsim_exit (a session on a missing machine file is refused), test_attribute_sources (no runtime attribute directory for a kernel that declares none). Checked on PTB 70221f4 with TOGSim 5791272: compileall; test_add, test_eager, test_patch_scope, test_cache_identity, test_tuned_blocks_on_hit, test_togsim_result, test_togsim_exit, test_breakdown_viewer, test_attribute_sources, test_bundle_reuse, test_module_form, test_device_interface, test_custom_fused_kernel, test_topk, test_grouped_mm, test_user_triton_kernel, test_histc; test_matmul (11/11) and test_select in timing mode; test_add with TORCHSIM_BREAKDOWN=1.
This was referenced Oct 24, 2026
student-Jungmin
marked this pull request as ready for review
October 24, 2026 14:01
student-Jungmin
changed the base branch from
refactor/r441-7b-togsim-result
to
pytorchsim-triton-backend
October 24, 2026 14:01
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.
Draft: waiting for verification (CI and the validation reports) before review.
Part 7 of 9 of the frontend refactor. It is one commit of this part's final state. Stacked on #461 (
refactor/r441-7b-togsim-result); review only this PR's commit.What
Tool paths in config. Spike's and pk's paths and the Spike job count are
config.CONFIG_SPIKE_PATH,CONFIG_PK_PATHandCONFIG_SPIKE_JOBS, beside gem5's.VCIX_ENV_ROOT's default is stated once (CONFIG_VCIX_ENV_ROOT). The variables, their order and their defaults are unchanged.One runtime attribute directory.
compiler_bridge.runtime_attribute_dir(workdir)is read by both the functional replay and timing. A kernel that declares none hands TOGSim no--attribute_path.codecache.pyis three files:launch_hooks.py: the observers,torchsim_extern, andnotify_launch, which the launcher calls;build_identity.py: the stamp of what a workdir was built with, andcached_elf;codecache.py:torchsim_compileand the launcher.The generated wrapper imports
torchsim_externfromlaunch_hooks.template_timing.pykeeps the timing (time_choices,time_module).template_record.pyholds where a choice came from, the timed templates, the record and the digests.contract.py: its four parts are listed in its docstring and sectioned, and its docstrings are three lines at most.Behavior change
"the compiler"key is"compiler", so every cached workdir is rebuilt once.clear_staleraises a removal that fails for any reason except the file being gone already.TOGSimProcessno longer reads the machine YAML it never used (load_yaml,config_yaml). A missing file is still refused; TOGSim refuses a malformed one.Pinned by:
test_cache_identity: the key, a failed removal raised, an already-gone one not;test_breakdown_viewer: the warning;test_togsim_exit: a missing machine file refused;test_attribute_sources: no directory for a kernel that declares none.Checked locally
PTB 70221f4 with TOGSim 5791272:
compileall;test_add,test_eager,test_patch_scope,test_cache_identity,test_tuned_blocks_on_hit,test_togsim_result,test_togsim_exit,test_breakdown_viewer,test_attribute_sources,test_bundle_reuse,test_module_form,test_device_interface,test_custom_fused_kernel,test_topk,test_grouped_mm,test_user_triton_kernel,test_histc;test_matmul(11/11) andtest_selectin timing mode;test_addwithTORCHSIM_BREAKDOWN=1.All pass. Files whose only change here is an import line (
scripts/ci/bundle.py,scripts/selection_merge.py,tests/ops/gemm/test_grouped_mm.py) keep their comments.