Skip to content

[executorch][native] Add TensorMeta + ScalarType in-memory IR types - #22098

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

[executorch][native] Add TensorMeta + ScalarType in-memory IR types#22098
SS-JIA wants to merge 1 commit into
gh/SS-JIA/587/basefrom
gh/SS-JIA/587/head

Conversation

@SS-JIA

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

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

First concrete in-memory IR value types for the native runtime, under
backends/native/runtime/graph/:

  • ScalarType (ScalarType.h) — a standalone, header-only scalar element-type
    enum driven by an X-macro table (PTN_FORALL_SCALAR_TYPES(cpp_type, name, id)), modeled on the ET-VK vkapi::ScalarType. The macro generates the enum
    (ids pinned to ExecuTorch's ScalarType / the native_graph.fbs schema so a
    deserializer maps the serialized byte directly), the k<Name> constants, the
    forward ScalarType -> C++ type trait (ScalarTypeToCppType<N> /
    cpp_type_t<N>), and the element_size() / scalar_type_name() helpers.
    Half / BFloat16 map to uint16_t as a raw storage stand-in.
  • TensorMeta (TensorMeta.{h,cpp}) — logical tensor metadata: element type,
    per-dim size ranges (Dim{min, max}), and an advisory dim_order_hint
    (non-prescriptive — engines choose their own physical layout). Helpers:
    ndim(), is_static(), is_contiguous(), numel() (upper-bound extent;
    throws on an unbounded dim), to_string(), and equality.

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: D114396765

[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/22098

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

✅ No Failures

As of commit 85f4302 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.

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