Skip to content

Fix main CUDA CI: oversized conv configs in the test, test-models-cuda timeout - #25392

Merged
Gasoonjia merged 2 commits into
mainfrom
gasoonjia/fix-main-cuda-ci
Nov 21, 2026
Merged

Gasoonjia merged 2 commits into
mainfrom
gasoonjia/fix-main-cuda-ci

Conversation

@Gasoonjia

Copy link
Copy Markdown
Contributor

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:

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.

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.

…r test-models-cuda

- test_conv_implicit_gemm forces every config through the raw kernel, bypassing
  the autotuner. The FP32 igemm_tc_packed 128x128x64 x 3-stage tile needs
  128 KiB of shared memory, more than an A10G's 99 KiB, so five tests fail.
  Skip and warn on OutOfResources as the autotuner does, as
  test_int8_quantized_gemm does, and still fail if no config of a schedule fits.
- Measured conv routing times every convolution of resnet18, mv2 and mv3 at
  export, taking test-models-cuda from about 65 to about 100 minutes; give it
  the same 120 minutes as unittest-cuda.
@pytorch-bot

pytorch-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Pending, 1 Unrelated Failure, 3 Unclassified Failures

As of commit 84b3604 with merge base e9ddcda (image):

NEW FAILURE - The following job has failed:

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:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 20, 2026
@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@Gasoonjia

Copy link
Copy Markdown
Contributor Author

@claude review effort=max

@claude

claude Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Claude finished @Gasoonjia's task in 18m 56s —— View job


I found no blockers in this fix for main CUDA CI, but the new except OutOfResources in check() treats any config that doesn't fit the device as a warning, so a later shared-memory regression would pass CI with only a warning.

Detailed review

PR Review: #25392

Summary

The PR makes ImplicitGemmScheduleTest.check() skip, with a warning, any forced config that raises OutOfResources. It also raises the test-models-cuda timeout from 90 to 120 minutes.

  • Main problem: the skip covers every config, schedule and dtype, not just the one known tile.
  • Also: two smaller test problems, and a question about the timeout.
  • CI status: the CUDA jobs on this PR ("Test CUDA Builds") were still queued during this review, so neither fix has been confirmed on CI yet.

Code Quality

  • The skip also runs on the first-config path, where the new failure message is wrong (backends/cuda/tests/test_conv_implicit_gemm.py:209-225).
    • Most check() calls run only configs[:1]. If that config raises OutOfResources, the test now fails with 0 not greater than 0 : no igemm_tc_packed config fits this device, although only one config was tried.
    • The Required / Hardware limit detail goes to the warnings summary instead of the failure.
    • The message also leaves out the K order. candidates drops tap_major (:179), so both CONFIGS entries of igemm_ffma, igemm_tc and igemm_ffma_splitk give the same text.
    • Nothing hits this on the A10G today: the largest first tile needs about 72 KiB in FP32. Reordering a tile table, or a GPU with less shared memory, would hit it.
    • Fix: re-raise unless every_config is set, and put the K order and the skipped errors in the message. Fix this →

Infrastructure

  • The new limit accepts the cost of measured routing for all three conv models on every run, and its "about 100 minutes" is a projection (.github/workflows/cuda.yml:216-218).
    • mv3's runtime after the stack was never observed. By the PR's table, the cancelled run reached mv3 at about 80.6 minutes.
    • The job runs on every PR that touches backends/cuda, backends/aoti or extension/cuda (:202-210).
    • It only checks that each model exports and runs. It does not check which implementation was routed.
    • Option: one conv export is enough to exercise the measurement path.
      • The others could export with CompileSpec("measured_routing", b"OFF"), as backends/cuda/tests/routing_test_utils.py:15-19 does for tests that don't need the measurement.
      • That needs a flag in examples/cuda/scripts/export.py:132-137, which today adds only the method-name and cuda_include_ptx specs.
      • By the PR's numbers, the job would then finish under the old 90-minute limit.
    • This is a question for the author, not a blocker.

Testing

  • The except turns every OutOfResources into a warning, whatever the schedule, dtype or resource (backends/cuda/tests/test_conv_implicit_gemm.py:209-214).
    • That includes winograd_f4 and stream_ffma, added at :182-185. The only guard left (:225) is that one config per schedule ran.

    • A tile close to the limit: by the PR's own formula, FP32 igemm_tc_packed (128, 64, 64, 4, 3) (implicit_gemm.py:1133) needs (3 − 1) × (128×64 + 64×64) × 4 B = 98,304 B. That is 3 KiB under the A10G's 101,376 B.

    • Silent loss: a kernel or Triton change that adds a few KiB would push this tile, and possibly others, over the limit.

      • OSS CI runs this test only on the A10G (cuda.yml:529, :558), so it would stay green with a warning.
      • Meanwhile, sm_86/sm_89 GPUs (A10G, L4, RTX 30/40) would silently lose those tiles in production.
    • This PR's own run has the same blind spot. In the five failing subtests, nothing after the oversized tile has run on CI since the stack landed:

      • the last packed tile, (64, 32, 64, 4, 3);
      • the winograd_f4 and stream_ffma every-config sweeps, for example in test_winograd and test_weight_stream.

      A green run doesn't show that only (128, 128, 64, 8, 3) was skipped, so check the warnings summary.

    • Suggested fix: prune by shared memory in the kernel instead.

      • Add a dtype-aware early_config_prune to _KERNELS (implicit_gemm.py:1173-1176). weight_stream.py:72-90 already uses this pattern for a register limit.
      • Compare against triton.compiler.compiler.max_shared_mem. target_smem.py:50-55 already patches it for cross-arch exports.
      • The PR's reason for not changing the kernel only rules out shrinking the tile. A prune leaves the FP16/BF16 tile, and the FP32 tile on A100/H100, unchanged.
      • Exports on 99 KiB GPUs would also stop compiling a config that can never load. Per target_smem.py:38-40, the check only happens after each candidate is compiled.
      • check() could then loop over the pruned list and keep failing on any OutOfResources. Fix this →
    • Test-only alternative: keep the skip, but assert that the set of skipped configs is exactly the expected one.

  • The skipped tile now runs in no OSS test in any dtype, but exports can still pick it (backends/cuda/tests/test_conv_implicit_gemm.py:457-474).
    • All five every_config=True calls (:251, :402, :451, :513, :595) use FP32 tensors.
    • test_packed_tensor_cores, the only BF16 test of the packed schedule, runs only configs[:1].
    • So on the A10G, (128, 128, 64, 8, 3) never runs. The autotuner can still choose it there for FP16/BF16 convolutions, where it needs 64 KiB, and for FP32 on A100/H100.
    • Fix: add with self.subTest(every_config=True): self.check(x, w, b, (1, 1, 1), (1, 1, 1), (1, 1, 1), True) to test_packed_tensor_cores. That covers the tile in BF16 on the A10G. Fix this →

Specific Comments

  • backends/cuda/tests/test_conv_implicit_gemm.py:121-125: the check() docstring still says it runs every config. It should say that configs that don't fit the device are skipped with a warning.
  • .github/workflows/cuda.yml:216-217:
    • Measured routing caches results by call metadata (measured_routing.py:44), so it times each distinct convolution, not every one.
    • "About 100 minutes" is a projection. Replace it with the runtime this PR's run measures.
  • Commit fd0af39: the message body is a bullet list of changes, which CLAUDE.md asks commits to avoid.

Recommendation

Approve, once this PR's unittest-cuda (kernel) and test-models-cuda runs are green.

  • Nothing here should hold up unblocking main.
  • The first-config message is a small fix worth adding to this PR.
  • The prune and the BF16 subtest can come in a follow-up.
  • Whether to keep measured routing on for all three conv models is the author's call.

Review steps

  • Gather context (diff, changed files, CLAUDE.md, CONTRIBUTING.md)
  • Run three independent reviewers against .claude/skills/pr-review/review-checklist.md
  • Consolidate findings
  • Fact-check findings
  • Post final review

Only the FP32 igemm_tc_packed 128x128x64 x 3-stage tile is known to exceed an
A10G's shared memory, so check() skips just that tile, and only when it runs
every config; any other OutOfResources still fails, so a shared-memory
regression in another tile can't pass with only a warning.
@Gasoonjia

Copy link
Copy Markdown
Contributor Author

Addressed in the latest push:

  • The skip was too broad: agreed. check() now skips only the one tile known not to fit: igemm_tc_packed (128, 128, 64, 8, 3) in FP32, and only when running every config. That tile is listed in _OVERSIZED_FP32_TILES. Any other OutOfResources re-raises and fails the test, so a regression that pushed (128, 64, 64, 4, 3) (98,304 B) over the limit can't pass with only a warning. The first-config path also re-raises with Triton's own Required/Hardware limit message, so the assertGreater and its misleading message are gone. I checked against implicit_gemm.py: that is the only _TC_PACKED_TILES entry over 101,376 B in FP32. A GPU-free check also showed the same tile still raises in BF16, on the first-config path, and under another schedule.
  • Docstring: now says the oversized tile is skipped with a warning.
  • Kernel-side early_config_prune, and a BF16 every-config subtest for the packed schedule: good follow-ups. I'm keeping this PR to unblocking main.
  • test-models-cuda runtime: I'll replace the "about 100 minutes" in the comment with this PR's measured time once the run finishes. Turning off measured routing for two of the three conv models is a reasonable option, but it changes coverage, so it isn't for this PR.

@Gasoonjia

Copy link
Copy Markdown
Contributor Author

@claude review effort=max

@claude

claude Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Claude finished @Gasoonjia's task in 18m 30s —— View job


I found no blockers, but this PR's CUDA jobs test torch 2.14.0 while main now installs torch 2.15.0, so rebase before relying on them; the new skip in check() also needs a few small fixes.

Detailed review

PR Review: #25392

Summary

The PR narrows the OutOfResources skip in ImplicitGemmScheduleTest.check() to the FP32 igemm_tc_packed (128, 128, 64, 8, 3) tile in every-config runs, and raises the test-models-cuda timeout from 90 to 120 minutes.

  • Problems: five, all minor, and all three reviewers found each one:
    • this PR's CUDA jobs run an older torch than main;
    • the skip doesn't check the device or the resource;
    • check() keeps a dead counter, and the skip condition can raise KeyError;
    • the PR description still describes the first commit.
  • Not repeated here: the follow-ups the author deferred (kernel-side prune, BF16 every-config subtest, measured routing for fewer models).
  • CI status: unittest-cuda (kernel) and test-models-cuda for 84b3604 had not finished during this review.

Code Quality

  • checked is now dead code (backends/cuda/tests/test_conv_implicit_gemm.py:212, :238).
    • 84b3604 removed the assertGreater(checked, 0, …) that read it, but kept checked = 0 and checked += 1.
    • pyflakes counts += as a use, so lint won't catch it. The counter also suggests a "no config fits" check that no longer exists.
    • Fix: delete both lines.
  • The skip condition raises KeyError for stream_ffma configs (test_conv_implicit_gemm.py:78-86, :233).
    • The condition builds (schedule, _tile(config)) for whichever schedule raised. weight_stream.CONFIGS has only BLOCK_N, BLOCK_K and SPLIT (weight_stream.py:63-68), so _tile fails on kwargs["BLOCK_M"].
    • Trigger: any stream_ffma config that raises OutOfResources in an FP32 every-config run. For example, the test_weight_stream sweep (:533-535) forces all 18 stream configs, including the ones weight_stream._prune drops in production.
    • Effect: the test errors with KeyError: 'BLOCK_M', and Triton's Required / Hardware limit message only shows up as the chained exception. Keeping that message was the point of 84b3604.
    • _tile is also a one-expression, single-use helper, which CLAUDE.md asks to avoid.
    • Fix: test schedule == "igemm_tc_packed" first and inline the tile tuple, which removes _tile. Fix this →
  • The PR description, and fd0af39's message, still describe the first commit.
    • "The test now skips a config that raises OutOfResources": now only the allowlisted tile is skipped.
    • "This follows the existing pattern in test_int8_quantized_gemm.py": that test skips any OutOfResources and asserts checked > 0 (test_int8_quantized_gemm.py:469-483). This test now does neither.
    • "It still fails if no config of a schedule fits": that assert was removed.
    • Test plan: the mocked results (the igemm_tc_packed big: shared memory warning and the no igemm_tc_packed config fits this device failure) come from fd0af39's logic. That failure message no longer exists, and a config named big would now re-raise.
    • fd0af39's message repeats "as test_int8_quantized_gemm does, and still fail if no config of a schedule fits".
    • Fix: update the description before merging.

Infrastructure

  • This PR's CUDA jobs test torch 2.14.0, but main now installs torch 2.15.0 (.github/workflows/cuda.yml:216-218).
    • Why:
      • On pull_request, test-models-cuda and unittest-cuda check out github.event.pull_request.head.sha (:223, :533), not a merge with main.
      • This branch's base, e9ddcda, installs torch==2.14.0 for these cu132 jobs.
      • main has since moved to TORCH_VERSION = "2.15.0" and triton 3.9, in Use torch 2.15.0 for every CUDA train #25284 (e1390b6).
    • Consequences:
      • The kernel-test confirmation this PR is waiting for comes from torch 2.14.0's Triton, not the triton 3.9 that main now runs.
      • Any winograd_f4 and stream_ffma every-config sweeps in the five red subtests have not run on CI since the stack landed, because check() stopped at the packed tile. Their first run is this PR's, on the old torch. The offline triton 3.9 compile covered only implicit_gemm.CONFIGS.
      • The measured runtime that will replace "about 100 minutes" in the :216-217 comment, and so the headroom under 120 minutes, would also come from torch 2.14.0.
    • Fix: rebase onto main before relying on these runs. Of the files this PR touches, main has changed only cuda.yml:630-633 since e9ddcda, so the rebase is clean.

Testing

  • The allowlisted tile is skipped for any OutOfResources on any GPU (test_conv_implicit_gemm.py:226-235).
    • The condition matches schedule, tile, dtype and every_config. It does not check the resource (e.name) or the device limit (e.limit), both of which Triton's message prints (shared memory, Required: 131072, Hardware limit: 101376).
    • Triggers:
      • On an A100 or H100, where the tile fits, a regression that makes it run out of shared memory passes with only a warning.
      • On any GPU, a threads OutOfResources for this tile is also swallowed.
    • Nothing enforces the comment's rationale ("in FP32 it needs 128 KiB, and an A10G has 99 KiB").
    • Fix: also require e.name == "shared memory" and e.limit < 128 * 1024. Fix this →

Specific Comments

  • test_conv_implicit_gemm.py:227-229: repeats the 128 KiB / 99 KiB facts from :73-74. "Only this tile" reads oddly next to a set.
  • test_conv_implicit_gemm.py:141-142: the docstring doesn't say that the skip applies only in FP32.

Recommendation

Approve, after a rebase onto main and green unittest-cuda (kernel) and test-models-cuda runs.

  • Without the rebase, a green run here doesn't show that main will be green.
  • The other four fixes are small and worth making before merge.

Review steps

  • Gather context (diff, both commits, CLAUDE.md, CONTRIBUTING.md, what main changed since the PR's base)
  • Run three independent reviewers against .claude/skills/pr-review/review-checklist.md
  • Consolidate findings
  • Fact-check findings
  • Post final review

@Gasoonjia
Gasoonjia deployed to upload-benchmark-results November 21, 2026 01:22 — with GitHub Actions Active
@Gasoonjia
Gasoonjia merged commit 9f49fe2 into main Nov 21, 2026
@Gasoonjia
Gasoonjia deleted the gasoonjia/fix-main-cuda-ci branch November 21, 2026 02:07
@Gasoonjia

Copy link
Copy Markdown
Contributor Author

Merged. CI on 84b3604:

  • unittest-cuda (kernel): 330 passed, 4 skipped, 0 failed, in 108.9 min.
    • test_conv_implicit_gemm: 24 passed, 0 failed.
    • The only OutOfResources warning is for igemm_tc_packed (128, 128, 64, 8, 3), the allowlisted FP32 tile, so no other tile hit the limit.
    • test_chunk_gated_delta_rule: 5 passed.
  • test-models-cuda: passed in 104.8 min, against the new 120-minute limit. That's in line with the projected ~100 minutes and leaves about 15 minutes of headroom.

The other failures on this PR come from its base predating #25284 and #25393. Those are already fixed on main, and the branch merged into main without conflicts:

build-qnn-windows-x64 failed unpacking the QNN SDK zip (a flake that also hits main).

This branch was successfully deployed

1 active and 1 inactive deployments
upload-benchmark-results — 84b3604b Deployed Nov 21, 2026 by Gasoonjia
cadence — 84b3604b Deployed Nov 20, 2026 by Gasoonjia
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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants