Skip to content

[inductor][NVGEMM] Add grouped epilogue parity coverage - #190825

Closed
mlazos wants to merge 63 commits into
gh/mlazos/277/basefrom
gh/mlazos/277/head
Closed

mlazos wants to merge 63 commits into
gh/mlazos/277/basefrom
gh/mlazos/277/head

Conversation

@mlazos

@mlazos mlazos commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Add focused parity coverage for generated CuTeDSL callbacks across dense and
block-scaled grouped reductions. The tests cover both reduction axes,
primitive and pointwise-transformed sources, multiple reductions in one
epilogue, reduction consumers, and finalization after cross-warp combination.

Keep the transposed output layout explicit when NVGEMM swaps the GEMM operands.
Let FlexGEMM request the broader tuned NVGEMM configuration while rejecting
unsupported NVGEMM options.

Test Plan

PYTHONPATH=/data/users/mlazos/pytorch/agent_space/runtime_overlay PYTORCH_BOUNDARY_ROOT=$PWD python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemmHeuristics -v
PYTHONPATH=/data/users/mlazos/pytorch/agent_space/runtime_overlay PYTORCH_BOUNDARY_ROOT=$PWD python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemmEpilogueFusion.test_bf16_grouped_m_reduce_finalizes_after_cross_warp_combine TestNVUniversalGemmEpilogueFusion.test_bf16_grouped_n_composite_reduction_fusion TestNVUniversalGemmEpilogueFusion.test_scaled_mm_grouped_n_composite_reduction_fusion TestNVUniversalGemmEpilogueFusion.test_scaled_mm_grouped_m_reduce_finalizes_after_cross_warp_combine -v
PYTHONPATH=/data/users/mlazos/pytorch/agent_space/runtime_overlay PYTORCH_BOUNDARY_ROOT=$PWD python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemmEpilogueFusion.test_bf16_grouped_reduce_epilogue_fusion_axis_1_group_4_sum TestNVUniversalGemmEpilogueFusion.test_bf16_grouped_reduce_epilogue_fusion_axis_0_group_64_abs_amax TestNVUniversalGemmEpilogueFusion.test_flex_gemm_grouped_n_reduce_epilogue_fusion_feeds_main_True -v
lintrunner -a

Description drafted with an AI assistant.

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 08eba27 with merge base 3ee461f (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

This was referenced Jul 22, 2026
mlazos added a commit that referenced this pull request Jul 22, 2026
Cover dense and block-scaled grouped reductions, auxiliary and feed-main
outputs, shared and chained callbacks, dynamic and transposed layouts,
heterogeneous tuple outputs, fallback behavior, and FlexGEMM adapters. The
matrix captures the supported Quack-compatible graph contracts and provider
geometry boundaries.

Test Plan:

```bash
TORCHINDUCTOR_COMPILE_THREADS=1 python test/inductor/test_nv_universal_gemm.py -k bf16_grouped -v
TORCHINDUCTOR_COMPILE_THREADS=1 python test/inductor/test_nv_universal_gemm.py -k flex_gemm_ -v
lintrunner -a
```

The grouped suite passed 73 tests and the FlexGEMM suite passed 13 tests from
fresh caches.

Authored with an AI assistant.


ghstack-source-id: 281b030
Pull-Request: #190825
[ghstack-poisoned]
mlazos added a commit that referenced this pull request Jul 23, 2026
Cover dense and block-scaled grouped reductions, auxiliary and feed-main
outputs, shared and chained callbacks, dynamic and transposed layouts,
heterogeneous tuple outputs, fallback behavior, and FlexGEMM adapters. The
matrix captures the supported Quack-compatible graph contracts and provider
geometry boundaries.

Test Plan:

```bash
TORCHINDUCTOR_COMPILE_THREADS=1 python test/inductor/test_nv_universal_gemm.py -k bf16_grouped -v
TORCHINDUCTOR_COMPILE_THREADS=1 python test/inductor/test_nv_universal_gemm.py -k flex_gemm_ -v
lintrunner -a
```

The grouped suite passed 73 tests and the FlexGEMM suite passed 13 tests from
fresh caches.

Authored with an AI assistant.


ghstack-source-id: 2b247e1
Pull-Request: #190825
[ghstack-poisoned]
[ghstack-poisoned]
mlazos added 2 commits August 28, 2026 14:08
[ghstack-poisoned]
[ghstack-poisoned]
mlazos added 2 commits August 28, 2026 19:08
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request Sep 1, 2026
<human note needed>

> Define a shared representation for grouped GEMM reductions and use it as the
> boundary between epilogue analysis and backend-specific code generation.
>
> ## Shared reduction representation
>
> `GemmReductionGeometry` describes which logical GEMM output axis is reduced
> and how many adjacent elements belong to each group. It also determines
> whether the reduction fits inside one TensorSSA fragment or requires physical
> cross-thread combination.
>
> `GemmReductionPlan` carries the complete semantic contract:
>
> - the grouped reduction geometry;
> - the associative primitive, such as sum, product, minimum, or maximum;
> - generated source, combine, finalize, and consumer callbacks;
> - the primary and auxiliary output buffers;
> - whether the reduction feeds the primary GEMM output; and
> - whether the generated tensor epilogue returns a fragment-local reduction.
>
> This separates the mathematical operation from the physical reduction
> mechanism. Backends implement fragment traversal, synchronization, and
> storage, while generated callbacks describe the computation applied at each
> stage.
>
> ## Loop IR analysis
>
> Extend the Loop IR analysis to recognize both explicit reduction nodes and
> reductions expressed as unrolled pointwise operations. For an unrolled
> reduction, the analysis:
>
> 1. Finds the repeated loads from the GEMM output.
> 2. Uses their index ranges and strides to infer the group size and M/N axis.
> 3. Verifies that every lane applies the same pointwise source expression.
> 4. Identifies the associative primitive.
> 5. Preserves the source expression for later CuTeDSL callback generation.
>
> For example, an expression equivalent to:
>
> ```python
> grouped = output.float().view(m, n // 4, 4)
> reduced = torch.exp(grouped).sum(dim=-1)
> ```
>
> is represented as an N-axis group-of-four sum whose source expression is
> `exp(value)`.
>
> ## FlexGEMM integration
>
> Replace FlexGEMM's parallel template-time reduction description with a wrapper
> around `GemmReductionPlan`. The FlexGEMM wrapper retains only provider-specific
> information: the auxiliary-output index, output layout, and operand-swap
> state.
>
> FlexGEMM lowering now passes `epilogue_analysis.reduction_plan` directly into
> that wrapper. The shared geometry also owns the fragment-width and
> physical-callback decision previously implemented by a FlexGEMM-specific
> helper.
>
> This gives FlexGEMM and NVGEMM the same semantic reduction plan while allowing
> each provider to retain its own runtime ABI and code-generation machinery.
>
> ## Relationship between FlexGEMM and NVGEMM
>
> Both backends use the same semantic reduction plan, while retaining their
> existing analysis and runtime interfaces:
>
> ```mermaid
> flowchart LR
>     FX["FlexGEMM FX epilogue"] --> FXA["GemmLocalReduceAnalysis"]
>     LOOP["NVGEMM scheduler Loop IR"] --> LIA["GemmEpilogueIRAnalysis"]
>
>     FXA --> PLAN["GemmReductionPlan<br/>geometry, primitive, callbacks, outputs"]
>     LIA --> CFG["GemmReductionConfig"]
>     CFG --> PLAN
>
>     PLAN --> FLEXCFG["FlexGemmEpilogueLocalReduceConfig<br/>plan + output index + layout + swap_ab"]
>     FLEXCFG --> FLEXRT["FlexGemmRuntimeLocalReducePlan"]
>     FLEXRT --> QUACK["FlexGEMM / QuACK"]
>
>     PLAN --> NVCAP["NVGEMM capability validation"]
>     NVCAP --> NVARGS["GemmReductionArguments"]
>     NVARGS --> NVKERNEL["Vendored NVGEMM kernel"]
> ```
>
> `GemmReductionPlan` is the shared semantic boundary. FlexGEMM adds only the
> output placement and layout information needed by its template, while NVGEMM
> binds the plan to runtime tensors and cache-specialization fields.
>
> ## Testing
>
> Unit coverage for the shared reduction plan and FlexGEMM adapter is included
> in this PR.
>
> End-to-end dense and block-scaled generated-epilogue coverage is provided by
> [#190825](#190825).
>
> ```bash
> lintrunner -a
> ```
>
> Description drafted with an AI assistant.

Pull Request resolved: #195231
Approved by: https://github.com/drisspg
ghstack dependencies: #194792, #194793, #190821
[ghstack-poisoned]
orrangetabby17 pushed a commit to orrangetabby17/pytorch that referenced this pull request Sep 2, 2026
…h#195231)

<human note needed>

> Define a shared representation for grouped GEMM reductions and use it as the
> boundary between epilogue analysis and backend-specific code generation.
>
> ## Shared reduction representation
>
> `GemmReductionGeometry` describes which logical GEMM output axis is reduced
> and how many adjacent elements belong to each group. It also determines
> whether the reduction fits inside one TensorSSA fragment or requires physical
> cross-thread combination.
>
> `GemmReductionPlan` carries the complete semantic contract:
>
> - the grouped reduction geometry;
> - the associative primitive, such as sum, product, minimum, or maximum;
> - generated source, combine, finalize, and consumer callbacks;
> - the primary and auxiliary output buffers;
> - whether the reduction feeds the primary GEMM output; and
> - whether the generated tensor epilogue returns a fragment-local reduction.
>
> This separates the mathematical operation from the physical reduction
> mechanism. Backends implement fragment traversal, synchronization, and
> storage, while generated callbacks describe the computation applied at each
> stage.
>
> ## Loop IR analysis
>
> Extend the Loop IR analysis to recognize both explicit reduction nodes and
> reductions expressed as unrolled pointwise operations. For an unrolled
> reduction, the analysis:
>
> 1. Finds the repeated loads from the GEMM output.
> 2. Uses their index ranges and strides to infer the group size and M/N axis.
> 3. Verifies that every lane applies the same pointwise source expression.
> 4. Identifies the associative primitive.
> 5. Preserves the source expression for later CuTeDSL callback generation.
>
> For example, an expression equivalent to:
>
> ```python
> grouped = output.float().view(m, n // 4, 4)
> reduced = torch.exp(grouped).sum(dim=-1)
> ```
>
> is represented as an N-axis group-of-four sum whose source expression is
> `exp(value)`.
>
> ## FlexGEMM integration
>
> Replace FlexGEMM's parallel template-time reduction description with a wrapper
> around `GemmReductionPlan`. The FlexGEMM wrapper retains only provider-specific
> information: the auxiliary-output index, output layout, and operand-swap
> state.
>
> FlexGEMM lowering now passes `epilogue_analysis.reduction_plan` directly into
> that wrapper. The shared geometry also owns the fragment-width and
> physical-callback decision previously implemented by a FlexGEMM-specific
> helper.
>
> This gives FlexGEMM and NVGEMM the same semantic reduction plan while allowing
> each provider to retain its own runtime ABI and code-generation machinery.
>
> ## Relationship between FlexGEMM and NVGEMM
>
> Both backends use the same semantic reduction plan, while retaining their
> existing analysis and runtime interfaces:
>
> ```mermaid
> flowchart LR
>     FX["FlexGEMM FX epilogue"] --> FXA["GemmLocalReduceAnalysis"]
>     LOOP["NVGEMM scheduler Loop IR"] --> LIA["GemmEpilogueIRAnalysis"]
>
>     FXA --> PLAN["GemmReductionPlan<br/>geometry, primitive, callbacks, outputs"]
>     LIA --> CFG["GemmReductionConfig"]
>     CFG --> PLAN
>
>     PLAN --> FLEXCFG["FlexGemmEpilogueLocalReduceConfig<br/>plan + output index + layout + swap_ab"]
>     FLEXCFG --> FLEXRT["FlexGemmRuntimeLocalReducePlan"]
>     FLEXRT --> QUACK["FlexGEMM / QuACK"]
>
>     PLAN --> NVCAP["NVGEMM capability validation"]
>     NVCAP --> NVARGS["GemmReductionArguments"]
>     NVARGS --> NVKERNEL["Vendored NVGEMM kernel"]
> ```
>
> `GemmReductionPlan` is the shared semantic boundary. FlexGEMM adds only the
> output placement and layout information needed by its template, while NVGEMM
> binds the plan to runtime tensors and cache-specialization fields.
>
> ## Testing
>
> Unit coverage for the shared reduction plan and FlexGEMM adapter is included
> in this PR.
>
> End-to-end dense and block-scaled generated-epilogue coverage is provided by
> [pytorch#190825](pytorch#190825).
>
> ```bash
> lintrunner -a
> ```
>
> Description drafted with an AI assistant.

Pull Request resolved: pytorch#195231
Approved by: https://github.com/drisspg
ghstack dependencies: pytorch#194792, pytorch#194793, pytorch#190821
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #192928

1 similar comment
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #192928

pytorchmergebot pushed a commit that referenced this pull request Sep 2, 2026
doesn't run hese tests in fbcode until we add operator API internally

> This skips two low-level tests only in fbcode because fbcode does not include
> the optional CUTLASS package those tests use to construct and run kernel
> objects directly. The tests fail while importing or creating the operator,
> before they exercise the NVGEMM behavior they are intended to check.
>
> The tests still run in the open-source build, and the higher-level
> `torch.compile` tests remain enabled in fbcode.
>
> ## Architecture
>
> This is a test-only environment boundary. The two tests that directly import
> the optional CUTLASS Operator API are skipped individually when `IS_FBCODE` is
> true. No production lowering, provider registration, or generated-kernel
> behavior changes. The tests continue running in open source, while fbcode
> retains the higher-level compiler coverage.
>
> ## Example
>
> The affected tests directly compile a grouped-reduction provider and a
> unit-dimension epilogue on a non-current CUDA stream. In fbcode, the required
> operator-construction API is absent, so skipping those two tests avoids
> reporting an environment limitation as an NVGEMM correctness failure.
>
>
> ```python
> @unittest.skipIf(
>     IS_FBCODE,
>     "CUTLASS Operator API is not available in fbcode",
> )
> def test_scaled_gemm_grouped_n_reduce_provider(self):
>     ...
> ```
>
> ## Test Plan
>
> ```bash
> PYTORCH_TEST_FBCODE=1 python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemm.test_scaled_gemm_grouped_n_reduce_provider TestNVUniversalGemm.test_scaled_gemm_unit_dim_epilogue_non_current_stream -v
> python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemm.test_scaled_gemm_grouped_n_reduce_provider TestNVUniversalGemm.test_scaled_gemm_unit_dim_epilogue_non_current_stream -v
> lintrunner -a
> ```
>
> Description drafted with an AI assistant.

Pull Request resolved: #192928
Approved by: https://github.com/karthickai
ghstack dependencies: #192298, #190822, #191514, #191515, #190825
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
…h#195231)

<human note needed>

> Define a shared representation for grouped GEMM reductions and use it as the
> boundary between epilogue analysis and backend-specific code generation.
>
> ## Shared reduction representation
>
> `GemmReductionGeometry` describes which logical GEMM output axis is reduced
> and how many adjacent elements belong to each group. It also determines
> whether the reduction fits inside one TensorSSA fragment or requires physical
> cross-thread combination.
>
> `GemmReductionPlan` carries the complete semantic contract:
>
> - the grouped reduction geometry;
> - the associative primitive, such as sum, product, minimum, or maximum;
> - generated source, combine, finalize, and consumer callbacks;
> - the primary and auxiliary output buffers;
> - whether the reduction feeds the primary GEMM output; and
> - whether the generated tensor epilogue returns a fragment-local reduction.
>
> This separates the mathematical operation from the physical reduction
> mechanism. Backends implement fragment traversal, synchronization, and
> storage, while generated callbacks describe the computation applied at each
> stage.
>
> ## Loop IR analysis
>
> Extend the Loop IR analysis to recognize both explicit reduction nodes and
> reductions expressed as unrolled pointwise operations. For an unrolled
> reduction, the analysis:
>
> 1. Finds the repeated loads from the GEMM output.
> 2. Uses their index ranges and strides to infer the group size and M/N axis.
> 3. Verifies that every lane applies the same pointwise source expression.
> 4. Identifies the associative primitive.
> 5. Preserves the source expression for later CuTeDSL callback generation.
>
> For example, an expression equivalent to:
>
> ```python
> grouped = output.float().view(m, n // 4, 4)
> reduced = torch.exp(grouped).sum(dim=-1)
> ```
>
> is represented as an N-axis group-of-four sum whose source expression is
> `exp(value)`.
>
> ## FlexGEMM integration
>
> Replace FlexGEMM's parallel template-time reduction description with a wrapper
> around `GemmReductionPlan`. The FlexGEMM wrapper retains only provider-specific
> information: the auxiliary-output index, output layout, and operand-swap
> state.
>
> FlexGEMM lowering now passes `epilogue_analysis.reduction_plan` directly into
> that wrapper. The shared geometry also owns the fragment-width and
> physical-callback decision previously implemented by a FlexGEMM-specific
> helper.
>
> This gives FlexGEMM and NVGEMM the same semantic reduction plan while allowing
> each provider to retain its own runtime ABI and code-generation machinery.
>
> ## Relationship between FlexGEMM and NVGEMM
>
> Both backends use the same semantic reduction plan, while retaining their
> existing analysis and runtime interfaces:
>
> ```mermaid
> flowchart LR
>     FX["FlexGEMM FX epilogue"] --> FXA["GemmLocalReduceAnalysis"]
>     LOOP["NVGEMM scheduler Loop IR"] --> LIA["GemmEpilogueIRAnalysis"]
>
>     FXA --> PLAN["GemmReductionPlan<br/>geometry, primitive, callbacks, outputs"]
>     LIA --> CFG["GemmReductionConfig"]
>     CFG --> PLAN
>
>     PLAN --> FLEXCFG["FlexGemmEpilogueLocalReduceConfig<br/>plan + output index + layout + swap_ab"]
>     FLEXCFG --> FLEXRT["FlexGemmRuntimeLocalReducePlan"]
>     FLEXRT --> QUACK["FlexGEMM / QuACK"]
>
>     PLAN --> NVCAP["NVGEMM capability validation"]
>     NVCAP --> NVARGS["GemmReductionArguments"]
>     NVARGS --> NVKERNEL["Vendored NVGEMM kernel"]
> ```
>
> `GemmReductionPlan` is the shared semantic boundary. FlexGEMM adds only the
> output placement and layout information needed by its template, while NVGEMM
> binds the plan to runtime tensors and cache-specialization fields.
>
> ## Testing
>
> Unit coverage for the shared reduction plan and FlexGEMM adapter is included
> in this PR.
>
> End-to-end dense and block-scaled generated-epilogue coverage is provided by
> [pytorch#190825](pytorch#190825).
>
> ```bash
> lintrunner -a
> ```
>
> Description drafted with an AI assistant.

Pull Request resolved: pytorch#195231
Approved by: https://github.com/drisspg
ghstack dependencies: pytorch#194792, pytorch#194793, pytorch#190821
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
> Add focused parity coverage for generated CuTeDSL callbacks across dense and
> block-scaled grouped reductions. The tests cover both reduction axes,
> primitive and pointwise-transformed sources, multiple reductions in one
> epilogue, reduction consumers, and finalization after cross-warp combination.
>
> Keep the transposed output layout explicit when NVGEMM swaps the GEMM operands.
> Let FlexGEMM request the broader tuned NVGEMM configuration while rejecting
> unsupported NVGEMM options.
>
> ## Test Plan
>
> ```bash
> PYTHONPATH=/data/users/mlazos/pytorch/agent_space/runtime_overlay PYTORCH_BOUNDARY_ROOT=$PWD python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemmHeuristics -v
> PYTHONPATH=/data/users/mlazos/pytorch/agent_space/runtime_overlay PYTORCH_BOUNDARY_ROOT=$PWD python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemmEpilogueFusion.test_bf16_grouped_m_reduce_finalizes_after_cross_warp_combine TestNVUniversalGemmEpilogueFusion.test_bf16_grouped_n_composite_reduction_fusion TestNVUniversalGemmEpilogueFusion.test_scaled_mm_grouped_n_composite_reduction_fusion TestNVUniversalGemmEpilogueFusion.test_scaled_mm_grouped_m_reduce_finalizes_after_cross_warp_combine -v
> PYTHONPATH=/data/users/mlazos/pytorch/agent_space/runtime_overlay PYTORCH_BOUNDARY_ROOT=$PWD python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemmEpilogueFusion.test_bf16_grouped_reduce_epilogue_fusion_axis_1_group_4_sum TestNVUniversalGemmEpilogueFusion.test_bf16_grouped_reduce_epilogue_fusion_axis_0_group_64_abs_amax TestNVUniversalGemmEpilogueFusion.test_flex_gemm_grouped_n_reduce_epilogue_fusion_feeds_main_True -v
> lintrunner -a
> ```
>
> Description drafted with an AI assistant.

Pull Request resolved: pytorch#190825
Approved by: https://github.com/karthickai
ghstack dependencies: pytorch#192298, pytorch#190822, pytorch#191514, pytorch#191515
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
doesn't run hese tests in fbcode until we add operator API internally

> This skips two low-level tests only in fbcode because fbcode does not include
> the optional CUTLASS package those tests use to construct and run kernel
> objects directly. The tests fail while importing or creating the operator,
> before they exercise the NVGEMM behavior they are intended to check.
>
> The tests still run in the open-source build, and the higher-level
> `torch.compile` tests remain enabled in fbcode.
>
> ## Architecture
>
> This is a test-only environment boundary. The two tests that directly import
> the optional CUTLASS Operator API are skipped individually when `IS_FBCODE` is
> true. No production lowering, provider registration, or generated-kernel
> behavior changes. The tests continue running in open source, while fbcode
> retains the higher-level compiler coverage.
>
> ## Example
>
> The affected tests directly compile a grouped-reduction provider and a
> unit-dimension epilogue on a non-current CUDA stream. In fbcode, the required
> operator-construction API is absent, so skipping those two tests avoids
> reporting an environment limitation as an NVGEMM correctness failure.
>
>
> ```python
> @unittest.skipIf(
>     IS_FBCODE,
>     "CUTLASS Operator API is not available in fbcode",
> )
> def test_scaled_gemm_grouped_n_reduce_provider(self):
>     ...
> ```
>
> ## Test Plan
>
> ```bash
> PYTORCH_TEST_FBCODE=1 python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemm.test_scaled_gemm_grouped_n_reduce_provider TestNVUniversalGemm.test_scaled_gemm_unit_dim_epilogue_non_current_stream -v
> python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemm.test_scaled_gemm_grouped_n_reduce_provider TestNVUniversalGemm.test_scaled_gemm_unit_dim_epilogue_non_current_stream -v
> lintrunner -a
> ```
>
> Description drafted with an AI assistant.

Pull Request resolved: pytorch#192928
Approved by: https://github.com/karthickai
ghstack dependencies: pytorch#192298, pytorch#190822, pytorch#191514, pytorch#191515, pytorch#190825
pytorchmergebot pushed a commit that referenced this pull request Sep 10, 2026
Orient generated reduction geometry, output layouts, and runtime tensors when NVGEMM swaps GEMM operands. Dense and block-scaled epilogues continue to use the shared generated source, combine, and finalizer callbacks.

Keep the kernel reduction mechanism unchanged. Candidate validation filters physical tile layouts that cross CTA or warp ownership, leaving valid configurations in the normal autotuning set and falling back safely when a layout cannot implement the reduction.

## Test Plan

```bash
PYTHONPATH=/data/users/mlazos/pytorch/agent_space/runtime_overlay PYTORCH_BOUNDARY_ROOT=$PWD python test/inductor/test_nv_universal_gemm.py -k swap_ab
PYTHONPATH=/data/users/mlazos/pytorch/agent_space/runtime_overlay PYTORCH_BOUNDARY_ROOT=$PWD python test/inductor/test_nv_universal_gemm.py -k grouped_reduce
spin quicklint
lintrunner -a
```

Authored with an AI assistant.

Pull Request resolved: #195538
Approved by: https://github.com/karthickai
ghstack dependencies: #192298, #190822, #191514, #191515, #190825, #192928
pytorchmergebot pushed a commit that referenced this pull request Sep 10, 2026
Generate vendored dense EFC variants for the validated SM100 N-tile widths through 256, including 160, 192, and 224. This makes the configurations available to nvMatmulHeuristics without retaining them unconditionally.

Keep the existing supplemented benchmark space unchanged. Wider candidates enter autotuning only when nvMatmulHeuristics selects them, avoiding additional profiling by default.

## Test Plan

```bash
PYTHONPATH=/data/users/mlazos/pytorch/agent_space/runtime_overlay PYTORCH_BOUNDARY_ROOT=$PWD python test/inductor/test_nv_universal_gemm.py TestNVUniversalGemm.test_vendored_dense_efc_exposes_wide_n_tiles -v
lintrunner -a
```

Authored with an AI assistant.

Pull Request resolved: #195539
Approved by: https://github.com/karthickai
ghstack dependencies: #192298, #190822, #191514, #191515, #190825, #192928, #195538
@github-actions
github-actions Bot deleted the gh/mlazos/277/head branch November 14, 2026 01:42
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