Repository navigation
[Simulator] Read TOGSim's results from the file it writes with --result, not from its log - #446
Closed
student-Jungmin wants to merge 1 commit into
Closed
student-Jungmin wants to merge 1 commit into
student-Jungmin wants to merge 1 commit into
Conversation
…lt, not from its log get_result_from_file read the end-of-run lines with five regular expressions, and a log it could not parse came back as infinite cycles without a reason. TOGSim now writes the same values as JSON (--result <path>, each value recorded where its line is printed), so both launch paths hand it a path beside the log and TOGSimProcess.read_result returns that object. driver/select.py takes total_cycles from it; a run that wrote no file is a FileNotFoundError, which a timed candidate already turns into a logged inf. The regexes, FINISH_STR and the unused TOGSIM_RESULT_PATH_KEY go. test_togsim_result now runs a stub Simulator that writes the result of a tpuv6e test_matmul.py run (the fixture replaces the cut log) and pins that both paths pass --result and read the file back. This needs a TOGSim with --result: it lands only after the compiler pins one (a TOGSim without the option refuses it). Checked locally on TOGSim e0c820f (PTB main's pin) with --result cherry-picked: test_matmul.py in timing mode passes, and total_cycles of all 42 result files (11 kernel runs, 31 autotune candidates) equals the log's Total execution cycles.
This was referenced Oct 24, 2026
Collaborator
Author
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
The frontend now reads TOGSim's results from the JSON file TOGSim writes with
--result(PSAL-POSTECH/TOGSim#60), not from its log.TOGSimProcess.run_standaloneand the FIFO session both pass--result <stamp>.json, beside the.log.run_standalonereturns that path.get_result_from_fileand its five regexes go.TOGSimProcess.read_result(path)returns the JSON object.driver/select.pytakestotal_cyclesfrom it.codecachelogssimulated: N cycles.FileNotFoundError. Before, an unparsable log came back asinfcycles with only a warning. A timed candidate still turns the error into a loggedinf.FINISH_STRand the unusedTOGSIM_RESULT_PATH_KEYgo.Depends on
--result). A TOGSim without the option refuses it.Until then CI fails at the first TOGSim run, so this stays a draft.
Tests
tests/system/test_togsim_result.pynow runs a stub Simulator that copies a real result file. It pins three things: the standalone path passes--resultand reads the file back, the session leaves its file, and a run without a file is an error. The fixturetests/system/data/togsim_tpuv6e.jsonreplaces the cut log; it comes from a tpuv6etest_matmul.pyrun.Checked locally
TOGSim e0c820f (PTB main's pin) with the
--resultcommit cherry-picked, on a PTB 1b35878 toolchain. This repository's pin (PTB 1b1e0607, TOGSim b9c9519) had no local build, so that pair is left to CI.tests/ops/gemm/test_matmul.pywithTORCHSIM_TIMING_MODE=1: 11/11 passed.total_cyclesequals the log'sTotal execution cycles.test_togsim_result,test_togsim_exit: PASS.The fixture's
versionis"e0c820f+result"because e0c820f has no version string; that local build set one. Nothing reads the field.No cycle numbers change: only the path the frontend reads them from.