Keep delegate-consumed mutable buffers above the delegate - #21507
Keep delegate-consumed mutable buffers above the delegate#21507Conarnar wants to merge 1 commit into
Conversation
Summary:
`tag_constant_data` freezes a const/param/buffer into a delegate when all of its
users are partitioned. It recognized a *mutated* buffer only when a direct user's
node name is a key in `buffers_to_mutate`. That misses the case where a buffer
both feeds a delegate and is mutated *inside* it: the mutation is produced by a
`getitem` off the `call_delegate`, so the buffer's only direct user is the
delegate node (whose name is not a `buffers_to_mutate` key), and the buffer is
wrongly frozen as constant data instead of staying a method-owned mutable buffer.
Additionally treat a placeholder as a mutated buffer when its FQN is a
`buffers_to_mutate` target, so a buffer a delegate updates in place stays owned
above the delegate. This is the case anticipated by
`test_not_delegate_mutable_buffers` ("consider when the delegate can consume the
mutable buffer") — e.g. a backend that embeds a pre-compiled engine which updates
a KV cache in place.
Authored with AI assistance (Claude Code).
Differential Revision: D114288921
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21507
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit a8bd74e with merge base 43cb2b2 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@Conarnar has exported this pull request. If you are a Meta employee, you can view the originating Diff in D114288921. |
This PR needs a
|
Summary:
tag_constant_datafreezes a const/param/buffer into a delegate when all of itsusers are partitioned. It recognized a mutated buffer only when a direct user's
node name is a key in
buffers_to_mutate. That misses the case where a bufferboth feeds a delegate and is mutated inside it: the mutation is produced by a
getitemoff thecall_delegate, so the buffer's only direct user is thedelegate node (whose name is not a
buffers_to_mutatekey), and the buffer iswrongly frozen as constant data instead of staying a method-owned mutable buffer.
Additionally treat a placeholder as a mutated buffer when its FQN is a
buffers_to_mutatetarget, so a buffer a delegate updates in place stays ownedabove the delegate. This is the case anticipated by
test_not_delegate_mutable_buffers("consider when the delegate can consume themutable buffer") — e.g. a backend that embeds a pre-compiled engine which updates
a KV cache in place.
Authored with AI assistance (Claude Code).
Differential Revision: D114288921