Skip to content

[cutedsl] Prove traced tensor strides before issuing fragment row packets - #4755

Merged
choijon5 merged 6 commits into
mainfrom
choijon5/helion-b200/shared/7
Nov 28, 2026
Merged

choijon5 merged 6 commits into
mainfrom
choijon5/helion-b200/shared/7

Conversation

@choijon5

@choijon5 choijon5 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Stacked PRs:


[cutedsl] Prove traced tensor strides before issuing fragment row packets

A contiguous Inductor placeholder or a freshly aligned wrapper allocation
does not prove a bound input has the same strides. Require the compiler's
traced-stride proof before offering fragment packet loads or emitting row
packet loads and stores. Otherwise use scalar accesses. This supplements
the existing lexical start, exclusive end and step proof from #4666.

Testing: on current main, all nine CuTe CPU packet-stride tests passed.
The runtime-end case failed in isolation before its check followed the
stop value through the generated scalar assignments. Global input and
output packetization are checked independently, as before. Strict lint
and Pyrefly passed.

Prior validation: 46 packet-stride, index-domain and direct-store CuTe CPU cases.
On the earlier source before #4666 merged, all three index-domain B200 4
checks passed, including sentinel preservation at a shifted start and a
truncated end. The packet code for a full row and an aligned interior
window was unchanged. The lexical interval implementation is on main;
this PR's additional requirement is proof of the actual stride.

autoreview passed: claude, codex

@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 force-pushed the choijon5/helion-b200/shared/7 branch from 5a9e672 to 8d0f672 Compare November 26, 2026 16:22
@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/6 branch from da1d25a to 29e8749 Compare November 26, 2026 16:22
@choijon5
choijon5 marked this pull request as draft November 26, 2026 17:03
@choijon5
choijon5 changed the base branch from choijon5/helion-b200/shared/6 to main November 26, 2026 17:03
@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/7 branch from 8d0f672 to 58e98ff Compare November 26, 2026 17:03
@choijon5
choijon5 changed the base branch from main to choijon5/helion-b200/shared/6 November 26, 2026 17:04
@choijon5
choijon5 marked this pull request as ready for review November 26, 2026 17:04
…vice

A direct config for a B200 could validate against the current H100 even
while it recorded the B200's 148 SMs. Direct configuration under a
simulated CuTe target could also observe the host capability or only one
SM while a bound kernel correctly used the simulated facts.

Read the canonical capability from its module at query time. The
explicit-device hook delegates to the existing no-argument backend hook
by default; CuTe probes the requested device unless the existing hook was
overridden. Bound-kernel facts, including an explicit None, take priority.
A nonexistent visible CUDA ordinal gives an unknown capability. Detect it
on Torch's specific invalid-device assertion, then confirm it is out of
range: successful queries keep their cache fast path, and unrelated
driver or initialization errors still propagate.

Model both direct and bound SM counts in the target context. Hide the
indexed capability reader itself in the unavailable-CUDA fixture, so it
neither fills the process's real cache with None nor exposes a warm
entry; an outer modeled public probe remains authoritative.

A CUDA process using PyTorch's NVML-based check can regain visibility
before CUDA initializes. Return None for the unavailable probe without
caching it: the next request can read the device, and a successful
cached explicit lookup needs no further availability or property checks.

The flash and config tests that used the former private search-surface
probe now patch the canonical name; the redundant resource-test patch
is gone.

Testing: Scoped scripts/run_tests.py CPU configuration, helper and flash
lanes passed 548 (20 skipped) CuTe and 143 (7 skipped) stable CI Triton. Strict
lint and Pyrefly passed. The cold zero-to-one test previously returned
None twice; now no absent entry is cached, the restored ordinal gives
SM100, and no CUDA availability or property call is made on the next
hit. Current-H100/requested-B200 gives SM90/120 and SM100/148; explicit
None gives None/148. Class, subclass and plugin overrides, outer facts
and the one-visible-device invalid-ordinal controls are exercised.
The 25,987 full standalone CuTe CPU passes (567 skips) were on an earlier
revision; the current counts above refer to the scoped tests.

Integrated validation before changing the unavailable-cache miss to be
retried: full CuTe lanes passed 26,211 CPU and 16,138 GPU tests on B200
3/5; full Triton lanes passed 4,900 CPU and 3,395 GPU tests on B200 6;
Pallas interpreter passed 269 with 44 skipped. These runs include the
requested-device, unavailable-ordinal, legacy-hook and fixture fixes.

The final cache correction also passed the real zero-to-one transition
on B200 4 with PyTorch's NVML-based availability check. No CUDA context
was initialized while hidden; exposing the device then gave SM100/148
rather than a cached unknown. The separate real one-visible-device
control returned unknown for a missing ordinal and left the visible
target correct before and after a cold or warm simulated scope.

Review notes:
- Deferred: tensor-descriptor admission still uses the current device,
  including for a bound spec which already supplies the requested
  capability on upstream main. KNOWN_GAPS.md,
  tensor-descriptor-choices-use-the-current-gpu. Fixing only the search
  menu would leave lowering and epilogue decisions inconsistent across
  heterogeneous targets. Both configuration directions were reproduced;
  the single-B200 presets do not exercise that hardware mismatch.

autoreview passed: claude, codex

stack-info: PR: #4750, branch: choijon5/helion-b200/shared/2
…tion

A resumed review twice returned its unique completion marker followed by LGTM. The reviewer had been told that both the verdict and the transport marker must be the last line. Spell out which belongs to the review text and which finishes the entire message. Keep the result parser and its confirmation check unchanged; previously rejected reviews remain unconfirmed.

Testing: scripts/run_tests.py --backend triton --lane cpu --slow test/test_autoreview.py passed all 157 cases, including a verdict after the marker that must remain unconfirmed. Strict lint and Pyrefly passed. No GPU needed.

autoreview passed: claude, codex

stack-info: PR: #4751, branch: choijon5/helion-b200/shared/3
The kernel timer resizes a short profiling window using the first trace's
observed call period. A second window can still end before warmup if calls
arrive much faster. In the full Triton lane, both 15- and 113-call traces
parsed, but neither settled; the timer correctly returned infinity. A test
using CUDA sleeps and a wall-time threshold assumed it would always obtain
a reading.

Use the existing simulated device events to exercise the same timer,
flush learning, trace parsing and resize logic. Check that the second
window is larger and returns just the candidate's 7 us when calls settle,
and that it reports an unreadable window when they do not. Neighboring
tests still exercise real CUPTI traces and public do_bench. No timer
behavior or production timeout changes.

Testing: scripts/run_tests.py --backend triton,cute --lane cpu
test/test_benchmarking_batched_replay.py (10 passed on each backend);
strict scoped lint passed. No GPU required for this change.

autoreview passed: claude, codex

stack-info: PR: #4752, branch: choijon5/helion-b200/shared/4
The grouped seed test renders 120 or 140 complete CuTe programs in a
single pytest item for each input shape. Under concurrent CPU suites one
item lost its worker at the 180-second timeout, then passed alone in 71s.

Keep the existing three IDs for the seed-prefix, default, normalization
and geometry checks. Render the same first representative of each
worklist geometry and L2 swizzle in eight disjoint slices per shape.
The module-scoped fixture shares bindings on each worker without keeping
the target mocks active between tests; its yield keeps the original
input tensors alive during rendering. No scheduling code, timeout or
MN test tier changes.

Keep the shared offset and negative K-loop kernels and their argument and
config builders in helion._testing. Place the eight K-loop refusal cases
and the full P2 source journal in a CPU-only module. Preserve the three
original modules' GPU coverage and the P2 journal payload verbatim. P2 still skips an incomplete CuTe SDK.

Testing: the CuTe CPU lane passed 141 cases, including all 400 renders
and all nine relocated source checks with CUDA hidden. The Triton CPU
seed module passed 26 with one skip. Compared with main, 79 of the original 88
GPU-lane test IDs remain; the other nine now run on CPU. All eight
original journal entries were unchanged. An independent
inventory matched the 400 normalized render arguments (140, 140, 120)
and checked the input weakrefs after collection and at each render.
On the complete SDK the nine moved tests passed again, and P2 correctly
skipped a simulated installation without cutlass.cute. Strict lint and
Pyrefly passed. No GPU was allocated.

autoreview passed: claude, codex

stack-info: PR: #4753, branch: choijon5/helion-b200/shared/5
Select a cooperative launch when the final generated device body calls a
local grid barrier, including a call nested in control flow. The launch
descriptor and disk cache key distinguish those kernels. Other launches
keep their existing behavior.

Read local barrier calls from the generated body before outlining the two
cluster fallback alternatives. The launch attributes still describe the
actual device program when the entry body delegates to helpers.

Testing: on this commit, scripts/run_tests.py --backend cute --gpus 0
--slow test/test_barrier.py test/test_cute_min_blocks_carveout.py passed
13 CPU and 29 B200 GPU cases (one GPU skip). No standalone performance
claim is made for this launch change.

After integrating upstream #4739, the actual fallback cluster, its
standalone helper, and split-K GEMMs passed against PyTorch on B200 4.

autoreview passed: claude, codex

stack-info: PR: #4754, branch: choijon5/helion-b200/shared/6
@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/6 branch from aa1869e to ccc305c Compare November 28, 2026 04:14
…kets

A contiguous Inductor placeholder or a freshly aligned wrapper allocation
does not prove a bound input has the same strides. Require the compiler's
traced-stride proof before offering fragment packet loads or emitting row
packet loads and stores. Otherwise use scalar accesses. This supplements
the existing lexical start, exclusive end and step proof from #4666.

Testing: on current main, all nine CuTe CPU packet-stride tests passed.
The runtime-end case failed in isolation before its check followed the
stop value through the generated scalar assignments. Global input and
output packetization are checked independently, as before. Strict lint
and Pyrefly passed.

Prior validation: 46 packet-stride, index-domain and direct-store CuTe CPU cases.
On the earlier source before #4666 merged, all three index-domain B200 4
checks passed, including sentinel preservation at a shifted start and a
truncated end. The packet code for a full row and an aligned interior
window was unchanged. The lexical interval implementation is on main;
this PR's additional requirement is proof of the actual stride.

autoreview passed: claude, codex

stack-info: PR: #4755, branch: choijon5/helion-b200/shared/7
@choijon5
choijon5 marked this pull request as draft November 28, 2026 04:18
@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/7 branch from 58e98ff to 364b500 Compare November 28, 2026 04:18
@choijon5 choijon5 changed the title [cutedsl] Require complete aligned ranges for fragment packet loads and stores [cutedsl] Prove traced tensor strides before issuing fragment row packets Nov 28, 2026
@choijon5
choijon5 marked this pull request as ready for review November 28, 2026 04:18
@choijon5
choijon5 changed the base branch from choijon5/helion-b200/shared/6 to main November 28, 2026 04:50
@choijon5
choijon5 merged commit 379c13d into main Nov 28, 2026
20 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