Skip to content

[tpuv3-support] [Frontend] Block budgets are the machine's spad_budget, not half the scratchpad - #445

Closed
student-Jungmin wants to merge 1 commit into
pytorchsim-triton-backendfrom
spad-budget-tiling
Closed

student-Jungmin wants to merge 1 commit into
pytorchsim-triton-backendfrom
spad-budget-tiling

Conversation

@student-Jungmin

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

Copy link
Copy Markdown
Collaborator

Found while making PyTorchSim-Triton-Backend compile for TPU v3 (PSAL-POSTECH/PyTorchSim-Triton-Backend#343), whose scratchpad is 128 KB a lane against the v6e's 1024; independent of those PRs.

Change

reduction_block_for divided a lane's scratchpad by 2 and gemm_tile_candidates took half of it: the same fact the compiler states as Target.spad_budget (spad_size // spad_buffers, vpu_spad_buffers 2 when unsaid) and refuses a kernel over. Both now read the machine: reduction_block_for divides by CONFIG_MACHINE.spad_buffers, gemm_tile_candidates takes CONFIG_MACHINE.spad_budget a lane, times the lanes for the whole tile.

No change on the shipped machines, which state no vpu_spad_buffers: 2 is what they get, and every block and tile is the one before.

Checked (local, compiler at PSAL-POSTECH/PyTorchSim-Triton-Backend#343, target tpuv6e)

  • tests/system/test_reduction_tiling.py: all 7 pass, the new test_the_tile_budget_is_the_machine_s_spad_budget among them (a machine of four buffers halves the reduction block and leaves fewer GEMM tiles, each among those of two). On the old tiling.py the new case fails, its block 8192 too wide.
  • Not run: the model allowlist (scripts/ci/triton_route_passing.txt); CI runs it.

CI

Triton route (smoke gate + coverage sweep) fails with the same 7 tests as this PR's base, pytorchsim-triton-backend dd80d8c (run 40063855238): Gemma 2-2b and 7b, Mixtral, Yolo, CLIP, ConvNeXtV2 and test_compiler_failure, "6 allowlisted test(s) failed or left the route" on both. None is new with this change.

…scratchpad

reduction_block_for divided a lane's scratchpad by 2 and gemm_tile_candidates took half of
it, the same fact the compiler states as Target.spad_budget, spad_size over the machine's
vpu_spad_buffers (2 when unsaid), and refuses a kernel over. Both now read the machine:
reduction_block_for divides by CONFIG_MACHINE.spad_buffers, gemm_tile_candidates takes
CONFIG_MACHINE.spad_budget per lane and times the lanes for the whole tile.

No change on the shipped machines, which state no vpu_spad_buffers: 2 is what they get, and
every block and tile is the one before. test_reduction_tiling's new case pins it: a machine
of four buffers halves the reduction block and leaves fewer GEMM tiles, each among those of
two; on the old code the block stays 8192 too wide.
@student-Jungmin student-Jungmin changed the title [Frontend] Block budgets are the machine's spad_budget, not half the scratchpad [tpuv3-support] [Frontend] Block budgets are the machine's spad_budget, not half the scratchpad Oct 24, 2026
@student-Jungmin
student-Jungmin marked this pull request as ready for review October 24, 2026 08:53
@student-Jungmin

Copy link
Copy Markdown
Collaborator Author

Moved into the frontend refactor stack as #463 (part 8/9): the same change and test, onto pytorchsim/frontend/tiling.py, where the stack moved pytorchsim/codegen/tiling.py. Closing this one in favour of #463.

@YWHyuk
YWHyuk deleted the spad-budget-tiling branch October 27, 2026 07:47
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