Skip to content

Revert PR 4122 - #4171

Merged
jiahanc merged 1 commit into
flashinfer-ai:mainfrom
jimmyzho:revert-pr-4122
Jul 27, 2026
Merged

jiahanc merged 1 commit into
flashinfer-ai:mainfrom
jimmyzho:revert-pr-4122

Conversation

@jimmyzho

@jimmyzho jimmyzho commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

📌 Description

🔍 Related Issues

🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

✅ Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

🧪 Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Reviewer Notes

Summary by CodeRabbit

  • Compatibility

    • Updated GPU architecture support and kernel selection across attention, GEMM, MoE, quantization, and sampling workloads.
    • Removed dedicated support for select SM107/10.7a builds and refreshed compatible architecture targets.
    • NVFP4 KV-cache operations now validate scale factors without an additional SM107 restriction.
  • Bug Fixes

    • Improved TensorRT-LLM kernel compatibility and shared-memory configuration.
    • Improved optional backend detection and reduced failures in environments with limited runtime support.
  • Documentation

    • Updated installation examples to reflect the revised CUDA architecture list.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change removes SM107 architecture support across runtime dispatch, JIT/AOT compilation, quantization, GEMM/MoE/TRTLLM kernels, and CuTe DSL checks. It also updates tests, artifact references, sampling declarations, and CUDA architecture documentation.

Changes

Architecture support removal

Layer / File(s) Summary
Runtime capability and backend dispatch
benchmarks/routines/*, flashinfer/{decode,deep_gemm,fused_moe,gemm,quantization}/*, csrc/*
SM107 is removed from capability maps, backend decorators, dispatch tables, validation, and TRTLLM kernel selection.
JIT and artifact targeting
flashinfer/aot.py, flashinfer/compilation_context.py, flashinfer/jit/*, flashinfer/artifacts.py
SM107-specific JIT generators, NVCC mappings, AOT detection, compile definitions, and artifact paths/checksums are updated or removed.
CuTe DSL architecture checks
flashinfer/cute_dsl/*, flashinfer/fused_moe/cute_dsl/*, flashinfer/mla/_core.py
Architecture probing and explicit CuTe DSL architecture gates are removed or replaced with fixed SM100 or major-version checks.
TRTLLM and CUDA kernel configuration
include/flashinfer/trtllm/*, include/flashinfer/sampling.cuh, csrc/nv_internal/*
SM107 compatibility branches and oversized shared-memory launch handling are removed; sampling launch bounds and epilogue group configuration are updated.
Tests and documentation
tests/*, README.md, docs/installation.rst
Architecture skip conditions, support messages, numerical tolerances, optional backend loading, and CUDA architecture examples are updated.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: testing

Suggested reviewers: yzh119, bkryu, iwakurarein

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is only the empty template and provides no actual summary, related issues, test notes, or reviewer guidance. Replace the template with a filled Description, Related Issues, Tests, and Reviewer Notes section, and mark any relevant checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 31.62% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately states this is a revert of PR 4122, which matches the broad revert-style changes in the diff.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jiahanc jiahanc added the run-ci label Jul 27, 2026
@jiahanc

jiahanc commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

/bot run

@flashinfer-bot

Copy link
Copy Markdown
Collaborator

GitLab MR !1046 has been created, and the CI pipeline #59751084 is currently running. I'll report back once the pipeline job completes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/utils/test_fp4_quantize.py (1)

386-393: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Do not replace GPU capability checks with importability-only checks.

Both helpers now treat an importable CuTe DSL stack as sufficient, so unsupported GPUs can execute architecture-specific tests instead of being skipped.

  • tests/utils/test_fp4_quantize.py#L386-L393: retain the CuTe DSL architecture predicate alongside the importability check.
  • tests/utils/test_fp4_quantize_padding.py#L43-L50: restore the same architecture-aware gating behavior.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/utils/test_fp4_quantize.py` around lines 386 - 393, Update
_is_cute_dsl_available in tests/utils/test_fp4_quantize.py (386-393) and its
corresponding helper in tests/utils/test_fp4_quantize_padding.py (43-50) to
require both CuTe-DSL importability and the existing supported-GPU architecture
predicate, preserving skips on unsupported GPUs.

Source: Coding guidelines

🧹 Nitpick comments (1)
include/flashinfer/sampling.cuh (1)

293-294: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy lift

Document and benchmark the __launch_bounds__ removal.

These sampling and softmax kernels are hot paths. Removing __launch_bounds__(BLOCK_THREADS) changes the compiler’s register-allocation and occupancy constraints, but the diff gives no rationale or performance evidence. Add a short explanation of the intended trade-off and benchmark the affected paths, or retain the attribute where it remains beneficial.

Also applies to: 410-412, 495-498, 724-726, 773-775, 837-840, 970-973, 1097-1100, 1192-1196, 1663-1664, 1860-1866

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@include/flashinfer/sampling.cuh` around lines 293 - 294, Review every
affected sampling and softmax kernel, including OnlineSoftmaxFusedKernel, for
the removed __launch_bounds__ attribute. Benchmark the relevant hot paths and
document the intended register-allocation/occupancy trade-off, or restore
__launch_bounds__(BLOCK_THREADS) on kernels where measurements show it remains
beneficial.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@flashinfer/compilation_context.py`:
- Around line 98-101: Update the generic NVCC flag generation in the relevant
compilation-context method to remove SM107 from supported_cuda_archs before
sorting and constructing -gencode entries. Apply this centrally so both
device-detected and FLASHINFER_CUDA_ARCH_LIST architectures are filtered, while
preserving all other architecture flags and COMMON_NVCC_FLAGS.
- Line 84: Update the supported_major_versions parameter annotation in the
relevant constructor or function from list[int] to list[int] | None while
preserving its default value of None.

In `@flashinfer/cute_dsl/gemm_allreduce_two_shot.py`:
- Around line 1191-1195: Update the CooperativeGroup construction in the
epilogue producer setup to pass the agent and only one group size/alignment
value. Remove the duplicated 32 * len(self.epilog_warp_id) positional argument
while preserving the existing group-size calculation.

In `@flashinfer/mamba/ssd_combined.py`:
- Around line 292-296: Update the architecture validation in the SSDCombined
capability check to allow only SM100, SM103, and SM110, rejecting SM107 and all
other major/minor combinations before kernel compilation. Keep the existing
ValueError and its supported-architecture message aligned with this explicit
allowlist.

In `@tests/gemm/test_cute_dsl_gemm_allreduce_two_shot.py`:
- Around line 490-491: Update the pytest.skip message in the architecture check
around get_compute_capability to mention both supported architectures, SM100 and
SM103, matching the allowed (10, 0) and (10, 3) condition.

In `@tests/utils/test_fp8_quantize.py`:
- Around line 16-21: Restore the shared exact architecture policy using the
capability utilities, keeping _is_available in
tests/utils/test_fp8_quantize.py:16-21 limited to dependency availability. In
tests/gemm/test_cute_dsl_blockscaled_gemm.py:263-267 and :314-318, restore
architecture gates; narrow the predicates at
tests/gemm/test_groupwise_scaled_gemm_fp8.py:52, :98-106, :227, :288, and :336
and exclude SM107 at tests/gemm/test_groupwise_scaled_gemm_mxfp4.py:257-261.
Replace the major-version-only marker at
tests/mamba/test_chunk_scan_combined.py:146-151, restore the shared marker at
tests/moe/test_cute_dsl_fused_moe.py:36-37, and retain its gating at :862,
:1128, :1650, :1729, :1933, and :2129 for the respective architecture-specific
tests.

---

Outside diff comments:
In `@tests/utils/test_fp4_quantize.py`:
- Around line 386-393: Update _is_cute_dsl_available in
tests/utils/test_fp4_quantize.py (386-393) and its corresponding helper in
tests/utils/test_fp4_quantize_padding.py (43-50) to require both CuTe-DSL
importability and the existing supported-GPU architecture predicate, preserving
skips on unsupported GPUs.

---

Nitpick comments:
In `@include/flashinfer/sampling.cuh`:
- Around line 293-294: Review every affected sampling and softmax kernel,
including OnlineSoftmaxFusedKernel, for the removed __launch_bounds__ attribute.
Benchmark the relevant hot paths and document the intended
register-allocation/occupancy trade-off, or restore
__launch_bounds__(BLOCK_THREADS) on kernels where measurements show it remains
beneficial.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4d561f28-968b-42ac-be82-c497ec3e28d0

📥 Commits

Reviewing files that changed from the base of the PR and between 4b969c9 and 4b72489.

📒 Files selected for processing (80)
  • README.md
  • benchmarks/routines/flashinfer_benchmark_utils.py
  • csrc/nv_internal/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/launchers/moe_gemm_tma_ws_launcher.inl
  • csrc/trtllm_batched_gemm_runner.cu
  • csrc/trtllm_gemm_runner.cu
  • docs/installation.rst
  • flashinfer/aot.py
  • flashinfer/artifacts.py
  • flashinfer/compilation_context.py
  • flashinfer/cute_dsl/add_rmsnorm_fp4quant.py
  • flashinfer/cute_dsl/attention/compat.py
  • flashinfer/cute_dsl/attention/mla_decode.py
  • flashinfer/cute_dsl/attention/mla_decode_fp8.py
  • flashinfer/cute_dsl/attention/prefill.py
  • flashinfer/cute_dsl/attention/wrappers/batch_decode.py
  • flashinfer/cute_dsl/attention/wrappers/batch_mla.py
  • flashinfer/cute_dsl/attention/wrappers/batch_prefill.py
  • flashinfer/cute_dsl/gemm_allreduce_two_shot.py
  • flashinfer/cute_dsl/rmsnorm_fp4quant.py
  • flashinfer/cute_dsl/utils.py
  • flashinfer/cutile/cutile_common.py
  • flashinfer/decode.py
  • flashinfer/deep_gemm.py
  • flashinfer/fp4_quantization.py
  • flashinfer/fused_moe/core.py
  • flashinfer/fused_moe/cute_dsl/fused_moe.py
  • flashinfer/fused_moe/fused_routing_dsv3.py
  • flashinfer/fused_moe/hash_topk.py
  • flashinfer/gemm/gemm_base.py
  • flashinfer/gemm/routergemm.py
  • flashinfer/jit/__init__.py
  • flashinfer/jit/attention/modules.py
  • flashinfer/jit/core.py
  • flashinfer/jit/cpp_ext.py
  • flashinfer/jit/fp4_quantization.py
  • flashinfer/jit/fp8_quantization.py
  • flashinfer/jit/fused_moe.py
  • flashinfer/jit/gemm/core.py
  • flashinfer/jit/gemm/cutlass/generate_kernels.py
  • flashinfer/jit/mla.py
  • flashinfer/jit/xqa.py
  • flashinfer/kda_decode.py
  • flashinfer/kda_kernels/__init__.py
  • flashinfer/mamba/ssd_combined.py
  • flashinfer/mla/_core.py
  • flashinfer/norm/__init__.py
  • flashinfer/prefill.py
  • flashinfer/quantization/fp4_quantization.py
  • include/flashinfer/sampling.cuh
  • include/flashinfer/trtllm/common.h
  • include/flashinfer/trtllm/fmha/fmhaKernels.cuh
  • include/flashinfer/trtllm/fmha/fmhaRunner.cuh
  • tests/attention/test_cute_dsl_decode.py
  • tests/attention/test_cute_dsl_mla_decode.py
  • tests/attention/test_deepseek_mla.py
  • tests/attention/test_modular_fmha_prefill.py
  • tests/attention/test_trtllm_gen_attention_decode.py
  • tests/attention/test_trtllm_gen_attention_prefill.py
  • tests/attention/test_trtllm_gen_mla.py
  • tests/attention/test_vsa_block_sparse.py
  • tests/comm/test_mnnvl_custom_comm.py
  • tests/gdn/test_decode_delta_rule.py
  • tests/gdn/test_decode_pretranspose_bf16_padded_pool.py
  • tests/gdn/test_decode_pretranspose_noncontiguous_pool.py
  • tests/gemm/test_cute_dsl_blockscaled_gemm.py
  • tests/gemm/test_cute_dsl_gemm_allreduce_two_shot.py
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py
  • tests/gemm/test_groupwise_scaled_gemm_mxfp4.py
  • tests/mamba/conftest.py
  • tests/mamba/test_chunk_scan_combined.py
  • tests/model_optimizations/test_router_gemms.py
  • tests/moe/test_cute_dsl_fused_moe.py
  • tests/moe/test_trtllm_cutlass_fused_moe.py
  • tests/moe/test_unified_moe.py
  • tests/norm/test_add_rmsnorm_fp4_quant_cute_dsl.py
  • tests/norm/test_rmsnorm_fp4_quant_cute_dsl.py
  • tests/utils/test_fp4_quantize.py
  • tests/utils/test_fp4_quantize_padding.py
  • tests/utils/test_fp4_tensor_torch_cute.py
  • tests/utils/test_fp8_quantize.py
💤 Files with no reviewable changes (31)
  • flashinfer/jit/init.py
  • flashinfer/jit/core.py
  • tests/utils/test_fp4_tensor_torch_cute.py
  • tests/norm/test_add_rmsnorm_fp4_quant_cute_dsl.py
  • include/flashinfer/trtllm/common.h
  • tests/attention/test_cute_dsl_decode.py
  • tests/gdn/test_decode_pretranspose_noncontiguous_pool.py
  • tests/attention/test_modular_fmha_prefill.py
  • flashinfer/cute_dsl/add_rmsnorm_fp4quant.py
  • flashinfer/cute_dsl/attention/wrappers/batch_mla.py
  • flashinfer/cutile/cutile_common.py
  • tests/attention/test_trtllm_gen_attention_prefill.py
  • flashinfer/fused_moe/cute_dsl/fused_moe.py
  • tests/attention/test_trtllm_gen_attention_decode.py
  • flashinfer/kda_kernels/init.py
  • tests/comm/test_mnnvl_custom_comm.py
  • flashinfer/mla/_core.py
  • tests/norm/test_rmsnorm_fp4_quant_cute_dsl.py
  • tests/gdn/test_decode_pretranspose_bf16_padded_pool.py
  • flashinfer/jit/fp4_quantization.py
  • tests/attention/test_vsa_block_sparse.py
  • flashinfer/aot.py
  • flashinfer/cute_dsl/attention/wrappers/batch_decode.py
  • flashinfer/cute_dsl/attention/wrappers/batch_prefill.py
  • flashinfer/fp4_quantization.py
  • tests/attention/test_cute_dsl_mla_decode.py
  • tests/attention/test_trtllm_gen_mla.py
  • flashinfer/cute_dsl/rmsnorm_fp4quant.py
  • benchmarks/routines/flashinfer_benchmark_utils.py
  • tests/mamba/conftest.py
  • flashinfer/cute_dsl/attention/compat.py

self,
supported_major_versions: list[int] = None,
map_sm107_to_100f: bool = False,
self, supported_major_versions: list[int] = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

ruff check flashinfer/compilation_context.py --select RUF013

Repository: flashinfer-ai/flashinfer

Length of output: 767


Use an explicit nullable annotation.

Ruff checks RUF013 on flashinfer/compilation_context.py:84; replace list[int] = None with list[int] | None = None.

🧰 Tools
🪛 Ruff (0.15.21)

[warning] 84-84: PEP 484 prohibits implicit Optional

Convert to T | None

(RUF013)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@flashinfer/compilation_context.py` at line 84, Update the
supported_major_versions parameter annotation in the relevant constructor or
function from list[int] to list[int] | None while preserving its default value
of None.

Source: Linters/SAST tools

Comment on lines +98 to +101
return [
f"-gencode=arch=compute_{major}{minor},code=sm_{major}{minor}"
for major, minor in sorted(supported_cuda_archs)
] + self.COMMON_NVCC_FLAGS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Exclude SM107 before forming generic NVCC flags.

TARGET_CUDA_ARCHS can still contain SM107 from device detection or FLASHINFER_CUDA_ARCH_LIST; filtering only by major version emits compute_107a/sm_107a for every caller requesting major 10. That leaves SM107 JIT targeting active despite this revert. Reject or filter SM107 centrally before generating flags.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@flashinfer/compilation_context.py` around lines 98 - 101, Update the generic
NVCC flag generation in the relevant compilation-context method to remove SM107
from supported_cuda_archs before sorting and constructing -gencode entries.
Apply this centrally so both device-detected and FLASHINFER_CUDA_ARCH_LIST
architectures are filtered, while preserving all other architecture flags and
COMMON_NVCC_FLAGS.

Comment on lines 1191 to 1195
c_producer_group = pipeline.CooperativeGroup(
pipeline.Agent.Thread,
32 * len(self.epilog_warp_id),
32 * len(self.epilog_warp_id),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate file =="
git ls-files | rg '^flashinfer/cute_dsl/gemm_allreduce_two_shot\.py$|cutlass|CooperativeGroup|flashinfer/cute_dsl'

echo
echo "== target lines =="
if [ -f flashinfer/cute_dsl/gemm_allreduce_two_shot.py ]; then
  sed -n '1160,1215p' flashinfer/cute_dsl/gemm_allreduce_two_shot.py | nl -ba -v1160
fi

echo
echo "== CooperativeGroup usages in repo =="
rg -n "CooperativeGroup\s*\(" . -g '*.py' -g '*.cu' -g '*.cpp' -g '*.h' -g '*.hpp' -g '*.cuh' -g '*.jinja'

echo
echo "== imports around cooperative group/pipeline =="
rg -n "from cutlass|import cutlass|class CooperativeGroup|def CooperativeGroup|CooperativeGroup" flashinfer/cute_dsl -g '*.py' || true

Repository: flashinfer-ai/flashinfer

Length of output: 22081


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== target lines =="
sed -n '1160,1215p' flashinfer/cute_dsl/gemm_allreduce_two_shot.py

echo
echo "== CooperativeGroup constructor/class definitions =="
rg -n "class CooperativeGroup|def CooperativeGroup|CooperativeGroup" 3rdparty flashinfer/cute_dsl -g '*.py' -g '*.cu' -g '*.cpp' -g '*.h' -g '*.hpp' -g '*.cuh' -g '*.inl' | head -200

echo
echo "== cooperative group constructor snippets =="
python3 - <<'PY'
import re, os
for root, dirs, files in os.walk('flashinfer/cute_dsl'):
    for fname in files:
        if not fname.endswith('.py'):
            continue
        path = os.path.join(root, fname)
        text = open(path, encoding='utf-8', errors='ignore').read()
        for m in re.finditer(r'class\s+CooperativeGroup\b|def\s+CooperativeGroup\b', text):
            line = text.count('\n',0,m.start())+1
            print(f'-- {path}:{line} --')
PY

echo
echo "== all CooperativeGroup call expressions with line numbers =="
rg -n "CooperativeGroup\s*\(" flashinfer/cute_dsl -g '*.py' -C 2

Repository: flashinfer-ai/flashinfer

Length of output: 27230


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== imports in target file =="
sed -n '1,90p' flashinfer/cute_dsl/gemm_allreduce_two_shot.py

echo
echo "== CooperativeGroup definitions in 3rdparty/cutlass =="
rg -n "class CooperativeGroup|CooperativeGroup\s*=" 3rdparty/cutlass -g '*.h' -g '*.hpp' -g '*.inl' -g '*.h' -g '*.cuh' | head -80

echo
echo "== surrounding target file section around earlier cooperative groups =="
sed -n '710,746p' flashinfer/cute_dsl/gemm_allreduce_two_shot.py

Repository: flashinfer-ai/flashinfer

Length of output: 2531


🌐 Web query:

CUTLASS pipeline CooperativeGroup constructor Agent Thread count

💡 Result:

In the CUTLASS library's Python DSL (CuTeDSL), the CooperativeGroup constructor is defined within the cutlass.pipeline module [1][2][3]. It is used to specify the participation of threads in a pipeline's producer or consumer agents [1][4]. The constructor signature is: class CooperativeGroup(agent: Agent, size: int = 1, alignment: int | None = None) [2][3][5] Parameters: agent (Agent): Defines the type of thread grouping, typically selected from Agent.Thread, Agent.Warp, Agent.ThreadBlock, or Agent.ThreadBlockCluster [1][3]. size (int): Specifies the number of participating agents (e.g., the number of threads if Agent.Thread is used) [3][4]. It must be greater than 0 [3]. alignment (int | None): An optional parameter that is deprecated and should be removed from code [3]. The size parameter serves as the thread count (or agent count) for the group [3][4]. When Agent.Thread is used, the size represents the specific number of threads participating in the producer or consumer group [4]. For example, developers often set this to 1 for a single-threaded producer or scale it based on the number of warps or threads involved in specific operations like TMA (Tensor Memory Accelerator) store or multicast [4]. Top results: [1], [3], [4]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== CooperativeGroup implementation in installed/available cutlass package =="
python3 - <<'PY'
from pathlib import Path
try:
    import cutlass
    print("cutlass", getattr(cutlass, "__version__", "unknown"), getattr(cutlass, "__file__", "no __file__"))
except Exception as e:
    print("cutlass import unavailable:", type(e).__name__, e)

PY
find /opt /home /usr -path '*cutlass*helpers.py' -o -path '*cute_dsl_api*/pipeline.html' 2>/dev/null | head -20 || true

Repository: flashinfer-ai/flashinfer

Length of output: 313


Remove the duplicated producer-group count.

pipeline.CooperativeGroup takes the agent and a single group size/alignment, so the extra positional argument makes this producer group construction invalid.

Proposed fix
                 c_producer_group = pipeline.CooperativeGroup(
                     pipeline.Agent.Thread,
                     32 * len(self.epilog_warp_id),
-                    32 * len(self.epilog_warp_id),
                 )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
c_producer_group = pipeline.CooperativeGroup(
pipeline.Agent.Thread,
32 * len(self.epilog_warp_id),
32 * len(self.epilog_warp_id),
)
c_producer_group = pipeline.CooperativeGroup(
pipeline.Agent.Thread,
32 * len(self.epilog_warp_id),
)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@flashinfer/cute_dsl/gemm_allreduce_two_shot.py` around lines 1191 - 1195,
Update the CooperativeGroup construction in the epilogue producer setup to pass
the agent and only one group size/alignment value. Remove the duplicated 32 *
len(self.epilog_warp_id) positional argument while preserving the existing
group-size calculation.

Comment on lines +292 to 296
if major not in (10, 11):
raise ValueError(
f"SSDCombined requires datacenter Blackwell (SM100/SM103/SM110) "
f"for tcgen05 MMA. Got SM{major}{minor}."
f"SSDCombined requires SM100-SM110 (tcgen05): Blackwell datacenter "
f"GPUs (SM100/SM103/SM110). Got SM{major}{minor}."
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Check no longer excludes SM107, undermining its own error message.

major not in (10, 11) lets SM107 (major=10, minor=7) through, even though the comment and error message explicitly state only SM100/SM103/SM110 are supported. On actual SM107 hardware this will now fall through to kernel compilation and hit the cryptic cute-dsl OpError that this check exists to avoid.

🐛 Proposed fix
-        if major not in (10, 11):
+        if major not in (10, 11) or (major, minor) == (10, 7):
             raise ValueError(
                 f"SSDCombined requires SM100-SM110 (tcgen05): Blackwell datacenter "
                 f"GPUs (SM100/SM103/SM110). Got SM{major}{minor}."
             )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if major not in (10, 11):
raise ValueError(
f"SSDCombined requires datacenter Blackwell (SM100/SM103/SM110) "
f"for tcgen05 MMA. Got SM{major}{minor}."
f"SSDCombined requires SM100-SM110 (tcgen05): Blackwell datacenter "
f"GPUs (SM100/SM103/SM110). Got SM{major}{minor}."
)
if major not in (10, 11) or (major, minor) == (10, 7):
raise ValueError(
f"SSDCombined requires SM100-SM110 (tcgen05): Blackwell datacenter "
f"GPUs (SM100/SM103/SM110). Got SM{major}{minor}."
)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@flashinfer/mamba/ssd_combined.py` around lines 292 - 296, Update the
architecture validation in the SSDCombined capability check to allow only SM100,
SM103, and SM110, rejecting SM107 and all other major/minor combinations before
kernel compilation. Keep the existing ValueError and its supported-architecture
message aligned with this explicit allowlist.

Comment on lines +490 to +491
if get_compute_capability(torch.device("cuda")) not in [(10, 0), (10, 3)]:
pytest.skip("cute_dsl_gemm_allreduce_two_shot requires SM100")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the architecture skip message.

The condition now allows SM100 and SM103, but the message says only “requires SM100.” Change it to mention both supported architectures so skipped-test diagnostics match the actual condition.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/gemm/test_cute_dsl_gemm_allreduce_two_shot.py` around lines 490 - 491,
Update the pytest.skip message in the architecture check around
get_compute_capability to mention both supported architectures, SM100 and SM103,
matching the allowed (10, 0) and (10, 3) condition.

Comment on lines 16 to 21
try:
from flashinfer.cute_dsl import is_cute_dsl_available as _is_available

if not _is_available():
return False
import torch as _torch

if _torch.cuda.is_available():
from flashinfer.cute_dsl.utils import is_cute_dsl_arch_supported

return is_cute_dsl_arch_supported(*_torch.cuda.get_device_capability(0))
return True
return _is_available()
except ImportError:
return False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Restore one exact architecture policy across the test suite. The current changes either remove architecture checks or retain predicates that accept all major-version-10 devices, including SM107.

  • tests/utils/test_fp8_quantize.py#L16-L21: keep dependency availability separate from exact GPU support.
  • tests/gemm/test_cute_dsl_blockscaled_gemm.py#L263-L267: restore the grouped-GEMM architecture gate.
  • tests/gemm/test_cute_dsl_blockscaled_gemm.py#L314-L318: restore the output-layout test architecture gate.
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L52-L52: narrow the blockscale predicate.
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L98-L106: narrow the TRTLLM and CUTLASS predicates.
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L227-L227: narrow the grouped-GEMM predicate.
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L288-L288: narrow the DeepGEMM predicate.
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L336-L336: narrow the batch-DeepGEMM predicate.
  • tests/gemm/test_groupwise_scaled_gemm_mxfp4.py#L257-L261: exclude SM107 in the predicate.
  • tests/mamba/test_chunk_scan_combined.py#L146-L151: replace the major-version-only marker.
  • tests/moe/test_cute_dsl_fused_moe.py#L36-L37: restore the shared architecture marker.
  • tests/moe/test_cute_dsl_fused_moe.py#L862-L862: retain gating for functional tests.
  • tests/moe/test_cute_dsl_fused_moe.py#L1128-L1128: retain gating for wrapper tests.
  • tests/moe/test_cute_dsl_fused_moe.py#L1650-L1650: retain gating for API consistency tests.
  • tests/moe/test_cute_dsl_fused_moe.py#L1729-L1729: retain gating for expert-parallelism tests.
  • tests/moe/test_cute_dsl_fused_moe.py#L1933-L1933: retain gating for poisoned-buffer tests.
  • tests/moe/test_cute_dsl_fused_moe.py#L2129-L2129: retain gating for all-tactics tests.

As per coding guidelines, architecture-specific tests must skip unsupported GPUs using capability utilities.

📍 Affects 6 files
  • tests/utils/test_fp8_quantize.py#L16-L21 (this comment)
  • tests/gemm/test_cute_dsl_blockscaled_gemm.py#L263-L267
  • tests/gemm/test_cute_dsl_blockscaled_gemm.py#L314-L318
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L52-L52
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L98-L106
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L227-L227
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L288-L288
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py#L336-L336
  • tests/gemm/test_groupwise_scaled_gemm_mxfp4.py#L257-L261
  • tests/mamba/test_chunk_scan_combined.py#L146-L151
  • tests/moe/test_cute_dsl_fused_moe.py#L36-L37
  • tests/moe/test_cute_dsl_fused_moe.py#L862-L862
  • tests/moe/test_cute_dsl_fused_moe.py#L1128-L1128
  • tests/moe/test_cute_dsl_fused_moe.py#L1650-L1650
  • tests/moe/test_cute_dsl_fused_moe.py#L1729-L1729
  • tests/moe/test_cute_dsl_fused_moe.py#L1933-L1933
  • tests/moe/test_cute_dsl_fused_moe.py#L2129-L2129
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/utils/test_fp8_quantize.py` around lines 16 - 21, Restore the shared
exact architecture policy using the capability utilities, keeping _is_available
in tests/utils/test_fp8_quantize.py:16-21 limited to dependency availability. In
tests/gemm/test_cute_dsl_blockscaled_gemm.py:263-267 and :314-318, restore
architecture gates; narrow the predicates at
tests/gemm/test_groupwise_scaled_gemm_fp8.py:52, :98-106, :227, :288, and :336
and exclude SM107 at tests/gemm/test_groupwise_scaled_gemm_mxfp4.py:257-261.
Replace the major-version-only marker at
tests/mamba/test_chunk_scan_combined.py:146-151, restore the shared marker at
tests/moe/test_cute_dsl_fused_moe.py:36-37, and retain its gating at :862,
:1128, :1650, :1729, :1933, and :2129 for the respective architecture-specific
tests.

Source: Coding guidelines

@jiahanc
jiahanc enabled auto-merge (squash) July 27, 2026 15:14
@jiahanc
jiahanc merged commit 6258e52 into flashinfer-ai:main Jul 27, 2026
62 of 77 checks passed
aleozlx pushed a commit that referenced this pull request Jul 28, 2026
…4189)

## 📌 Description

Fixes the B300 sampling performance regression tracked in **NVBug
6517769**, targeting `release-v0.6.16` directly.

[#4122](#4122) annotated
11 sampling kernels with `__launch_bounds__(BLOCK_THREADS)`. That
annotation is effectively `__launch_bounds__(1024)` on every cc ≥ 8,
which forces ptxas under a 64-reg/thread ceiling and causes measurable
spills / slowdowns on B300 and H100.

### Why not a blanket removal?

The annotations were not unexplained noise. Internal GitLab [MR
!611](https://gitlab-master.nvidia.com/dl/flashinfer/flashinfer/-/merge_requests/611)
(`Fix Rubin (SM 10.7) launch failures in sampling kernels via
__launch_bounds__`, merged into `feat_sm107` 2026-04-28) documented the
Rubin failure mode:

> The Top-K sampling kernel was using >64 regs per thread with 1024
threads per block, exceeding the 65,536 register budget.

The [Rubin Kernel Requirements
Tracker](https://docs.google.com/spreadsheets/d/1Cn0_F6n_HMrzXPYreYbVIWbKQmfp-zzKne3Lz7akysU)
recorded the pre-fix failures as `too many resources requested for
launch` on `tests/utils/test_sampling.py` / logits sampling. That
rationale never made the public #4122 description, but the release
branch still carries SM107 support, so a full drop would re-break Rubin
native launches.

### Fix

Gate the annotation to native SM107 compiles only:

```cuda
#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 1070)
#define FLASHINFER_SAMPLING_LAUNCH_BOUNDS(block_threads) __launch_bounds__(block_threads)
#else
#define FLASHINFER_SAMPLING_LAUNCH_BOUNDS(block_threads)
#endif
```

All 11 kernels use `FLASHINFER_SAMPLING_LAUNCH_BOUNDS(BLOCK_THREADS)`
instead of unconditional `__launch_bounds__(BLOCK_THREADS)`.

When today's JIT maps SM107 → `sm_100f` (`map_sm107_to_100f=True` while
CUTLASS lacks `Sm107`), `__CUDA_ARCH__` is 1000 and the gate is
inactive; that path inherits sm_100 register counts, which already fit a
1024-thread launch on the arches we measured. The gate is the safety net
for **native `sm_107a`** compiles — the path MR !611 actually fixed.

## 🔍 Related Issues

- NVBug 6517769 — B300 sampling perf drop after 290c091
- Internal MR !611 / commit `a8c10c24` on `feat_sm107` (Rubin
launch-failure root cause)
- Caused by #4122; #4171 reverted #4122 wholesale on `main` (no
cherry-pick possible)

## 🧪 Tests

### ptxas (CUDA 13.0) with the gated macro

| Target | Kernel | Result |
|---|---|---|
| sm_90a | MinP / TopK / TopP / TopKTopP | ≤48 regs, **no spills**
(matches unconstrained) |
| sm_103a | same | ≤48 regs, **no spills** |
| sm_107a | — | **cannot compile** on this toolkit (`Unsupported gpu
architecture`) |

### Wall-clock (NVBug repro on H100 NVL)

```
python3 flashinfer_benchmark.py --routine min_p_sampling_from_probs \
    --batch_size 32 --vocab_size 129280 --min_p 0.1 -vv
```

| Config | median |
|---|---|
| release (unconditional `__launch_bounds__`) | 0.051 ms |
| this PR (SM107-gated) | **0.045 ms** (same as full removal) |

Correctness: earlier full-removal run of `tests/utils/test_sampling.py`
on this header family was 1320 passed / 0 failed; the gated form is a
no-op on H100 device code, so that result still applies.

## Reviewer Notes

- Please confirm on **B300** that the NVBug case is restored, and on
**Rubin** that `tests/utils/test_sampling.py` still launches when
compiled for native `sm_107a` (and/or under the current `sm_100f` JIT
mapping).
- `#4171` already removed these annotations from `main` along with all
SM107 enablement; this PR is release-only and preserves SM107
launchability.
feih-nv added a commit that referenced this pull request Jul 29, 2026
Expose the existing TRTLLM-gen `MxFP4xMxFP8` (W4A8) and `MxFP4xBf16`
(W4A16) kernels through the unified MoE API.

## 📌 Description

This is PR 3 in the unified MoE quantization series for FP8 support:
1. #4026 — unified block-scale FP8 (merged)
2. #4091 — unified per-tensor FP8 (merged)
3. This PR — unified TRTLLM MXFP4×MXFP8/W4A8 and MXFP4×BF16/W4A16

### Changes
- Generalize `TrtllmFp4RoutedRunner` beyond NVFP4:
  - `QuantVariant.MXFP4`: `MxE2m1` weights × `MxE4m3` activations
  - `QuantVariant.W4A16`: `MxE2m1` weights × BF16 activations
- Add variant-aware TRTLLM FP4 preparation:
  - MXFP4 weights with 32-element UE8M0 scales
  - MXFP8 activation preparation for W4A8
  - BF16 activation preparation for W4A16
- Add shape, dtype, and scale-layout validation.
- Add unified conformance and fuzzer coverage for packed and
`FromLogits` routing.

### Support matrix
- NVFP4 and MXFP4/W4A8: SM100, SM103
- W4A16: SM100 only (remains disabled on SM103, matching upstream xfail
#1754)
- SM120/121: separate b12x backends where available
- SM107 is unsupported after #4171 

### Scope
- No CUDA/C++ kernel changes; both modes already exist in the TRTLLM
flat API.
- CUTLASS W4A8 is out of scope.

## 🚀 Pull Request Checklist

### ✅ Pre-commit Checks

- [x] I have installed `pre-commit` by running `pip install pre-commit`
(or used your preferred method).
- [x] I have installed the hooks with `pre-commit install`.
- [x] I have run the hooks manually with `pre-commit run --all-files`
and fixed any reported issues.

## 🧪 Tests

SM100, CUDA 13 CI container:
- `tests/moe/test_unified_moe_mxfp4.py`
  - 21 passed
- Unified fuzzer, packed routing:
  - seeds `900017,900018`
  - 2 passed
- Unified fuzzer, `FromLogits`:
  - seeds `900019,900020`
  - 2 passed
aleozlx added a commit that referenced this pull request Jul 30, 2026
<!-- .github/pull_request_template.md -->

## 📌 Description

This PR relands SM 107 support to main branch (reverted in #4171) as
well as some other release fixes.

#### Cherry Picks
- #4191
- #4189
- #4200
- #4215
- #4225
- #4230
- #4235
- #4226
- #4257
- #4258 
- #4261

#### Other Changes
- Rubin guards from #4252's conflict resolution (`TLLM_RUBIN_FEATURES`:
SiTuGlu
static_asserts + tile-192 advertisement, compiled out for the Rubin BMM
pin)
- Test-contract update: `test_unified_moe.py` arch assertions written
post-revert
(#4159) flipped to the restored contract (FP4/BF16 claim 107; FP8 stays
100/103)

<!-- What does this PR do? Briefly describe the changes and why they’re
needed. -->

## 🔍 Related Issues

<!-- Link any related issues here -->

#4107, #4164, reverts #4171

## 🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull
request, please make sure the following items are complete.

### ✅ Pre-commit Checks

- [x] I have installed `pre-commit` by running `pip install pre-commit`
(or used your preferred method).
- [x] I have installed the hooks with `pre-commit install`.
- [x] I have run the hooks manually with `pre-commit run --all-files`
and fixed any reported issues.

> If you are unsure about how to set up `pre-commit`, see [the
pre-commit documentation](https://pre-commit.com/).

## 🧪 Tests

- [ ] Tests have been added or updated as needed.
- [ ] All tests are passing (`unittest`, etc.).

## Reviewer Notes

<!-- Optional: anything you'd like reviewers to focus on, concerns, etc.
-->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added support for Rubin/SM107 GPUs across GEMM, MoE, attention,
quantization, sampling, and DeepGEMM workflows.
* Added architecture-aware kernel selection, memory sizing, compilation,
and artifact handling.
* **Bug Fixes**
* Improved validation and error messages for incompatible GPU
architectures and invalid kernel configurations.
  * Clearly rejects unsupported NVFP4 KV-cache operations on SM107.
* **Documentation**
  * Updated installation guidance with the SM107 architecture target.
* **Tests**
* Expanded architecture coverage and compatibility checks across GPU
test suites.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Vinnie6167 <Vinnie6167@users.noreply.github.com>
Co-authored-by: Ka-Hyun Nam <knam@nvidia.com>
Co-authored-by: Alex Yang <aleyang@nvidia.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Jimmy Zhou <79552142+jimmyzho@users.noreply.github.com>
Vinnie6167 added a commit to Vinnie6167/flashinfer that referenced this pull request Aug 21, 2026
…t it

is_cute_dsl_arch_supported's docstring said the probe "pins the DSL's
default target via the CUTE_DSL_ARCH environment variable". That was true
when flashinfer-ai#4122 landed -- it called os.environ.setdefault("CUTE_DSL_ARCH",
family) -- but the line went away with the flashinfer-ai#4171 revert and was not
restored by the flashinfer-ai#4280 re-land, leaving the wording stale.

The passive behaviour is the correct one, and FlashInfer should not set
the variable: as the comment a few lines below notes, an env var set
after cutlass is imported does not retarget the DSL, and the setdefault
sat after `from cutlass.base_dsl.arch import Arch` so it was a no-op
anyway. Retargeting is the user's call, since it affects every DSL kernel
in the process.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

5 participants