Repository navigation
[TOGSim] Systolic queue size in every config, packed trace tensors, an optional (8,128) tiled DRAM layout - #322
Merged
Conversation
…the target carries it tpu_systolic_queue_entries: 256 is the vcix tpu model's own default, now written in each of the 24 systolic_ws configs, and CONFIG_MACHINE passes it on as systolic_queue_entries, a field pytorchsim-triton-backend's target requires: p08 streams a dot's subtiles against it. A config without the key now fails at CONFIG_MACHINE instead of compiling against a guessed queue. Checked: CONFIG_MACHINE gives 256 under the tpuv6e and tpuv3 functional-only configs.
The stub bases put argument i at (i+1) MiB whatever its size, so a 1024x1024 fp32 operand (4 MiB) ran into the next tensor and A, B and C of a 1024 or 2048 matmul shared DRAM rows they would not share on the machine, and a kernel with more than 16 tensors had no address for the rest. TOGSim now lays the tensors out in argument order, each start aligned to 16 KiB (XLA's program HBM alignment), from the byte sizes trace_tensors.txt lists beside trace.so, and stops when the file is absent. Both producers write it: pytorchsim-triton-backend's TOGSim device already does, and the frontend now writes it per launch from kernel.json, next to trace_shape.txt. Measured on PTB main's ABI 14 traces, 1 core tpuv6e, segment grouping: gemm 512^3 b512 11643 -> 11649, gemm 2048^3 b1024 351964 -> 351964. Without trace_tensors.txt the run exits 1 naming the file.
…only `trace_tensor_tile: [rows, cols]` (absent by default) has every DMA's requests address the tensor as stored in tiles of that many 4-byte elements, tiles row-major and row-major inside each; a tile keeps its bytes, so rows scale by 4/elem (bf16 (16,128), int8 (32,128)). The 2-D view is the last axis as columns and every leading axis folded into the rows, read from trace_tensor_shapes.txt beside trace.so, which both producers write: the PTB TOGSim device, and now the frontend per launch from kernel.json. An indirect DMA's addresses take the same map. Spike and the functional run keep every tensor row-major; only the requests a DMA sends DRAM move. A tiled tensor takes its padded footprint in the packed layout. The run stops when the key is set and the shapes file is absent, lists a different number of tensors than trace_tensors.txt, or names a zero dimension. Measured, 1 core tpuv6e (HBM3 1 KB rows), segment grouping, row-major -> tiled: gemm 512^3 b512 11649 -> 11627, gemm 2048^3 b512 522840 -> 682083. With 1 KB rows a row-major tile already fills its DRAM rows, so the layout stays off; it is a knob for asking what a tiled HBM would change. TOGSim/tests/tensor_tiling_check.sh pins the map: one 8x128 MOVIN of a 512x512 fp32 tensor is eight 512 B runs at a 2 KiB pitch row-major and one contiguous 4 KiB run tiled, and the footprint pads to whole tiles.
YWHyuk
force-pushed
the
tt-opt/systolic-util
branch
from
October 8, 2026 10:03
e18413e to
ceacbb5
Compare
YWHyuk
added a commit
to PSAL-POSTECH/PyTorchSim-Triton-Backend
that referenced
this pull request
Oct 8, 2026
…e, trace tensors packed PSAL-POSTECH/PyTorchSim#322 on top of 6ba6e62: the 24 systolic configs state tpu_systolic_queue_entries (which the target now requires), CONFIG_MACHINE carries it, TOGSim lays trace tensors back to back from trace_tensors.txt (which the TOGSim device already writes) and stops without it, and an optional (8,128) tiled DRAM layout reads trace_tensor_shapes.txt (which the previous commit writes). Checked: 05c2d47's tree is the ceacbb5 tree these commits were measured on; 9 matmul kernels PASS and the gemm --timing runs in 980ec96 come from a TOGSim built from it.
student-Jungmin
pushed a commit
to PSAL-POSTECH/PyTorchSim-Triton-Backend
that referenced
this pull request
Nov 10, 2026
…e, trace tensors packed PSAL-POSTECH/PyTorchSim#322 on top of 6ba6e62: the 24 systolic configs state tpu_systolic_queue_entries (which the target now requires), CONFIG_MACHINE carries it, TOGSim lays trace tensors back to back from trace_tensors.txt (which the TOGSim device already writes) and stops without it, and an optional (8,128) tiled DRAM layout reads trace_tensor_shapes.txt (which the previous commit writes). Checked: 05c2d47's tree is the ceacbb5 tree these commits were measured on; 9 matmul kernels PASS and the gemm --timing runs in 980ec96 come from a TOGSim built from it.
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.
Three commits on 6ba6e62 (#321):
[Frontend]all 24systolic_ws_*configs statetpu_systolic_queue_entries: 256(the vcix tpu model's own default) andCONFIG_MACHINEpasses it assystolic_queue_entries, a field pytorchsim-triton-backend's target now requires (p08 streams a dot's subtiles against it). A config without the key fails atCONFIG_MACHINE.trace_tensors.txtbeside trace.so; the run stops when it is absent. The 1 MiB stubs let a 4 MiB operand run into the next tensor and gave no address past 16 tensors. Both producers write the file: PTB's TOGSim device already did, and the frontend now writes it per launch from kernel.json.trace_tensor_tile: [8, 128](absent by default) times trace tensors as stored in (8,128) tiles (bf16 (16,128), int8 (32,128)), fromtrace_tensor_shapes.txt(written by both producers). Timing only; Spike stays row-major. A tiled tensor takes its padded footprint in the packed layout.TOGSim/tests/tensor_tiling_check.shpins the map.Measured with PTB #24 (main e417ef0 + 4), 1 core tpuv6e, segment grouping:
Follow-ups, not here: the vcix model's queue size still comes from its own machine config (default 256), not from the target; TOGSim does not stall a node on a unit's admission rate, so overlapping compute can exceed Systolic capacity and
--unit_tableexits (typed grouping).