Skip to content

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

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

[executorch][native] Add Value + index-arena ids to the in-memory IR#22277
SS-JIA wants to merge 1 commit into
gh/SS-JIA/614/basefrom
gh/SS-JIA/614/head

Conversation

@SS-JIA

@SS-JIA SS-JIA commented Aug 28, 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.hNodeId / ValueId, plain int32_t index-arena aliases plus
    kInvalid, a valid() helper, and an
    in_bounds(id, 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.
    NodeId indexes Graph.nodes; ValueId indexes Graph.values.
  • Value (Value.{h,cpp}) — one SSA value (dataflow edge): a std::variant
    over std::monostate / TensorMeta / Scalar / std::vector<ValueId>, with
    the alternatives declared in ValueKind order so kind() is the variant's
    index. Plus def-use wiring (producer_id / consumer_ids), a storage
    alias_id, 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 ValueIds 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 28, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Unrelated Failure

As of commit 693d4ba with merge base a5f15b5 (image):

NEW FAILURE - The following job has failed:

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