Skip to content

[executorch][native] Add Value + index-arena ids to the in-memory IR - #22221

Open
SS-JIA wants to merge 2 commits into
gh/SS-JIA/601/basefrom
gh/SS-JIA/601/head
Open

[executorch][native] Add Value + index-arena ids to the in-memory IR#22221
SS-JIA wants to merge 2 commits into
gh/SS-JIA/601/basefrom
gh/SS-JIA/601/head

Conversation

@SS-JIA

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

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Next in-memory IR types for the native runtime, under
backends/native/runtime/graph/:

  • Ids.hNodeRef / ValueRef, plain int32_t index-arena aliases plus
    kInvalid, a valid() helper, and an
    in_bounds(ref, size) helper that pairs the validity check with a range check
    via std::cmp_less, so neither side has to be cast to the other's signedness.
    NodeRef indexes Graph.nodes; ValueRef indexes Graph.values.
  • Value (Value.{h,cpp}) — one SSA value (dataflow edge): a std::variant
    over std::monostate / TensorMeta / Scalar / std::vector<ValueRef>, with
    the alternatives declared in ValueKind order so kind() is the variant's
    index. Plus def-use wiring (producer_ref / consumer_refs), a storage
    alias_ref, and an open attrs (std::any) scratch map. Construct via the
    per-kind constructors; read via typed accessors that throw on a kind mismatch.
    A List holds ValueRefs to its element values (an arena grouping), so
    nesting is via the arena and there is no recursive value type; the AOT
    deserializer builds only Tensor / Scalar / None.

Pure std — no ExecuTorch and no flatbuffers dependency. Mirrored into both the
fbcode/ and xplat/ trees to match the native backend layout.

Authored with Claude Code.

Differential Revision: D114396769

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (2 Unrelated Failures)

As of commit 441f497 with merge base cf9bcd8 (image):

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

BROKEN TRUNK - The following job failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 27, 2026
[ghstack-poisoned]

@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