[executorch][native] Add Method + ValueRole to the in-memory IR - #22104
Open
SS-JIA wants to merge 1 commit into
Open
[executorch][native] Add Method + ValueRole to the in-memory IR#22104SS-JIA wants to merge 1 commit into
SS-JIA wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22104
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 5441f30 with merge base 9a2d135 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Aug 24, 2026
This PR needs a
|
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.
Stack from ghstack (oldest at bottom):
Adds
ptn::Method, the stateful wrapper around one top-levelGraph, and theper-value
ValueRoleclassification it drives.Graphis a pure function body;Methodbinds its placeholder and output values to the things outside the puredataflow — external constant data, non-persistent buffers, and the per-output
classification that separates a real result from a state writeback. It mirrors
the schema
Methodbut resolves every in-graph reference to aValueRef.Methodlives atruntime/(peer to theProgramreader), above thegraph/arena package, since it is a method-level rather than a graph-level concept.
New types:
ValueRole(onValue, ingraph/Value.h): Intermediate / UserInput /Parameter / Buffer / ConstantTensor.
Valuealso gains adata_keystring.Both are stamped by the deserializer and give O(1) per-value answers to "how
is this value's storage owned / sourced" (the memory planner and runtime
binder are the eventual consumers).
DataBinding(schema NamedTensorRef + MutableBufferSpec, merged): binds aplaceholder
ValueRefto external storage.keyis the namespace-3 fqn (anexternal-constant-file key when
has_data, else the buffer's cross-methodidentity);
has_dataselects the load path (fetch bytes vs zero-init atload);
mutatedmarks a Buffer written in place whose state persists acrossexecutions;
rolemirrors the bound value's role for direct access wheniterating bindings.
OutputKind(graph-level: UserOutput / BufferMutation / UserInputMutation) andOutputSpec(aligned tograph.output_refsby index). A mutation output'starget_refis aValueRefto the mutated placeholder value in this graph(both the mutated user input and the mutated buffer are lifted placeholders
here), replacing the schema's dual-namespace
targetstring; the wire fqn /SSA name is recovered from that value.
Methoditself:name,Graph graph,data_bindings,output_specs, plus ato_string()debug dump. HOP subgraphs carry no bindings (their params arelifted here and passed as operands), which is why
MethodwrapsGraphrather than folding into it.
Pure std only (no ExecuTorch, no flatbuffers).
Differential Revision: D114426388