Repository navigation
[Codegen] A reduction over rows too few for the lanes budgets its R0_BLOCK over every lane - #391
Merged
Merged
Conversation
Collaborator
|
Measured locally with the same blocks (lanes × per-lane budget, capped at 1M) on PTB main 83dc6b5, TOGSim tpuv6e with the XLU timing: sum 1.343 → 0.997 and max 1.320 → 1.115 (±20%: 20 → 31 and 19 → 30). Two costs to expect in the PTB report:
|
YWHyuk
force-pushed
the
reduction-on-lanes
branch
3 times, most recently
from
October 19, 2026 16:37
83c3a7d to
44dae30
Compare
YWHyuk
marked this pull request as ready for review
October 19, 2026 16:37
…BLOCK over every lane A full reduction (XBLOCK 1) took R0_BLOCK from one lane's budget, 8192 f32, while the compiler lays a reduction whose rows fill fewer lanes than the machine has with its reduced axis across the lanes (PTB anchorReduce: a fold since f951912 and #201, any reduction since #203): each lane then held 64 elements a trip, and sum and max walked 2048 trips of 16 KiB for 4096x4096 (#386). Such a reduction now takes R0_BLOCK from the budget of every lane over its rows, as pointwise_block and kept_axis_contiguous_blocks already do, covering the extent: 1M for 4096x4096, 16384 for 96x128, 16384 for softmax 8x16384. Rows that fill the lanes keep today's block.
YWHyuk
force-pushed
the
reduction-on-lanes
branch
from
October 19, 2026 16:41
44dae30 to
6b15aa0
Compare
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.
Fixes the R0_BLOCK side of #386.
Cause.
fixed_config_forsizes a reduction's R0_BLOCK against one lane's budget (reduction_block_for: spad / 2 / 12 → 8192 f32). When a reduction's rows fill fewer lanes than the machine has, the compiler lays its reduced axis across the lanes, so each lane held 64 elements a trip: sum 4096x4096 walked 2048 trips of 16 KiB, DMA-bound at ~667 GB/s (#386 comments).Change. Such a reduction — any kind — takes R0_BLOCK from every lane's budget over its rows (
tiling.lane_axis_reduction_block), the budgetpointwise_blockandkept_axis_contiguous_blocksalready use, covering the extent and capped at Triton's block limit. It reaches the pinned blocks and the persistence decision alike. Rows that fill the lanes keep today's block. No reduction-kind test is needed: the compiler lays every reduction's axis on the lanes in that case.Compiler side (all needed before the pin can carry this):
vmin.xlane, index and bf16 folds).The compiler pin (#392, PTB main d0553bd) has all three. With an older compiler a block the compiler cannot lay across the lanes is refused as over budget and the retry halves it (checked locally with a pre-fold compiler image: 1M → 65536).
Checked:
tests/system/test_reduction_tiling.py(the blocks for full, few-row and wide reductions). Measured on PTB: pending, after the pin.