Skip to content

[autotuner] Match direct CuTe configuration facts to the requested device - #4750

Merged
choijon5 merged 1 commit into
mainfrom
choijon5/helion-b200/shared/2
Nov 28, 2026
Merged

choijon5 merged 1 commit into
mainfrom
choijon5/helion-b200/shared/2

Conversation

@choijon5

@choijon5 choijon5 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Stacked PRs:


[autotuner] Match direct CuTe configuration facts to the requested device

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

@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/2 branch from 055630d to adf97d7 Compare November 26, 2026 16:22
@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/1 branch from a0ca54e to 3d5fd78 Compare November 26, 2026 16:22
@choijon5
choijon5 marked this pull request as draft November 26, 2026 17:02
@choijon5
choijon5 changed the base branch from choijon5/helion-b200/shared/1 to main November 26, 2026 17:02
@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/2 branch from adf97d7 to 4bc12b8 Compare November 26, 2026 17:03
@choijon5
choijon5 changed the base branch from main to choijon5/helion-b200/shared/1 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
@choijon5
choijon5 marked this pull request as draft November 28, 2026 04:04
@choijon5
choijon5 changed the base branch from choijon5/helion-b200/shared/1 to main November 28, 2026 04:04
@choijon5
choijon5 force-pushed the choijon5/helion-b200/shared/2 branch from 4bc12b8 to c1896ed Compare November 28, 2026 04:04
@choijon5
choijon5 marked this pull request as ready for review November 28, 2026 04:04
@choijon5
choijon5 merged commit 71c11ae 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