[AUTOTUNER] Add (XGB+GA) FlagTune support for Triton v3.6.x#782
Open
HenryRenYz wants to merge 1 commit into
Open
[AUTOTUNER] Add (XGB+GA) FlagTune support for Triton v3.6.x#782HenryRenYz wants to merge 1 commit into
HenryRenYz wants to merge 1 commit into
Conversation
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the initial FlagTune integration for FlagTree/Triton v3.6.x.
FlagTune introduces a model-assisted autotuning path that can propose high-quality kernel configurations before the regular benchmarking loop. The implementation is opt-in through environment variables and preserves the default Triton autotuner behavior when FlagTune is disabled, unavailable, or unable to produce valid candidates.
Motivation
The existing autotuning flow can require benchmarking a large configuration space for every new shape. FlagTune reduces this search cost by using a trained XGBoost ranking model to predict top candidate configurations, with an optional genetic-algorithm refinement stage when benchmark feedback is available.
This is especially useful for matmul/GEMM workloads on Hopper-class backends, where the valid and performant configuration space is large and shape-dependent.
What Changed
triton.flagtunePython package.Flagtunerwrapper and@flagtunedecorator as a drop-in autotuner path.ConfigProposerAPI:make_config_proposer(...)predict_configs(...)make_early_config_prune(...)for backward compatibilitymm_general_tma/flagtree/gemm.User-Facing Behavior
FlagTune is disabled by default.
To enable it:
Optional environment variables:
TRITON_FLAGTUNE_MODEL_DIR=/path/to/model TRITON_FLAGTUNE_TOP_K=10 FLAGTUNE_MODEL_CACHE=~/.flagtree/flagtune_models FLAGTUNE_MODEL_URLS=/path/to/model_urls.json FLAGTUNE_DISABLE_REMOTE=1 FLAGTUNE_DISABLE_OPS=flagtree/gemmExample usage:
When FlagTune is disabled or initialization fails, the code falls back to the normal autotuner path.
Or, if a low-level API is desired:
The proposer is basically a function that maps (benchmark fn, input shape, initial configs, operator metas) into a new set of candidate configs that provides to caller for further selection/tuning.
Compatibility Notes
TRITON_USE_FLAGTUNE=1is set.Testing
Added benchmark/test coverage for matmul FlagTune behavior:
Recommended validation commands:
Risk
The main risk is model/config quality for newly supported shapes. This is mitigated by:
FLAGTUNE_DISABLE_OPS.Files Added
python/triton/flagtune/python/test/flagtune/test_bench_matmul.pypython/triton/flagtune/tests/test_bench_matmul.py