Repository navigation
[cutedsl] Preserve signed scalar indices and guard computed fragment windows - #4756
Merged
Merged
Conversation
choijon5
force-pushed
the
choijon5/helion-b200/shared/7
branch
from
November 26, 2026 16:22
5a9e672 to
8d0f672
Compare
choijon5
force-pushed
the
choijon5/helion-b200/shared/8
branch
from
November 26, 2026 16:22
f2f3395 to
6b69b3f
Compare
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/8
branch
from
November 26, 2026 17:03
6b69b3f to
d82a655
Compare
choijon5
marked this pull request as ready for review
November 26, 2026 17:04
jansel
approved these changes
Nov 27, 2026
choijon5
force-pushed
the
choijon5/helion-b200/shared/7
branch
from
November 28, 2026 04:18
58e98ff to
364b500
Compare
…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
choijon5
marked this pull request as draft
November 28, 2026 04:51
choijon5
force-pushed
the
choijon5/helion-b200/shared/8
branch
from
November 28, 2026 04:51
d82a655 to
46008ab
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 signed scalar indices and guard computed fragment 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