Skip to content

[compiler] Enable interleaved CuTe barriers and preserve per-root L2 order - #4757

Merged
choijon5 merged 2 commits into
mainfrom
choijon5/helion-b200/shared/9
Nov 28, 2026
Merged

choijon5 merged 2 commits into
mainfrom
choijon5/helion-b200/shared/9

Conversation

@choijon5

@choijon5 choijon5 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Stacked PRs:


[compiler] Enable interleaved CuTe barriers and preserve per-root L2 order

CuTe can schedule an explicit local barrier or an inferred local barrier
pipeline with persistent_interleaved. Each worker starts on its own tile
in each phase. The blocked schedule remains available. Cross-rank barrier
restrictions are unchanged.

Use the grid root's own L2 grouping for its coordinates and mailbox.
Use the same group width, capped at the actual M extent, in the
scheduler and consumer before multiplying by the N extent. Keep
the running PID, grouped products and compound phase boundaries wide
where necessary. In the relative interleaved range from #4671, use the
same signed Int64 induction on CuTe for symbolic totals; the ordinary
Triton induction already has its required type. Neither count wrapping
nor a shifted start should drop live tiles. Symbolic persistent CuTe
grids may use more wide arithmetic; this change has no speedup claim.

Preserve the exact compiler-owned phase loop and guard when peeling
tails or estimating shared storage. Rebound names, mutated lists and
unknown bounds cannot justify moving a packet or bounding an allocation.
The callback check restricts prior behavior: a later proven scalar warp
callback still permits peeling, but a later opaque or effectful callback
now blocks it. Keep the compiler reference and its host test independent
of cached device capabilities.

Testing: after integrating #4671, 306 CuTe CPU cases passed (60 skipped).
The native persistent-kernel module passed on B200 3 CuTe (31 passed,
three skipped) and B200 6 Triton (32 passed, one skipped); both run the
real shared-program-ID kernel. The dynamic CuTe case verifies the
symbolic wide loop. The focused Triton CPU selection passed 85 cases (35
skips), and Pallas interpreter passed 272 (44 skips). Strict lint and
Pyrefly passed. CPU renders with an empty or reversed root preserve both
adjacent phases' live tiles via #4671's existing extent clamp.

All 50 splitter tests pass with the current PID test double, including
mailbox and early-release paths. The seven grouped role-local journals
were rechecked: three expected host wrappers include the signed grid
overflow check; the generated kernel bodies are unchanged.

With a requested L2 group of 2**62, both scheduler and consumer classify
all 400 tiles correctly at cluster widths 1 and 2. The focused CuTe CPU
run passed 25 cases with one skip.

The live-root step assertion checks the actual outer device loop and its
captured step/trap operands, independently of the induction name.

Batched full/edge classification and the mailbox decoder use the same
root-owned grouping, flattened axis order, and logical cluster-N after
split-K. An emitted non-square program with three batches visits all 60
tile pairs (48 full, 12 edges) at L2 groupings 1, 2 and 2**62. On the
merged base, 15 scheduler-geometry CPU cases passed. Numerical ragged
batched, split-K and cluster-fallback cases passed on B200 4.

autoreview passed: claude, codex

@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/9 branch from 6c17b08 to b915969 Compare November 26, 2026 16:22
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 26, 2026
@choijon5
choijon5 marked this pull request as draft November 26, 2026 17:03
@choijon5
choijon5 changed the base branch from choijon5/helion-b200/shared/8 to main November 26, 2026 17:03
@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/9 branch from b915969 to b79d1d1 Compare November 26, 2026 17:03
@choijon5
choijon5 changed the base branch from main to choijon5/helion-b200/shared/8 November 26, 2026 17:04
@choijon5
choijon5 marked this pull request as ready for review November 26, 2026 17:04
…windows

A negative scalar subscript counts from the end of its axis. Computed
fragments previously suppressed such a dynamic scalar or staged its
window at a different address than the ordinary walk. Widen the signed
scalar before adding the actual axis extent, preserving shifted tile
origins. Stage a slab or a vector packet only when its geometric and
source-level access bounds are established. Preserve operand widths for
runtime offsets, limits and comparisons. The simulator now rejects a
negative scratch index; selected tests use its existing Int32 hook to
model explicit narrowing, not arbitrary fixed-width arithmetic.

Compatibility: valid negative scalar subscripts now address elements from
the end on these computed-fragment paths, with or without an explicit
mask. For a global tensor access in a computed fragment, tensor indices still
check both bounds: a negative lane reads zero or skips its store, including
after Cartesian promotion or when staging a runtime window. Completed
CTA-local scratch retains its own indexing rules: an unmasked local load
can wrap a proved negative coordinate.
No public RefMode or Triton policy changes. A program that wants a wrapped
tensor row across backends must normalize it explicitly.

Testing: the rebased source passed 137 CuTe CPU tests (signed coordinates,
packet strides, index domains, transport/value codegen and the private-loop
and captured-index atomic selections) and 36 CuTe GPU tests on B200 4
(fragment index domains, vector I/O and the private-scalar-loop and
captured-index native atomic selections); zero failed. This includes
native Int16-row/Int32-column reads and writes with positive and negative
lanes, explicit normalization, live eager references, and both guards
around the output view. Checked source generated from a real shifted
window retains the runtime end through its actual output loop; a
large, disjoint expanded CPU input verifies pre-add widening in a slab
without allocating the large logical tensor. Scoped strict lint passed.

The checked scalar-grid case executes its complete generated fragment
and observes one write at each expected address (2, 6, 10, 14), with
values 3, 7, 11, 15. The shared address oracle is unchanged from main.
All 4×128 lane coordinates run, including the earlier shared stages.
A modulo-32 lane, later rebinding, and another lane-one write produced
16, 16 and 8 writes, respectively, and all were detected. This final
correction passed 107 CuTe CPU cases and strict lint.

The common slab axis remains runtime-guarded for both static and
dynamic partial widths. Both bindings at five columns and the aligned
six-column case with poisoned padding matched exactly, even with
vector loads requested. The varying slab union and vector eligibility
checks still apply. A common window starting at -1 can use checked scalar
loads under static and dynamic binding. A static window starting at -4
retains its predicated four-lane packet; the negative packet is untouched
and the packet at zero supplies columns 0..3. Negative varying windows
are still refused. All four shifted-window hosts match pristine main,
and all 43 signed-coordinate CPU cases passed. On B200 7 the signed
scalar and requested packet configurations passed all 16 launches (four
static/dynamic × -1/-4 bindings on two inputs): every output and both
canaries matched. Only the aligned static -4 case issued the x packet.
The native test skips cleanly when CUDA is unavailable.

Review notes:
- Cartesian promotion in RefMode does not grant Python-style wrapping in
  a device loop: true eager subscripts and explicit unmasked load/store
  clamp a negative read and drop its write. A physically padded, same-card
  comparison with pristine main confirms the computed-fragment zero/drop
  behavior retained here and raw offsets in ordinary Triton. Only explicit
  normalization gives the same wrap across these global access paths.

- The proposed unconditional lower bound on the common packet start would
  suppress a working packet on main. The first packet of an aligned -4
  window is wholly below zero and is masked to zero; the next packet
  begins at zero. Only aligned, complete packets within the upper bound
  are admitted. An unaligned start follows the checked scalar path.

autoreview passed: claude, codex

stack-info: PR: #4756, branch: choijon5/helion-b200/shared/8
…order

CuTe can schedule an explicit local barrier or an inferred local barrier
pipeline with persistent_interleaved. Each worker starts on its own tile
in each phase. The blocked schedule remains available. Cross-rank barrier
restrictions are unchanged.

Use the grid root's own L2 grouping for its coordinates and mailbox.
Use the same group width, capped at the actual M extent, in the
scheduler and consumer before multiplying by the N extent. Keep
the running PID, grouped products and compound phase boundaries wide
where necessary. In the relative interleaved range from #4671, use the
same signed Int64 induction on CuTe for symbolic totals; the ordinary
Triton induction already has its required type. Neither count wrapping
nor a shifted start should drop live tiles. Symbolic persistent CuTe
grids may use more wide arithmetic; this change has no speedup claim.

Preserve the exact compiler-owned phase loop and guard when peeling
tails or estimating shared storage. Rebound names, mutated lists and
unknown bounds cannot justify moving a packet or bounding an allocation.
The callback check restricts prior behavior: a later proven scalar warp
callback still permits peeling, but a later opaque or effectful callback
now blocks it. Keep the compiler reference and its host test independent
of cached device capabilities.

Testing: after integrating #4671, 306 CuTe CPU cases passed (60 skipped).
The native persistent-kernel module passed on B200 3 CuTe (31 passed,
three skipped) and B200 6 Triton (32 passed, one skipped); both run the
real shared-program-ID kernel. The dynamic CuTe case verifies the
symbolic wide loop. The focused Triton CPU selection passed 85 cases (35
skips), and Pallas interpreter passed 272 (44 skips). Strict lint and
Pyrefly passed. CPU renders with an empty or reversed root preserve both
adjacent phases' live tiles via #4671's existing extent clamp.

All 50 splitter tests pass with the current PID test double, including
mailbox and early-release paths. The seven grouped role-local journals
were rechecked: three expected host wrappers include the signed grid
overflow check; the generated kernel bodies are unchanged.

With a requested L2 group of 2**62, both scheduler and consumer classify
all 400 tiles correctly at cluster widths 1 and 2. The focused CuTe CPU
run passed 25 cases with one skip.

The live-root step assertion checks the actual outer device loop and its
captured step/trap operands, independently of the induction name.

Batched full/edge classification and the mailbox decoder use the same
root-owned grouping, flattened axis order, and logical cluster-N after
split-K. An emitted non-square program with three batches visits all 60
tile pairs (48 full, 12 edges) at L2 groupings 1, 2 and 2**62. On the
merged base, 15 scheduler-geometry CPU cases passed. Numerical ragged
batched, split-K and cluster-fallback cases passed on B200 4.

autoreview passed: claude, codex

stack-info: PR: #4757, branch: choijon5/helion-b200/shared/9
@choijon5
choijon5 marked this pull request as draft November 28, 2026 04:51
@choijon5
choijon5 changed the base branch from choijon5/helion-b200/shared/8 to main November 28, 2026 04:51
@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/9 branch from b79d1d1 to 26046d6 Compare November 28, 2026 04:51
@choijon5
choijon5 changed the base branch from main to choijon5/helion-b200/shared/8 November 28, 2026 04:51
@choijon5
choijon5 marked this pull request as ready for review November 28, 2026 04:51
@choijon5
choijon5 changed the base branch from choijon5/helion-b200/shared/8 to main November 28, 2026 05:32
@choijon5
choijon5 merged commit dddf513 into main Nov 28, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants