Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/196747
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 7327f75 with merge base 335414f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Collaborator
|
astra suggestion |
Contributor
Author
|
Option 2 looks to be more suitable, and significantly simpler -- switching to that approach and adding appropriate testing. |
ngimel
approved these changes
Sep 14, 2026
Collaborator
|
Starting merge as part of PR stack under #190899 |
pytorchmergebot
pushed a commit
that referenced
this pull request
Sep 14, 2026
Human Notes:
Necessary to make 3.10 builds not fail CI when AOT ops come in.
Note: We could change schema behavior to be consistent across 3.10 onwards, but
that feels like a much bigger risk than this..
Codex:
Installing CuTeDSL on Python 3.10 made the vendored QuACK import tests execute
there for the first time. QuACK's custom-op signatures use IntEnum defaults,
whose symbolic Python 3.10 string form produces invalid inferred dispatcher
schemas before any test body can run.
This is independent of native-AOT and its Python 3.10 support. Skip only the
QuACK import and operator-registration tests below Python 3.11; the patch-series
and vendoring reproducibility tests remain enabled. Normalizing IntEnum defaults
in torch.library would also make these imports work, but would change core
Python 3.10 behavior for an unrelated compatibility check.
Authored with assistance from an AI coding assistant.
Test Plan:
```
python - <<'PY'
import runpy
import sys
from unittest import mock
sys.path.pop(0)
import torch
with mock.patch.object(sys, "version_info", (3, 10)):
module = runpy.run_path("test/python_native/test_quack_vendor.py")
quack = module["TestQuackVendor"]
patches = module["TestQuackFlexGemmPatches"]
assert quack.__unittest_skip__
assert quack.__unittest_skip_why__ == "QuACK custom-op imports require Python 3.11 or newer"
assert not getattr(patches, "__unittest_skip__", False)
PY
```
Pull Request resolved: #196757
Approved by: https://github.com/ngimel
ghstack dependencies: #196747
pytorchmergebot
pushed a commit
that referenced
this pull request
Sep 14, 2026
…e2e tests (#190899) Human Notes: Finally do a thing! Add `topk` as an AOT-provided override in libtorch_cuda. Claude: Declares a 48-point grid (fp32/bf16 x N{2048..16384} x K{64,128,256} x both determinism modes) over the radix-select kernel. The det specialization (stable prefix-sum gather + lex (ord, -idx) sort) is bit-exact vs aten including tie resolution, so det-mode calls are served AOT too; the dispatch chain keys on deterministicAlgorithms(). The kernel gains in_dtype and index_dtype compile parameters; the AOT route writes int64 indices directly (no widening copy). build(spec) lives beside the JIT wrappers, so both routes compile the same class. fp16 and off-grid shapes keep their JIT eligibility, as do calls the prelude declines: a non-last dim, largest/sorted false, sub-full-wave M, or a base pointer less aligned than the kernels were compiled for. ARCHS is stated rather than defaulted, and covers Hopper as well as Blackwell: measured on an H100, the AOT kernels beat aten on 48/48 of the grid, median 2.16x (min 1.26x at M=4096/N=2048, max 2.99x at M=256/N=4096 fp32). Both spellings of each capability are listed -- archs_from_cuda_arch_list maps 9.0 and 9.0a to different nvcc targets, and a wheel built with the plain list would otherwise export trees generation then filters out. CI: a native_aot test config (test.sh) asserts the wheel actually embeds the kernels -- a silently artifact-free wheel would make every routing test vacuously pass on the JIT/aten fallbacks -- then runs the python_native suites. One build+test pair per capability in native-aot.yml: cuda-arch-list 9.0a tested on linux.aws.h100 and 10.0a on linux.dgx.b200, both built on a GPU-less builder (path-triggered + nightly). test_uncovered_fp32_served_by_jit_layer skips below sm_100, since the JIT topk override is gated there while these AOT kernels are not. This lands with the first op so the AOT path is exercised in CI from this commit onward. covered_axes() and cpp_covers() decline a dim other than the last, largest=False and sorted=False, matching the stub's gates. Coverage wider than the stub is not wrong -- the stub declines and stock aten serves -- but it costs those calls their JIT route, since coverage subtracts them from it (review: #190899). Authored with an AI assistant (Claude Code). Test Plan: ``` .venv/bin/python test/python_native/test_native_aot.py # incl. det-mode routing + bit-exact-with-ties tests # (test_deterministic_mode_routes_to_aot_bit_exact, # test_deterministic_ties_bit_exact) .venv/bin/python test/python_native/test_topk_radix_kernel.py .venv/bin/python test/python_native/test_topk_cutedsl.py ``` On an H100, against the kernels a `spin develop` embedded: ``` .venv/bin/python test/python_native/test_native_aot.py # 11 tests, 1 skipped .venv/bin/python test/python_native/test_aot_manifest.py # 18 tests .venv/bin/python test/python_native/test_registry.py # 35 tests ``` Pull Request resolved: #190899 Approved by: https://github.com/MatthiasKohl, https://github.com/ngimel ghstack dependencies: #196747, #196757
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.
Stack from ghstack (oldest at bottom):
Human Notes:
Fix the manywheel build issue on 3.10 that caused the revert of #190899
Codex:
The native-AOT verdict considers CPython 3.10 and 3.11 supported by the pinned
DSL wheels, but install_cutlass_dsl returned success without installing anything
below Python 3.12. Once the first declaration enabled stage 2, CUDA manywheel
therefore failed when it required the missing cutlass and tvm_ffi modules.
Remove the duplicate interpreter gate so stage 2 remains the single owner of
eligibility, and select the CUDA 13 extra so those builds install the matching
dialect runtime.
Once installation was enabled, Python 3.10 exposed a second issue in parallel
export. Affected CPython releases start the forkserver through python -c without
first applying the parent process's sys.path. The server therefore preloaded the
checkout's torch instead of the newly installed wheel, silently swallowed that
failed import, and forked workers with torch's one-import guard set.
Preload torch once on CPython releases containing the forkserver fix. On older
releases, disable only preloading so each worker imports torch after restoring
the parent's sys.path. This keeps direct exporter invocation correct as well as
the stage-2 path. Unrelated builder import failures are also reported as such
instead of being misdiagnosed as missing DSL runtimes.
Changing only the stage-2 working directory would leave direct invocation
broken. A custom preload helper could preserve copy-on-write imports on affected
Pythons, but adds an environment protocol and path rewriting for a startup
optimization. Version-gated preloading keeps the compatibility path smaller.
Skipping native-AOT below Python 3.12 would be smaller, but would unnecessarily
omit embedded kernels from supported wheels.
Authored with assistance from an AI coding assistant.
Test Plan: