Skip to content

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

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

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

Conversation

@SS-JIA

@SS-JIA SS-JIA commented Aug 28, 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, ValueId 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 one non-trivial member: input_value_ids() walks the
Argument variants and collects every consumed ValueId (tensor args,
tensor-list / optional-list elements, and symbolic scalar ids; kInvalid
skipped) for (re)building def-use wiring. The IR printer gains
to_string(const Node&), which 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 28, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit f1cdf75 with merge base a5f15b5 (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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.

@digantdesai digantdesai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

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. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants