Goal
Make FlyDSL autotune a real, adopted path without making normal serving or CI pay for benchmark search.
This supersedes the discussion in #612 and supports the downstream-kernel direction in #749. The implementation should stay small: reuse the direct JIT entry point, keep one owner for tuning axes, and add machinery only for demonstrated correctness or deployment needs.
Design invariants
- Search is explicit opt-in. Normal calls use a searched winner, matching offline artifact, or heuristic default before considering search.
FLYDSL_AUTOTUNE=1 is the deliberate force-search path.
- Benchmarking preserves program semantics.
restore_value and reset_to_zero make every repetition start from valid state and also preserve clean final/cache-hit behavior.
- The declared
key owns tuning axes. Shape, dtype, layout, and mode values that can change the winner belong there. Artifact lookup must not introduce a second key callback or competing schema.
- Scratch winners and deployment artifacts have different lifetimes. The scratch cache includes toolchain, device, environment, dtype, and stride fingerprints. Offline artifacts use the declared key plus device identity and are reviewed deployment inputs.
- Artifacts are generated on the intended GPU. Shared CI verifies deterministic emit/load, validation, fallback, and execution behavior; it does not select or commit a winner from noisy shared-runner timing.
- Accepted artifacts fail loudly at execution. Missing or invalid artifacts may fall back. Compile, launch, or runtime errors from an accepted artifact are not masked by retrying a default.
Current implementation
The current design has no builder mode, second RMSNorm factory, artifact-specific key callback, or committed config registry.
CI contract
- Broad source and wheel test runs must not benchmark implicitly.
- GPU-free tests cover config serialization, cache/default/forced-search ordering, cache-key axes, pruning, state restoration, and artifact policy.
- The dedicated RMSNorm device test owns its
FLYDSL_AUTOTUNE=1 scope, executes every candidate with deterministic synthetic ranking, and checks the selected result plus artifact emit/load against the reference.
- No extra autotune workflow or permanent checked-in winner is required.
Acceptance criteria
Deliberately deferred
Parallel precompile / two-phase compilation (#266) is not part of this issue's acceptance criteria. The direct-JIT path removed the builder-mode motivation, and there is not yet a measured first-run latency budget showing that another compilation mechanism is necessary. Open a focused follow-up only with a reproducible workload, target GPU, current compile/search breakdown, and required latency bound.
References
Goal
Make FlyDSL autotune a real, adopted path without making normal serving or CI pay for benchmark search.
This supersedes the discussion in #612 and supports the downstream-kernel direction in #749. The implementation should stay small: reuse the direct JIT entry point, keep one owner for tuning axes, and add machinery only for demonstrated correctness or deployment needs.
Design invariants
FLYDSL_AUTOTUNE=1is the deliberate force-search path.restore_valueandreset_to_zeromake every repetition start from valid state and also preserve clean final/cache-hit behavior.keyowns tuning axes. Shape, dtype, layout, and mode values that can change the winner belong there. Artifact lookup must not introduce a second key callback or competing schema.Current implementation
restore_value/reset_to_zerowith GPU-free tests.rmsnorm).FLYDSL_AUTOTUNE=0; dedicated tests opt in to forced search themselves.The current design has no builder mode, second RMSNorm factory, artifact-specific key callback, or committed config registry.
CI contract
FLYDSL_AUTOTUNE=1scope, executes every candidate with deterministic synthetic ranking, and checks the selected result plus artifact emit/load against the reference.Acceptance criteria
Deliberately deferred
Parallel precompile / two-phase compilation (#266) is not part of this issue's acceptance criteria. The direct-JIT path removed the builder-mode motivation, and there is not yet a measured first-run latency budget showing that another compilation mechanism is necessary. Open a focused follow-up only with a reproducible workload, target GPU, current compile/search breakdown, and required latency bound.
References