-
Notifications
You must be signed in to change notification settings - Fork 110
Implement setitem without copy_
#2792
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
base: main
Are you sure you want to change the base?
Conversation
aaaaf67 to
3d9be2f
Compare
|
The failures in CI seems relevant |
ad552de to
7011cc2
Compare
| return VJPDual(primal, residuals) | ||
|
|
||
|
|
||
| @register_augmented_forward(prims.PrimIDs.SETITEM) |
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.
We have to define forward and backward separately. If not, when we extract the forward trace from the combined fw&bw function, we hit into prims.setitem(clone(g), index, 0) in backward, which survives through DCE because setitem is tagged as DONT_DCE.
Fixes #2790. Previously,
inp[idx] = valuewas translated into_copy_(inp, clang.copy_with_setitem(inp, idx, val)), wherecopy_with_setitemwas an opaque primitive that only torchex could execute. This PR makes the entiresetitemopaque.Demo