Repository navigation
feat: add experimental API/backend policy, @flashinfer_experimental_api, and flashinfer.experimental namespace
#4880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
684df37
8a732ec
6d7effc
0a45397
d49422e
ef1b869
4a220cb
b4d7bc8
9481990
e2b9601
32f3e25
8e8a256
61d8da7
089dc68
32285b2
1efa141
a2101de
6882c76
5b81154
2c6cf9b
18e79be
dafc420
2647624
0da3908
aa43b39
9e2de79
6b91c92
ac34539
aaed306
ca7af41
5312e60
776acac
8bc4c43
0be85f7
5e4dd0b
2e3083f
f6712cf
8316c5a
f1b0b2d
eec434e
5dec08f
78159d9
412efeb
5f3fa44
71b6a6b
b40af90
8a0d490
ee6bf0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -60,11 +60,14 @@ unsafe shape/alignment assumptions. | |||||||||||||||||||||||
| ## Experimental APIs | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| FlashInfer does not gate PRs by size. Some PRs may instead be submitted on **experimental** | ||||||||||||||||||||||||
| terms β a separate lifecycle, workflow management, and quality bar β declared via a tracked | ||||||||||||||||||||||||
| issue. Review such PRs against the experimental quality bar, not the durable-code bar. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| <!-- TODO(@bkryu): declaration workflow (tracked issue), review quality bar for experimental | ||||||||||||||||||||||||
| code, and graduation / removal criteria. --> | ||||||||||||||||||||||||
| terms β a separate lifecycle, workflow management, and quality bar. An experimental PR is | ||||||||||||||||||||||||
| declared by the **Experimental Track** checkbox in the PR template (with a linked tracking | ||||||||||||||||||||||||
| issue) and the `experimental` label; the code itself is marked by placement under | ||||||||||||||||||||||||
| `flashinfer/experimental/` and/or `@flashinfer_experimental_api`. Review such PRs against the | ||||||||||||||||||||||||
| experimental quality bar, not the durable-code bar. | ||||||||||||||||||||||||
|
Comment on lines
+63
to
+67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π Maintainability & Code Quality | π‘ Minor | β‘ Quick win Preserve normal review for core entry points. Line 67 applies the experimental quality bar to the entire experimental PR. Proposed wording- terms β a separate lifecycle, workflow management, and quality bar. An experimental PR is
+ terms β a separate lifecycle and workflow for experimental backend code. An experimental PR is
declared by the **Experimental Track** checkbox in the PR template (with a linked tracking
issue) and the `experimental` label; the code itself is marked by placement under
`flashinfer/experimental/` and/or `@flashinfer_experimental_api`. Review such PRs against the
- experimental quality bar, not the durable-code bar.
+ experimental quality bar for backend-specific code, while core entry points follow the normal
+ durable-code review bar.π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| <!-- TODO(@bkryu): review quality bar for experimental code, and graduation / removal | ||||||||||||||||||||||||
| criteria (see flashinfer/experimental/README.md). --> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Checklist | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| # Experimental APIs and Backends in FlashInfer | ||
|
|
||
| This document records the motivation and design decision; the normative policy is [`flashinfer/experimental/README.md`](../../flashinfer/experimental/README.md).* | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π Maintainability & Code Quality | π‘ Minor | β‘ Quick win Add the required Line 1 contains the H1, but Line 3 starts the body text. Add a Based on learnings: normative Markdown documents under π€ Prompt for AI AgentsSource: Learnings |
||
|
|
||
| ## Overview | ||
|
|
||
| FlashInfer currently applies the same review and support expectations to most user-facing functionality. | ||
|
|
||
| This works well for functionality intended for long-term support, especially on datacenter architectures where stability is critical. It works less well for fast-moving client-GPU support, where users often value functional availability over API or implementation stability. | ||
|
|
||
| The initial proposal was motivated by expedited SM12x kernel delivery, but the problem is broader. FlashInfer needs to distinguish and accommodate: | ||
|
|
||
| * an **experimental API**, whose interface may change or disappear (e.g. new op from a new model); and | ||
|
|
||
| * an **experimental backend**, whose implementation is not yet ready for stable support (e.g. Kernel Factory-generated kernel). | ||
|
|
||
| These are separate concerns. A stable API may expose an experimental backend through explicit opt-in, while an experimental API must be clearly identified and gated. | ||
|
|
||
| This document records the selected placement and identification design for experimental APIs and backends, and the rules that govern them. | ||
|
|
||
| Throughout, experimental behavior must be explicitly enabled, tested for its intended use case, and governed by ownership and lifecycle rules. In this document, **core** refers to the existing non-experimental codebase. | ||
|
|
||
| ## Design: Tagged experimental APIs in core; experimental backends in `flashinfer.experimental` | ||
|
|
||
| API stability and backend stability are separate decisions. | ||
|
|
||
| | | Stable Backend | Experimental Backend | | ||
| | ----- | :---: | :---: | | ||
| | Stable API | Normal Path | Allowed with Opt in | | ||
| | Experimental API | Not a target use case | Allowed with Opt in | | ||
|
|
||
| Experimental APIs live in core and are marked with `@flashinfer_experimental_api`. | ||
|
|
||
| Experimental backends and backend-specific logic live under the `flashinfer.experimental` directory. | ||
|
|
||
| Core contains only a thin entry point: | ||
|
|
||
| * public API signature; | ||
| * general validation; | ||
| * feature-gate check; | ||
| * minimal handoff. | ||
|
|
||
| Support checks, heuristics within the experimental backend, routing, compilation, caching, and kernels remain under `flashinfer.experimental`. | ||
|
|
||
| This supports both: | ||
|
|
||
| * a tagged experimental API backed by an experimental backend; and | ||
| * a stable API exposing an experimental backend once the opt-in is set. | ||
|
|
||
| This design preserves a unified API surface while strongly isolating fast-moving implementation code. | ||
|
|
||
| ### **Feature gating** | ||
|
|
||
| All experimental backend paths require: `FLASHINFER_ENABLE_EXPERIMENTAL_FEATURES=1` | ||
|
|
||
| **Without** this opt-in: | ||
|
|
||
| * experimental APIs must be gated off; | ||
| * stable APIs must not select experimental backends; | ||
| * automatic routing must consider only stable backends. | ||
|
|
||
| **With** this opt-in, stable APIs may route to experimental backends automatically: backend dispatch, autotuning, and trace-apply substitution may consider experimental backends alongside stable ones. Setting the flag is consent to experimental behavior wherever it applies; an explicit `backend=` argument remains available to force a specific backend but is not required. | ||
|
|
||
| ## Common Rules for Experimental APIs and Backends | ||
|
|
||
| The following rules apply to all experimental APIs and backends. | ||
|
|
||
| ### **1\. Ownership and lifecycle** | ||
|
|
||
| Every experimental feature must have: | ||
|
|
||
| * a named owner; | ||
| * a tracking issue that | ||
| * documents the feature's use case; | ||
| * states the reason for entering the experimental path (see the justification list in Β§2); | ||
| * states a graduation plan and target release for graduation. | ||
| * e.g. we expose this kernel first and the goal is to finalize the API and graduate by 0.6.xx release in four weeks. | ||
|
|
||
| Default intent for any experimental PR should be graduation within four weeks (see Β§7). Experimental features are periodically reviewed and either continue incubating, graduate through the normal stable process, or are removed. | ||
|
|
||
| Continued incubation should not be automatic. At each lifecycle review, the owner must document why the feature is still experimental, provide evidence of active use or progress, and identify the remaining graduation blockers. A maintainer must approve the extension. Repeating the same justification without meaningful progress is not sufficient. | ||
|
|
||
| Broken tests, loss of ownership, or lack of meaningful usage are sufficient reasons for removal without stable deprecation guarantees. | ||
|
|
||
| ### **2\. Initial scope and admission** | ||
|
|
||
| The admitted use cases are the fast-moving work this policy exists for: | ||
|
|
||
| * client-GPU kernels and backends (e.g. SM12x); | ||
| * new operations from the latest models, where functional support can land ahead of a finalized stable API; | ||
| * highly specialized kernels for specific problem sizes, which enter as experimental backends behind an existing stable API rather than as new APIs. | ||
|
|
||
| A feature requires documented justification, such as: | ||
|
|
||
| * a new operator family or algorithm; | ||
| * a materially different API contract; | ||
| * a new compiler, backend, or architecture-specific implementation path; | ||
| * a use case FlashInfer has not committed to maintain. | ||
|
|
||
| A new experimental API should not be created for a parameter-space extension of an existing stable API. An experimental backend may implement an existing stable API when it introduces a materially new implementation path. | ||
|
|
||
| ### **3\. Placement and integration** | ||
|
|
||
| Experimental backend logic lives under `flashinfer.experimental`. | ||
|
|
||
| Where core contains an experimental entry point, it may include only: | ||
|
|
||
| * API definition; | ||
| * shared validation; | ||
| * feature-gate check; | ||
| * backend selection; | ||
| * direct handoff. | ||
|
|
||
| Backend-specific support checks, routing, compilation, caching, and kernels remain outside core. | ||
|
|
||
| ### **4\. API identification** | ||
|
|
||
| Public experimental APIs are marked with `@flashinfer_experimental_api`. | ||
|
|
||
| Stable APIs exposing experimental backends remain marked with `@flashinfer_api`. | ||
|
|
||
| The decorator sets `is_experimental = True` on the decorated function so that tooling can mechanically distinguish intentionally experimental public APIs from internal helpers and accidentally untagged APIs. | ||
|
|
||
| ### **5\. Testing and review** | ||
|
|
||
| Every experimental feature must include: | ||
|
|
||
| * correctness tests against a reference; | ||
| * at least one representative supported configuration; | ||
| * validation on intended hardware; | ||
| * a runnable example. | ||
|
|
||
| Experimental tests run in a separate CI lane and must pass for PRs that modify the feature. | ||
|
|
||
| Changes under `flashinfer.experimental` receive narrower review focused on eligibility, correctness, containment, licensing, and obvious safety or maintainability risks. | ||
|
|
||
| Changes to core follow the normal core review process. Reviewers should verify that integration is explicit, stable behavior is unchanged by default, and backend-specific logic has not leaked into core. | ||
|
|
||
| Broad portability, comprehensive performance coverage, and long-term maintainability are not required for the experimental implementation at admission. | ||
|
|
||
| ### **6\. User contract** | ||
|
|
||
| Experimental APIs and backends provide no compatibility or long-term support guarantees and may change or be removed without deprecation. | ||
|
|
||
| Documentation must identify: | ||
|
|
||
| * whether the API, backend, or both are experimental; | ||
| * supported use cases and limitations; | ||
| * required feature gates; | ||
| * whether the feature participates in automatic routing (dispatch, autotuning, trace-apply) once the gate is set. | ||
|
|
||
| Experimental features are intended primarily for main-branch users, community containers, and local framework integrations. They should not be enabled by default in supported framework releases. | ||
|
|
||
| A request for default or supported release-path integration is a signal that the feature should be considered for graduation. | ||
|
|
||
| ### **7\. Miscellaneous** | ||
|
|
||
| * Experimental APIs and backends are JIT-only. AOT registration is prohibited. | ||
| * We set four weeks as the default lifecycle review cadence, but each experimental feature author can propose a planned lifecycle in their tracking issue with justification. | ||
|
|
||
|
|
||
| ## Non-goals | ||
|
|
||
| This document does not: | ||
|
|
||
| - commit FlashInfer to supporting every new model, operator, or backend; | ||
|
|
||
| - guarantee that experimental features will graduate; | ||
|
|
||
| - provide compatibility or long-term maintenance guarantees; | ||
|
|
||
| - allow experimental behavior to activate by default; | ||
|
|
||
| - lower review or support expectations for stable core functionality. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| .. _experimental: | ||
|
|
||
| Experimental APIs and Backends | ||
| ============================== | ||
|
|
||
| FlashInfer distinguishes stable functionality from **experimental** | ||
| functionality intended for fast-moving work β client-GPU (e.g. SM12x) | ||
| kernels, new operations from the latest models, or highly specialized kernels | ||
| for specific problem sizes: | ||
|
|
||
| - an **experimental API** is a public interface that may change or disappear; | ||
| - an **experimental backend** is an implementation that is not yet ready for | ||
| stable support. | ||
|
|
||
| A stable API may route to an experimental backend once experimental features | ||
| are enabled, and experimental APIs are marked with an experimental warning in | ||
| their documentation. | ||
|
|
||
| Enabling experimental features | ||
| ------------------------------ | ||
|
|
||
| All experimental behavior requires an explicit opt-in: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export FLASHINFER_ENABLE_EXPERIMENTAL_FEATURES=1 | ||
|
|
||
| Without this variable, experimental APIs raise ``RuntimeError`` and stable | ||
| APIs never route to experimental backends. The variable is the single | ||
| opt-in: with it set, stable APIs may route to experimental backends | ||
| automatically (dispatch, autotuning, trace-apply), and an explicit | ||
| ``backend=`` argument remains available to force a specific backend. The | ||
| first use of an experimental API in a process emits an | ||
| ``ExperimentalWarning``. | ||
|
|
||
| User contract | ||
| ------------- | ||
|
|
||
| Experimental APIs and backends provide **no compatibility or long-term | ||
| support guarantees** and may change or be removed without deprecation. They | ||
| are intended primarily for main-branch users, community containers, and | ||
| local framework integrations, and should not be enabled by default in | ||
| supported framework releases. | ||
|
|
||
| Each experimental feature's documentation identifies whether the API, the | ||
| backend, or both are experimental; the supported use cases and limitations; | ||
| and whether the feature participates in automatic routing once enabled. | ||
|
|
||
| Experimental features are JIT-only: they are not included in the | ||
| ``flashinfer-jit-cache`` / ``flashinfer-cubin`` pre-built packages. | ||
|
|
||
| For contributors | ||
| ---------------- | ||
|
|
||
| The full policy β placement rules, admission criteria, ownership and | ||
| lifecycle requirements, and the graduation checklist β lives in | ||
| ``flashinfer/experimental/README.md`` in the repository, with a summary in | ||
| ``CONTRIBUTING.md``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Maintainability & Code Quality | π‘ Minor | β‘ Quick win
Align the checklist with all mandatory experimental-feature requirements.
CONTRIBUTING.mdLines 76-78 require the tracking issue to record the use case, but Line 34 omits it.flashinfer/experimental/CLAUDE.mdLine 82 requires documentation to state experimental status, the gate, and limitations, but this checklist has no documentation item. Add both checks so a completed template cannot claim full compliance while missing these requirements.Proposed checklist update
π Committable suggestion
π€ Prompt for AI Agents
Source: Learnings