[UX] Only perform FlashInfer autotuning if needed by kernels - #25016
[UX] Only perform FlashInfer autotuning if needed by kernels#25016mgoin wants to merge 4 commits into
Conversation
Signed-off-by: mgoin <mgoin64@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to conditionally run FlashInfer autotuning only when needed, which improves startup time. The approach is to register the usage of autotune-able kernels during model initialization and then check a flag during the warmup phase. The implementation is straightforward and correct across the modified files. I have one suggestion regarding thread safety in the new registration logic to prevent potential race conditions in concurrent environments.
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
Signed-off-by: mgoin <mgoin64@gmail.com>
Signed-off-by: mgoin <mgoin64@gmail.com>
|
cc @nvjullin |
|
I'm somewhat concerned about the brittleness of the design. There are multiple modes of failure
Initial benchmarks might look correct because some other op On the other hand, autotuning is an extra |
|
This pull request has merge conflicts that must be resolved before it can be |
|
This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you! |
|
This pull request has been automatically closed due to inactivity. Please feel free to reopen if you intend to continue working on it. Thank you! |
Purpose
Before this PR, we would always run a forward pass with max_num_batched_tokens simply if FlashInfer was installed and we were on Hopper or above. This is obviously too loose and affects startup time.
Introduces a
register_flashinfer_kernel_autotunefunction that we can call when we know that a FlashInfer kernel that benefits from autotuning will be used at runtime. Then we can queryflashinfer_autotune_neededto better gate the autotuning warmup pass only when it is needed.Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.