Repository navigation
[executorch][cuda] Choose among a call's implementations by measuring them on the export GPU - #25277
Merged
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/25277
Note: Links to docs will display an error until the docs builds have been completed. ❌ 27 Pending, 2 Unclassified FailuresAs of commit 4a39817 with merge base fe24cf5 ( UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Gasoonjia
approved these changes
Nov 19, 2026
… them on the export GPU When both the regular lowering (Inductor) and a Triton replacement can run a call, a static shape-class predicate per family picks one. Such predicates are approximate off the GPU they were tuned on, and every family maintains its own. This diff adds measured routing for families that opt in (`ReplacementPlan.measure`), on by default (`measured_routing` compile spec). A worker process inside the backend's AOTI context compiles each opted-in call's legal implementations, Inductor's with the C++ wrapper (one that cannot run drops out), and times them with CUDA graphs. A replacement wins only if it is faster by `measured_routing_margin` (default 0.15) with its p90 below Inductor's p10. Deterministic outcomes are cached (`measured_routing_cache_dir`). Otherwise, including in a process that cannot load C++-wrapper modules (one warning per export), the static choice is taken. A worker that writes no result and no output for 30 minutes is killed as hung. No family opts in yet. Tests cover the decision protocol, the watchdog, availability and caching, the settings, the opt-in, a process that cannot measure, both lowering APIs, and a real export probed in the worker. This diff was authored with Claude Code. Differential Revision: [D130871444](https://our.internmc.facebook.com/intern/diff/D130871444/) **NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D130871444/)! ghstack-source-id: 477683767 Pull-Request: #25245
Gasoonjia
force-pushed
the
gh/Gasoonjia/128/orig
branch
from
November 19, 2026 06:57
a9db876 to
4a39817
Compare
This PR needs a
|
Gasoonjia
temporarily deployed
to
upload-benchmark-results
November 19, 2026 08:38 — with
GitHub Actions
Inactive
Gasoonjia
temporarily deployed
to
upload-benchmark-results
November 19, 2026 11:49 — with
GitHub Actions
Inactive
This was referenced Nov 20, 2026
Gasoonjia
added a commit
that referenced
this pull request
Nov 21, 2026
…rchcodec from voxtral (#25393) Fix the two ROCm gfx950 jobs that fail on every `main` run. ### `unittest-rocm-gfx950`: `ModuleNotFoundError: No module named 'pandas'` Every failing `main` run from `6b82a162e7` to `e7f6aefd09` has exactly one failure: `test_measured_routing.py::ProbeTest::test_real_measurements`. The last green run was `fe24cf5777`. **Why it errors instead of skipping.** - `ProbeTest.setUp` (added by #25277) imports `executorch.export.utils` before it calls `super().setUp()`. - That import pulls in `executorch.devtools` and then `devtools/inspector/_inspector.py`, which runs `import pandas`. - `test-rocm-aoti.sh` installs the minimal wheel (`EXECUTORCH_BUILD_MINIMAL=1`), which doesn't include pandas. - The base class `_PassTest.setUp` already skips without Triton on CUDA. That's why the other 162 tests in the file skip on ROCm, but `ProbeTest` imports before it reaches that skip. **Fix.** Call `super().setUp()` first, so `ProbeTest` skips on ROCm like the rest of the file. ### `unittest-rocm-gfx950`: flaky `SdpaCellStepAutotuneTest::test_compiled_pick_is_fastest_at_live_extents` The test asserts that the config the autotuner picked at compile time is within 1.10× of the fastest config, timed with CUDA-graph replays. It failed in 2 of the last 13 `main` runs (`c346379f06`, `cd12c4d02d`), both the same way: - At live extent 4650, the pick was `BLOCK_M=16, BLOCK_N=64, PACK_GQA=False` at about 119 µs. - The best was the same tile with `PACK_GQA=True` at about 71.7 µs, a 1.66× regret. **Cause: not confirmed.** It may be a real ROCm mis-pick: the compile-time scenarios run on ROCm too, so a default ROCm export of this SDPA can compile in the slower config. #25397 tracks two hypotheses: no CUDA-graph autotune timing on ROCm, and the compile-time scenarios timing an all-visible mask where this test times a sparse cell mask. **Fix.** Deselect this one test on ROCm, next to the `test_cuda_graph_timing.py` exclusion. The comment cites #25397, which tracks re-enabling it. ### `test-voxtral-realtime-rocm-gfx950`: `Could not load libtorchcodec` - `test-rocm-voxtral.sh` runs `conda install -c conda-forge ffmpeg` without a version. - Since Anaconda `main` published `ffmpeg-9.0.2` (2026-11-20 09:42Z), that resolves to FFmpeg 9. - The pinned `torchcodec==0.11.0` only loads FFmpeg 4–8. The log shows it trying `libavutil.so.56`–`.so.60` and finding none. - Before 09:42Z, the same unpinned install hung in conda's classic solver ("Solving environment"). Runs were cancelled at the 180-minute timeout every time, including #25284's. - No commit in this repo caused it: neither the script nor `rocm.yml` has changed since Oct 30. **Fix: drop torchcodec and FFmpeg here.** - Nothing in this job needs them. `run_rocm_e2e.sh` reads the clip with `wave`, and nothing under `examples/models/voxtral_realtime` imports torchcodec, `datasets` or `librosa`. - `librosa` goes too: nothing in the job imports it. - Their only user was the dataset fetch, and that dataset's rows are WAV bytes. The fetch now reads them with `Audio(decode=False)` and decodes with `soundfile`. - This fixes both the load error and the solver hang. Pinning `ffmpeg<9` would leave the hang. ### Test plan - **Audio fetch:** the new snippet ran locally in a fresh venv with `datasets==5.2.0` (CI's version), `soundfile`, and no torchcodec. It wrote a 16 kHz, mono, 16-bit, 30.0 s WAV, the format `run_rocm_e2e.sh`'s `wave` check expects. - **`ProbeTest.setUp`:** confirmed with `ast` that its first statement is now `super().setUp()`, and that `_PassTest.setUp` skips on `torch.version.hip`. - **Lint:** `black` 24.4.2 and `flake8` are clean, and `bash -n` passes on both scripts. - **CI on this PR:** I'll confirm both ROCm gfx950 jobs pass. I can't run them here, since that needs an MI350. **CI on 6549cb2:** `unittest-rocm-gfx950-rocm7.2` 719 passed, 163 skipped, 1 deselected, 0 failed, with `ProbeTest::test_real_measurements` SKIPPED. `test-voxtral-realtime-rocm-gfx950-rocm7.2` passed on MI350.
Gasoonjia
added a commit
that referenced
this pull request
Nov 21, 2026
…a timeout (#25392) Fix the two CUDA jobs that fail on every `main` run since the #25270–#25280 stack landed: `unittest-cuda (kernel)` and `test-models-cuda`. That stack landed between `fe24cf5777` (both jobs green, 2026-11-19 06:48Z) and `6b82a162e7` (both red, 07:26Z). Every `main` run since then has failed the same way, most recently `e7f6aefd09`. ### `unittest-cuda (kernel)`: 5 `test_conv_implicit_gemm` failures All 5 failures are `OutOfResources: shared memory, Required: 131072, Hardware limit: 101376`: - `test_every_config_of_every_schedule` - `test_split_k` - `test_transposed` - `test_weight_stream` - `test_winograd` **The config that doesn't fit.** I compiled every `implicit_gemm.CONFIGS` entry for sm_86. Only one is too large for the A10G's 99 KiB: - It's the `igemm_tc_packed` tile `(128, 128, 64)` with 8 warps and 3 stages, in FP32 (TF32). That needs (3 − 1) × (128×64 + 64×128) × 4 B = 128 KiB. - It was added in `_TC_PACKED_TILES` by #25272. - The same tile in FP16/BF16 needs 64 KiB. **Why only the test fails.** - `check(every_config=True)` forces each config through `force_conv_candidate` and launches the raw JIT kernel, which bypasses the autotuner. - Each of the 5 tests has an FP32 every-config subtest with at least 16 input channels, which adds the packed schedule. - In production, Triton's autotuner times an `OutOfResources` config as `inf`, and Inductor's precompile drops it. So exports never select it. **Fix: the test, not the kernel.** - The test now skips a config that raises `OutOfResources` and emits a warning. This follows the existing pattern in `test_int8_quantized_gemm.py`. - It still fails if no config of a schedule fits. - Shrinking the tile to 2 stages would also change the FP16/BF16 tile that was tuned for A100/H100. ### `test-models-cuda`: cancelled at its 90-minute timeout Before the stack, the job took 64–70 minutes; since then it has been cancelled at 90.2 minutes on 11 runs in a row. Almost all of the extra time is in the conv-heavy exports: | step | `fe24cf5777` (good) | `6b82a162e7` (first bad) | |---|---|---| | resnet18 export | 27.9 min | 39.5 min | | mv2 export | 9.7 min | 22.3 min | | mv3 export | 9.2 min | cancelled after 9.6 min | **Why it got slower.** - #25278 turned on measured routing for the conv family. - Measured routing (#25277, #25279) is on by default. - So every convolution in resnet18, mv2 and mv3 is now compiled and timed in a worker process on a cold cache, against both Inductor and `triton::convolution`. This is the expected cost of that feature, and the job's job is to cover it, so I'm keeping it and raising the timeout to 120 minutes. `unittest-cuda` already uses the same limit. The projected runtime is about 100 minutes. ### Test plan - **Shared memory:** compiled every `implicit_gemm.CONFIGS` entry for sm_86 offline (triton 3.9). Only the FP32 `igemm_tc_packed (128, 128, 64, 8, 3)` needs more than 101376 B. - **New test logic, run without a GPU (with mocks):** - one oversized config: the test passes and warns `igemm_tc_packed big: shared memory`; - every config oversized: the test fails with `no igemm_tc_packed config fits this device`; - any other exception still propagates. - **Lint:** `black` 24.4.2 and `flake8` are clean, and `cuda.yml` parses. - **CI on this PR:** I'll confirm that `unittest-cuda (kernel)` has no `test_conv_implicit_gemm` failures and that `test-models-cuda` finishes within the new limit.
This branch was previously deployed
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.
This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #25245 by @Gasoonjia
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/Gasoonjia/128/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/Gasoonjia/128/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/Gasoonjia/127/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/Gasoonjia/128/orig
Differential Revision: D130871444
@diff-train-skip-merge