Repository navigation
[cutedsl] Preserve fragment ownership across masked updates - #4758
Merged
Merged
Conversation
choijon5
force-pushed
the
choijon5/helion-b200/shared/10
branch
from
November 26, 2026 16:22
68e9188 to
ee12ab6
Compare
choijon5
force-pushed
the
choijon5/helion-b200/shared/9
branch
from
November 26, 2026 16:22
6c17b08 to
b915969
Compare
This was referenced Nov 26, 2026
This was referenced Nov 26, 2026
choijon5
marked this pull request as draft
November 26, 2026 17:03
choijon5
force-pushed
the
choijon5/helion-b200/shared/10
branch
from
November 26, 2026 17:03
ee12ab6 to
b88ea2b
Compare
choijon5
marked this pull request as ready for review
November 26, 2026 17:04
jansel
approved these changes
Nov 27, 2026
…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
A masked update can retain lanes from the previous value. Propagate the selected branch's logical domain, preserve rank-one broadcast values, and select FP8 in a supported arithmetic type before converting back. Qualify scalar-indexed top-k widths without assuming a multi-root launch. Testing: at this commit the three CPU carry and broadcast regressions passed in the CuTe CPU-only module; test/test_cute_computed_fragment.py::test_fragment_fp8_select_in_a_partial_tile passed on B200 1. The tests check partial tiles and the values retained in unwritten lanes. autoreview passed: claude, codex stack-info: PR: #4758, branch: choijon5/helion-b200/shared/10
choijon5
marked this pull request as draft
November 28, 2026 04:51
choijon5
force-pushed
the
choijon5/helion-b200/shared/10
branch
from
November 28, 2026 04:51
b88ea2b to
b2bf5c1
Compare
choijon5
marked this pull request as ready for review
November 28, 2026 04:51
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.
Stacked PRs:
[cutedsl] Preserve fragment ownership across masked updates
A masked update can retain lanes from the previous value. Propagate the
selected branch's logical domain, preserve rank-one broadcast values, and
select FP8 in a supported arithmetic type before converting back. Qualify
scalar-indexed top-k widths without assuming a multi-root launch.
Testing: at this commit the three CPU carry and broadcast regressions
passed in the CuTe CPU-only module;
test/test_cute_computed_fragment.py::test_fragment_fp8_select_in_a_partial_tile
passed on B200 1. The tests check partial tiles and the values retained in
unwritten lanes.
autoreview passed: claude, codex