Skip to content

feat(cute_dsl/moe): re-enable use_cold_l2_cache in CuteDslMoEWrapper TuningConfig - #3384

Merged
nv-yunzheq merged 1 commit into
flashinfer-ai:mainfrom
leejnau:cute-dsl-moe-tuner-reenable-cold-l2
May 21, 2026
Merged

nv-yunzheq merged 1 commit into
flashinfer-ai:mainfrom
leejnau:cute-dsl-moe-tuner-reenable-cold-l2

Conversation

@leejnau

@leejnau leejnau commented May 21, 2026

Copy link
Copy Markdown
Contributor

📌 Description

Sets use_cold_l2_cache=True on the autotuner TuningConfig in flashinfer/fused_moe/cute_dsl/tuner.py, matching TRT-LLM's CuteDslFusedMoENvfp4Runner.tuning_config. With cold-L2 ON, the autotuner flushes L2 between profile iterations and measures conservative timings, so the picked tactic is robustly fast under cold-cache conditions; without it, back-to-back iterations of the same tactic benefit from L2-hit reuse and bias the pick toward tactics that look fast during profiling but aren't faster in production.

🔍 Related Issues

#3286
#3340

🚀 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

  • Bug Fixes
    • Improved tuner's cold L2 cache measurement behavior for more accurate performance profiling.

Review Change Stack

…Config

Sets `use_cold_l2_cache=True` in the autotuner TuningConfig at
`flashinfer/fused_moe/cute_dsl/tuner.py`, matching TRT-LLM's
`CuteDslFusedMoENvfp4Runner.tuning_config`. Flushing L2 between
profile iterations yields autotune measurements representative of
production cold-cache conditions; without it, back-to-back iterations
of the same tactic benefit from L2-hit reuse and bias the profile
pass toward tactics that look fast during profiling but aren't
faster in production.

Cold-L2 was previously unset as a workaround for a latent reference
cycle in `CuteDslMoEWrapper` (PR flashinfer-ai#3286 commit `640e32e7`) that would
produce reproducible NaN in `test_wrapper_with_autotune` on B200 CI.
PR flashinfer-ai#3340 fixed that cycle via a weakref trampoline; this commit
follows up by re-enabling the flag.

The corresponding comment block is rewritten to give a brief
rationale for the now-enabled state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b2ec955b-4486-4ede-9dd2-9f24be3f5209

📥 Commits

Reviewing files that changed from the base of the PR and between 18f4534 and 97c89c2.

📒 Files selected for processing (1)
  • flashinfer/fused_moe/cute_dsl/tuner.py

📝 Walkthrough

Walkthrough

The tuner configuration in CuteDslFusedMoENvfp4Runner now enables cold-L2 cache measurement by setting use_cold_l2_cache=True in the TuningConfig. Added comments document that this behavior matches TensorRT-LLM by flushing the L2 cache between autotune profile iterations to represent cold-cache timing conditions.

Changes

Cold L2 Cache Configuration

Layer / File(s) Summary
Cold L2 cache tuning setup
flashinfer/fused_moe/cute_dsl/tuner.py
TuningConfig in CuteDslFusedMoENvfp4Runner.__init__ enables use_cold_l2_cache=True with inline comments explaining this matches TensorRT-LLM behavior by flushing L2 between autotune iterations for cold-cache-like measurement.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • flashinfer-ai/flashinfer#2663: Introduced the use_cold_l2_cache flag in TuningConfig and autotuner infrastructure that this PR now enables.
  • flashinfer-ai/flashinfer#3025: Modifies the same TuningConfig plumbing in flashinfer/fused_moe/cute_dsl/tuner.py affecting tuning configuration construction.
  • flashinfer-ai/flashinfer#3340: Earlier change to flashinfer/fused_moe/cute_dsl/tuner.py addressing related cold-L2 cache and wrapper-cycle behavior.

Suggested labels

run-ci, op: moe

Suggested reviewers

  • aleozlx
  • yzh119
  • samuellees
  • IwakuraRein
  • jiahanc
  • nv-yunzheq

Poem

🐰 A cache flushed clean, L2 memory bright,
Cold measurements wake the tuner's insight,
TensorRT-LLM now finds its twin,
Autotune profiles with precision within. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: re-enabling use_cold_l2_cache in the TuningConfig, which is the primary focus of this PR.
Description check ✅ Passed The description includes all required template sections: detailed explanation of changes, related issues linked, and pre-commit/test checklist items marked complete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request enables the use_cold_l2_cache parameter in the CuteDslFusedMoENvfp4Runner tuner. This change ensures that the L2 cache is flushed between profile iterations during autotuning, aligning with TRT-LLM's configuration to better simulate production cold-cache conditions. I have no feedback to provide.

@qiching qiching left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@nv-yunzheq

Copy link
Copy Markdown
Collaborator

/bot run

@flashinfer-bot

Copy link
Copy Markdown
Collaborator

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

@nv-yunzheq
nv-yunzheq merged commit 41e5aa2 into flashinfer-ai:main May 21, 2026
48 of 65 checks passed
@leejnau
leejnau deleted the cute-dsl-moe-tuner-reenable-cold-l2 branch May 21, 2026 22:49
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.

4 participants