-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Open
Labels
module: backendnon-standard backend supportnon-standard backend supportmodule: codegenIssues related to the codegen for Aten and AutogradIssues related to the codegen for Aten and Autogradmodule: internalsRelated to internal abstractions in c10 and ATenRelated to internal abstractions in c10 and ATentriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
Right now, any time we make a change to the schema of an operator, we have to add a corresponding patch to the kernel registration logic in any external backends, e.g. XLA. This causes a temporary window when master is broken for the external backend, when we've merged our change in pytorch core but the corresponding patch hasn't merged yet.
See #53583 for an example, which code mods Scalar to const Scalar& in every op signature, and required corresponding changes in XLA.
To avoid breaking external backends during these changes, we could version our API's. The required changes would look something like:
- maintain a notion of versions (we could use a counter, or just new/old if we want to enforce no more than 2 versions)
- Somewhere in the codegen (probably
translate.py), add branching logic to determine if we should generate schema according to the new version or the old version - In PyTorch core, always codegen dispatcher registrations for the newest version
- In external backends, explicitly pass in information to tell the dispatcher which version of the API to use. This would incur a small runtime cost: we would probably need something like a
hacky_wrapperto do the translation from whatever version to the "latest" version that the dispatcher expects.
This will also be easier to do when/if we end up using codegen to register external backend kernels.
wenleix
Metadata
Metadata
Assignees
Labels
module: backendnon-standard backend supportnon-standard backend supportmodule: codegenIssues related to the codegen for Aten and AutogradIssues related to the codegen for Aten and Autogradmodule: internalsRelated to internal abstractions in c10 and ATenRelated to internal abstractions in c10 and ATentriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module