[Compiler] Added backend registry#1967
Merged
hinriksnaer merged 12 commits intopytorch:mainfrom Apr 13, 2026
Merged
Conversation
fulvius31
reviewed
Apr 8, 2026
Collaborator
There was a problem hiding this comment.
this is still a closed Literal. should this be widened to str (or derived from the registry) now that backends are dynamically registered?
Collaborator
Author
There was a problem hiding this comment.
Left this in for IDE and autocomplete support, otherwise we lose that since the list would be generated at runtime.
Contributor
There was a problem hiding this comment.
I think we need to update this otherwise out of tree backends will get lint errors.
fulvius31
reviewed
Apr 8, 2026
fulvius31
reviewed
Apr 8, 2026
jansel
requested changes
Apr 9, 2026
Contributor
There was a problem hiding this comment.
I think we need to update this otherwise out of tree backends will get lint errors.
Collaborator
Author
|
Added tests and cleaned up the literal. @jansel |
jansel
approved these changes
Apr 13, 2026
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.
reserved_launch_param_namesto Backend ABC #1970Backend lookup is currently scattered across hardcoded dicts in
compile_environment.pyandsettings.py, each duplicating the same name-to-class mapping. Adding a new backend requires updating multiple locations. This PR introduces a centralized backend registry as a single source of truth for backend registration and lookup.The registry also moves the experimental backend warning from a hardcoded string set (
settings.backend in ("pallas", "cute", "metal")) to aBackend.experimentalproperty, so each backend declares its own status rather than being listed in shared code.This infrastructure can later be leveraged to provide aggregate metadata that requires knowledge across all backends, such as collecting all reserved launch parameter names for kernel portability, or listing available backends at runtime.