Repository navigation
[TOGSim] One compute at a time per core; systolic_array_split spreads a node's array rows over the arrays - #325
Merged
Conversation
YWHyuk
force-pushed
the
tt-opt/core-serial
branch
from
October 8, 2026 13:40
492c9fa to
92b44b7
Compare
… a node's array rows over the arrays
gem5 runs a core's computes serially: the Minor CPU issues in order and a
systolic pop waits for its result row (vcix examples/tpu/systolic.hpp:45),
so the last pop issues one cycle before the window ends. TOGSim let them
overlap three ways: the compiler's matmul overlap, two SA pipelines, and the
vu/xlu/sa pipelines side by side.
Core
- A compute with cycles is held while another compute of the core is in
flight (now < _compute_busy_until). The check comes first, so a held
compute takes nothing (spad, weight slot, SA round robin); the tile drops
its scan cursor (it keys on spad and weight slots only) and a ComputeFree
due at the finish re-arms the scan. cc==0 computes are exempt. The two
dispatches of a core share it; cores are independent.
- DMA issue is not serialized with compute, by design: DMA and compute
overlap, as before.
- The cycle table's overlap column is deprecated (column and ABI kept): it
no longer moves a finish (the pipeline-overlap branch is now a check that
the pipeline is free), no longer shrinks SA/VU/XLU active cycles as a
bubble, and no longer frees a weight slot early: the slot frees at finish.
A held compute waits only on computes already in flight, so a preload
cannot deadlock on its slot.
- has_inflight and running check the XLU pipeline (an XLU compute alone used
to read as a wedged simulation).
- "computes held at least once by the core's compute in flight" counts each
held compute once.
systolic_array_split: round_robin (default none; N is then ignored)
- shortens a compute at issue as if its subtiles round-robin over N arrays:
B = array rows / capacity, N_eff = min(N, max(1, ceil(rows / vpu_num_lanes)))
cc' = cc - B + max(B / N_eff, B_u of every other unit incl. Issue, Vpu), cc' <= cc
- systolic_array_unit names the unit table's array unit: Systolic (default)
or its variant Msa, one per machine. That default is the only unit name in
TOGSim. Only that unit is split. Its credit is per array: each compute's
rows divided by THAT compute's N_eff, checked against one array's capacity
(periodic, end-of-run and multi-core Total checks), so a compute with
N_eff 1 that over-admits still fails, whatever N is.
- Refused: split without --unit_table, split with no array-unit rows,
systolic_array_unit without split. It needs vpu_num_lanes.
- An unverified approximation: no gem5 run has N arrays.
Pins: tests/core_serial/run_core_serial.sh, on a typed gemm 512 b512 trace
fixed from PTB 2b7aecb + overlap 0/Issue rows, and a hand-written XLU trace.
On 7ef12a0 / on this tree with the named piece reverted:
K1 --unit_table exit 1 -> 0 (11,419)
K2 serial, 2 dispatches 1 overlapping pair (matmul [1768,3357) vs preload [3065,3116)) -> 0
K2 xlu (XLU 150000 cycles) wedged (has_inflight) -> 0; also wedged with only the XLU check reverted
K2 xlu, 2 cores (300/100) 2 overlapping pairs -> 0
K4 the 2 cores still overlap fails with a busy-until shared by all cores
K3 split matmul 1589 -> 1077 = 1589 - 1024 + 512
K3 Vpu 700 (other-unit max) 1589 -> 1265; 1077 with the other units dropped from the max
K3 cc 1100 (rows/cc' > 1) 1100 -> 588; exit 1 without the per-array credit
K3 256 rows (N_eff 1) 1589 -> 1589 (guard)
K5 no array rows / unit w/o split exit 0 -> refused
K5 N=4, N_eff 1, 256 rows in cc 230 exit 0 when checked against capacity x N
(fixed N) -> refused (Systolic spread)
Measured, PTB 2b7aecb with its overlap-0/Issue-row change (PR #31), gem5
vcix-v0.3.0, tpuv6e. "before" = 7ef12a0 on the same overlap-0 traces:
typed gemm 512 b512 10,515 (UT exit 1) -> 11,419 exit 0
typed gemm 1024 b512 56,638 (UT exit 1) -> 58,346 exit 0
typed gemm 1024 b1024 39,802 (UT exit 1) -> 57,339 exit 0
segment set (8 gemms incl. 2048 b1024 BK256 215,831, BK128 351,964): unchanged,
their nodes were already serial on one VU pipeline. Typed vs segment
(11,649 / 58,840 / 57,607) is a consistency check, not a validation.
softmax typed 1589 -> 1589
gem5 k-loop vs TOGSim k-loop computes (sample trip x trips):
typed 512 b512 6,623 vs 6,704 (+1.2%); typed 1024 b1024 40,366 vs 41,768
(+3.5%); segment 2048 BK256 40,255 vs 41,752 (+3.7%). The gap is the
sample trip being 1-4% longer than a steady trip; the windows are back to back.
split N=2 (per-array util): typed 512 11,419 -> 9,999 (20.48%); segment 512
11,649 -> 10,037 (20.40%); typed 1024 b512 58,346 -> 54,681 (29.96%);
typed 1024 b1024 57,339 -> 39,767 (41.20%); segment 1024 b256 (N_eff 1)
111,291 unchanged (29.44%: one array busy); segment 2048 BK256 (30.43%)
215,831 -> 215,344: the load -> compute chain is the critical path; the
64 MEMORY_BAR completion times are identical in both runs, compute busy
169,228 -> 103,692 and compute idle 37,454 -> 100,942.
Unverified: nodes other than matmul (XLU/VPU-ended windows may overlap the
next in gem5), the split approximation, typed attention.
Merge order: PTB #31 first (7ef12a0 accepts its Issue rows), then this,
then a PTB PYTORCHSIM_REF bump.
YWHyuk
force-pushed
the
tt-opt/core-serial
branch
from
October 8, 2026 13:50
92b44b7 to
6833335
Compare
student-Jungmin
pushed a commit
to PSAL-POSTECH/PyTorchSim-Triton-Backend
that referenced
this pull request
Nov 10, 2026
…verlap column deprecated PSAL-POSTECH/PyTorchSim#325 on top of 7ef12a0: a core issues a compute node only after its previous compute node finishes (gem5 runs one core's compute segments in order: a systolic pop waits for its row and the Minor core issues in order); DMA issue stays unserialized, by design. The overlap column the trace still carries is deprecated and ignored, matching the zero this repository writes since #31. systolic_array_split (round_robin, off by default) approximates N arrays per core from the unit table, and the --unit_table check counts array credit per node's N_eff. Checked on #31's traces (1 core tpuv6e): typed gemm 512 b512, 1024 b512, 1024 b1024 run to the end (11,419 / 58,346 / 57,339; with 7ef12a0 they exit on the unit-table check); the segment gemm set is unchanged (e.g. 2048 b1024 BK256 215,831); TOGSim/tests/core_serial passes 14/14.
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.
gem5 runs a core's computes serially: the Minor CPU issues in order and a
systolic pop waits for its result row (vcix examples/tpu/systolic.hpp:45),
so the last pop issues one cycle before the window ends. TOGSim let them
overlap three ways: the compiler's matmul overlap, two SA pipelines, and the
vu/xlu/sa pipelines side by side.
Core
flight (now < _compute_busy_until). The check comes first, so a held
compute takes nothing (spad, weight slot, SA round robin); the tile drops
its scan cursor (it keys on spad and weight slots only) and a ComputeFree
due at the finish re-arms the scan. cc==0 computes are exempt. The two
dispatches of a core share it; cores are independent.
overlap, as before.
no longer moves a finish (the pipeline-overlap branch is now a check that
the pipeline is free), no longer shrinks SA/VU/XLU active cycles as a
bubble, and no longer frees a weight slot early: the slot frees at finish.
A held compute waits only on computes already in flight, so a preload
cannot deadlock on its slot.
to read as a wedged simulation).
held compute once.
systolic_array_split: round_robin (default none; N is then ignored)
B = array rows / capacity, N_eff = min(N, max(1, ceil(rows / vpu_num_lanes)))
cc' = cc - B + max(B / N_eff, B_u of every other unit incl. Issue, Vpu), cc' <= cc
or its variant Msa, one per machine. That default is the only unit name in
TOGSim. Only that unit is split. Its credit is per array: each compute's
rows divided by THAT compute's N_eff, checked against one array's capacity
(periodic, end-of-run and multi-core Total checks), so a compute with
N_eff 1 that over-admits still fails, whatever N is.
systolic_array_unit without split. It needs vpu_num_lanes.
Pins: tests/core_serial/run_core_serial.sh, on a typed gemm 512 b512 trace
fixed from PTB 2b7aecb + overlap 0/Issue rows, and a hand-written XLU trace.
On 7ef12a0 / on this tree with the named piece reverted:
K1 --unit_table exit 1 -> 0 (11,419)
K2 serial, 2 dispatches 1 overlapping pair (matmul [1768,3357) vs preload [3065,3116)) -> 0
K2 xlu (XLU 150000 cycles) wedged (has_inflight) -> 0; also wedged with only the XLU check reverted
K2 xlu, 2 cores (300/100) 2 overlapping pairs -> 0
K4 the 2 cores still overlap fails with a busy-until shared by all cores
K3 split matmul 1589 -> 1077 = 1589 - 1024 + 512
K3 Vpu 700 (other-unit max) 1589 -> 1265; 1077 with the other units dropped from the max
K3 cc 1100 (rows/cc' > 1) 1100 -> 588; exit 1 without the per-array credit
K3 256 rows (N_eff 1) 1589 -> 1589 (guard)
K5 no array rows / unit w/o split exit 0 -> refused
K5 N=4, N_eff 1, 256 rows in cc 230 exit 0 when checked against capacity x N
(fixed N) -> refused (Systolic spread)
Measured, PTB 2b7aecb with its overlap-0/Issue-row change (PR #31), gem5
vcix-v0.3.0, tpuv6e. "before" = 7ef12a0 on the same overlap-0 traces:
typed gemm 512 b512 10,515 (UT exit 1) -> 11,419 exit 0
typed gemm 1024 b512 56,638 (UT exit 1) -> 58,346 exit 0
typed gemm 1024 b1024 39,802 (UT exit 1) -> 57,339 exit 0
segment set (8 gemms incl. 2048 b1024 BK256 215,831, BK128 351,964): unchanged,
their nodes were already serial on one VU pipeline. Typed vs segment
(11,649 / 58,840 / 57,607) is a consistency check, not a validation.
softmax typed 1589 -> 1589
gem5 k-loop vs TOGSim k-loop computes (sample trip x trips):
typed 512 b512 6,623 vs 6,704 (+1.2%); typed 1024 b1024 40,366 vs 41,768
(+3.5%); segment 2048 BK256 40,255 vs 41,752 (+3.7%). The gap is the
sample trip being 1-4% longer than a steady trip; the windows are back to back.
split N=2 (per-array util): typed 512 11,419 -> 9,999 (20.48%); segment 512
11,649 -> 10,037 (20.40%); typed 1024 b512 58,346 -> 54,681 (29.96%);
typed 1024 b1024 57,339 -> 39,767 (41.20%); segment 1024 b256 (N_eff 1)
111,291 unchanged (29.44%: one array busy); segment 2048 BK256 (30.43%)
215,831 -> 215,344: the load -> compute chain is the critical path; the
64 MEMORY_BAR completion times are identical in both runs, compute busy
169,228 -> 103,692 and compute idle 37,454 -> 100,942.
Unverified: nodes other than matmul (XLU/VPU-ended windows may overlap the
next in gem5), the split approximation, typed attention.
Merge order: PTB #31 first (7ef12a0 accepts its Issue rows), then this,
then a PTB PYTORCHSIM_REF bump.
Companion: PSAL-POSTECH/PyTorchSim-Triton-Backend#31 (overlap 0 + Issue row). Merge #31 first, then this, then the PTB PYTORCHSIM_REF bump. Do not merge before review.
🤖 Generated with Claude Code