[autotuner] Introduce BenchmarkProvider abstraction for kernel benchmarking#1928
Open
hinriksnaer wants to merge 8 commits intopytorch:mainfrom
Open
[autotuner] Introduce BenchmarkProvider abstraction for kernel benchmarking#1928hinriksnaer wants to merge 8 commits intopytorch:mainfrom
hinriksnaer wants to merge 8 commits intopytorch:mainfrom
Conversation
Replace the back-reference to the full BaseSearch object with a narrow 5-field PrecompileContext dataclass (settings, log, kernel, args, jobs). This makes PrecompileFuture's dependencies explicit and testable in isolation. This change is part of a larger effort to introduce a BenchmarkProvider abstraction that encapsulates the benchmarking pipeline. PrecompileFuture currently holds a reference to BaseSearch to access 5 fields — when the BenchmarkProvider owns precompilation, it needs to pass its own context into PrecompileFuture without involving the search object. PrecompileContext makes that possible.
f38f6f3 to
4f05bb7
Compare
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.
sets up foundation for #1803
Motivation
Establishes a substitution point for alternative benchmarking strategies (e.g. cross-node precompilation, overlapped precompile+benchmark). Search algorithms call
self.benchmark_provider.benchmark_function()instead ofself.benchmark_function(). The provider owns the single-config benchmarking pipeline while_benchmark,benchmark_batch, andcreate_precompile_futureremain onBaseSearchfor follow-up migration. Once the changes are finalized, overall maintainability and effort required to introduce more fine grained stability measurements should be improved.Summary
BenchmarkProviderabstract class andLocalBenchmarkProviderimplementationbenchmark_functionand its dependencies (baseline computation, accuracy validation, precompile management) fromBaseSearchinto the providerBaseSearchacceptsbenchmark_provider_clsparameter to allow alternative benchmarking strategiesBaseSearchFollow-up work
_benchmarkandcreate_precompile_futureto the providerset_adaptive_compile_timeoutaspost_initial_benchmarkDiscussion
This is a step towards decoupling benchmarking strategies from search algorithms. The goal is to enable alternative benchmarking strategies without them being tied to individual search algorithm implementations, and to improve maintainability by giving benchmarking a clear boundary.
This PR moves
benchmark_functionand its direct dependencies into the provider as the smallest self-contained unit that establishes the abstraction without doing a comprehensive rewrite. The remaining methods onBaseSearchare marked with TODOs for incremental migration.Given the scope of these changes, any feedback is very much appreciated.