Skip to content

[inductor][NVGEMM] Improve small-batch FP4 autotuning - #197484

Closed
mlazos wants to merge 1 commit into
gh/mlazos/318/basefrom
gh/mlazos/318/head
Closed

mlazos wants to merge 1 commit into
gh/mlazos/318/basefrom
gh/mlazos/318/head

Conversation

@mlazos

@mlazos mlazos commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Improve NVFP4 candidate selection and cold-weight measurement for decode-sized GEMMs at batch sizes 32 and 64.

Add shape-scoped narrow-N tile, cluster, and prefetch configurations that win across Qwen, Phi, Llama, and Nemotron projections while keeping wider shapes on the established policy. Extend cold-cache rotation to the relevant batch-32 regime and retain normal CUDA-graph autotuning as the final selector.

Test Plan:

python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemmHeuristics -v

lintrunner -a

Description drafted with an AI assistant.

Candidate scope

  • Batch 32: adds shape-scoped narrow-N cluster and prefetch variants for output-like projections.
  • Batch 64: adds 128x64 c1x1, prefetched 256x64 c2x2/c4x2, and a native 256x64 c2x2 candidate under narrow shape guards.
  • The normal CUDA-graph autotuner still chooses the winner; there is no per-model dispatch table.

The full TestNVUniversalGemmHeuristics suite passes (28 tests). Direct oracle measurements use Inductor's built-in CUDA-graph benchmarker with cold-weight rotation. End-to-end results for these candidates combined with PDL are reported in the dependent PR.

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 9 New Failures, 4 Cancelled Jobs, 2 Unrelated Failures, 1 Unclassified Failure

As of commit b851326 with merge base aebbfec (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:

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

@pytorch-bot

pytorch-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

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

@mlazos

mlazos commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

AI-Review

Automated multi-agent review (architecture, correctness, simplification, generalization, and GPT-5.6 final approval). This is AI-generated — please verify findings manually.


Verified Issues

  • [medium] Cached hot timings bypass the new M=32 cold-cache policy — Location: torch/_inductor/codegen/nv_universal_gemm/nv_universal_gemm.py:126,611; torch/_inductor/codecache.py:474. Trigger: Recompile an eligible M=32 NVFP4 CUDA-graph GEMM with cold caching enabled after identical choices were cached with it disabled. Failure sequence: The cache key includes input metadata and kernel identity but not nvgemm_autotune_cold_cache; the cache hit skips benchmarking and weight rotation, then selects using stale hot-cache timings. Impact: The new policy can retain the slower hot-cache winner for distinct-weight decode workloads. Reviewers: Generalization.

@mlazos mlazos closed this Sep 22, 2026
@github-actions
github-actions Bot deleted the gh/mlazos/318/head branch November 21, 2026 01:51
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.

1 participant