Skip to content

[executorch][native] Add Node to the in-memory IR - #22102

Open
SS-JIA wants to merge 1 commit into
gh/SS-JIA/591/basefrom
gh/SS-JIA/591/head
Open

[executorch][native] Add Node to the in-memory IR#22102
SS-JIA wants to merge 1 commit into
gh/SS-JIA/591/basefrom
gh/SS-JIA/591/head

Conversation

@SS-JIA

@SS-JIA SS-JIA commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Adds ptn::Node, the central IR element: one fx node = one op invocation
(CallFunction) or a graph-boundary marker (Placeholder / Output). It pulls
together the value layer landed so far -- NamedArgument / Argument for
operands, ValueRef for produced values -- and mirrors the schema Node.

Node is a plain struct (name, OpKind, target fqn, inputs, outputs, and a
transient attrs scratch map, the fx node.meta analog). Two satellite types
land with it:

  • OpKind (CallFunction / Placeholder / Output), pinned to the schema ids.
  • Output + OutputValueKind (Tensor / TensorList / Int / Bool / Float). The
    return-ABI grouping is preserved so a later engine-translation stage can tell
    a single result from a tuple / list: topk emits two Tensor outputs,
    split emits one TensorList output, sym_size emits an Int output.
    OutputValueKind deliberately matches the schema's node-level enum name to
    avoid colliding with the graph-level OutputKind (user output vs buffer
    mutation) that lands with Method. The storage-alias fact stays on the
    produced Value, not on Output.

.cpp holds the two non-trivial members: input_value_refs() walks the
Argument variants and collects every consumed ValueRef (tensor args,
tensor-list / optional-list elements, and symbolic scalar refs; kInvalid
skipped) for (re)building def-use wiring; and to_string() renders a single
compact line for debugging.

Pure std only (no ExecuTorch, no flatbuffers), consistent with the rest of the
standalone ptn runtime.

Differential Revision: D114396763

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22102

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit ff73e77 with merge base 9a2d135 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant