Out-variant kernels are lacking BC protection for new default args being added.
@larryliu0820 is already working on this.
Since May 12, 2025.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 581
Description
🐛 Describe the bug
In general adding a new argument with a default value to an operator in PyTorch is not considered a BC breaking change.
Backwards Compatible (BC) here meaning new runtime old model.
Today though since out tensors are at the end of the list of args we lose the nice default value behavior of c++ headers, and adding new default args is a BC breaking change because of this.
The solution is to generate wrappers in code gen that place out at the front so that we can still get the default arg behavior. If we inline these functions there should be no regression either.
Today:
boxed_kernel(Evalue* args) {
return out_at_back(/* scale???? */, args[0].toTensor());
}
Solution:
boxed(Evalue* args) {
return out_at_front(args[0].toTensor());
}
inline Tensor out_at_front(Tensor out, int scale = 1) {
return out_at_back(scale, out);
}
Versions
.
cc @larryliu0820 @lucylq
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.