Skip to content

[python_native] Skip QuACK import tests on Python 3.10 - #196757

Closed
slayton58 wants to merge 3 commits into
gh/slayton58/174/basefrom
gh/slayton58/174/head
Closed

slayton58 wants to merge 3 commits into
gh/slayton58/174/basefrom
gh/slayton58/174/head

Conversation

@slayton58

@slayton58 slayton58 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

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

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/196757

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 8166326 with merge base 335414f (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
[ghstack-poisoned]
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #190899

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
@github-actions
github-actions Bot deleted the gh/slayton58/174/head branch November 19, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants