Skip to content

[Experiments] tpu_validation: sim-vs-TPU comparison pipeline for gemm and softmax - #345

Merged
student-Jungmin merged 1 commit into
pytorchsim-triton-backendfrom
tpu-validation-pipeline
Oct 12, 2026
Merged

student-Jungmin merged 1 commit into
pytorchsim-triton-backendfrom
tpu-validation-pipeline

Conversation

@student-Jungmin

@student-Jungmin student-Jungmin commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

What

experiments/tpu_validation/: one command that simulates the shapes of a real-TPU table and reports how the simulated latency compares with the measured one. gemm and softmax go through the same code and get the same summary, so they can be read side by side.

python run.py gemm    --tag g1 --keep KxN=768x768,2048x3072
python run.py softmax --tag s1 --keep C=128,512,2048,8192 --drop R=1
python compare.py g1 s1
  • Shapes and TPU latencies come from PSAL-POSTECH/tpu-perf-archive (data/v6e/<op>/torchxla.csv), cloned on first use or taken from $TPU_PERF_ARCHIVE.
  • Config: configs/tpuv6e_nocache.yml, the shipped systolic_ws_256x256_c1_simple_noc_tpuv6e_timing_only.yml with the L2 cache off. --set KEY=VALUE changes a line for a variant (e.g. vpu_num_lanes=128).
  • sim_ns = cycles * 1000 / core_freq_mhz of the run's config; sim_over_tpu = sim_ns / latency_ns. Summary: median, IQR, min, max, MAPE for all shapes, for TPU status == ok, and per bucket.
  • Each tag directory keeps the exact config, the frontend / compiler / archive commits, every command line, results and per-shape logs. A rerun resumes; a tag reused with another op or config is refused.
  • A shape over --timeout is killed with the simulators it spawned and logged in failed.csv.

Only new files under experiments/tpu_validation/; nothing existing changes. See its README for options and outputs.

Tested

On this branch (rebased on 3e42fdc) with the compiler it pins (65fb058), TOGSim and the device extension built in the tree:

  • gemm 1/32/128 x 384 x 384 and softmax 8x128, 12x128 run end to end: archive clone, simulation, compare.csv and summary.

Earlier, on frontend 3984351 with compiler 670ae21:

  • The same shapes gave cycle counts identical to the hand-run sweeps on the same config, as did the --set vpu_num_lanes=128 --set core_freq_mhz=1750 variant.
  • compare.py on those sweeps' full results (95 gemm, 58 softmax shapes) reproduces their summaries.
  • Timeout (softmax 1x128, which hangs), resume and the tag guard.

The full tables were not swept through this code.

Known issue

Softmax shapes with R = 1 hang in gem5 while the kernel is compiled; the README says to pass --drop R=1.

…re with the measured latency

run.py takes the shapes of a tpu-perf-archive table (gemm, softmax on v6e), runs each
through PyTorchSim on the v6e timing config without the L2 cache, and compare.py reports
sim_ns / tpu_ns per shape with the same summary for every op (median, IQR, min, max, MAPE).

A run is a tag directory holding the exact config, the frontend / compiler / archive
commits, results and logs; it resumes, and refuses a tag reused on another config.
@student-Jungmin
student-Jungmin force-pushed the tpu-validation-pipeline branch from 5ef603a to 15d1e4c Compare October 12, 2026 10:07
@student-Jungmin
student-Jungmin merged commit c9a279b into pytorchsim-triton-backend Oct 12, 2026
@student-Jungmin
student-Jungmin deleted the tpu-validation-pipeline branch October 21, 2026 12:30
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