Skip to content

Serialize/flatbuffer to program#18129

Open
chizkiyahu wants to merge 2 commits intopytorch:mainfrom
chizkiyahu:serialize/flatbuffer-to-program
Open

Serialize/flatbuffer to program#18129
chizkiyahu wants to merge 2 commits intopytorch:mainfrom
chizkiyahu:serialize/flatbuffer-to-program

Conversation

@chizkiyahu
Copy link
Contributor

@chizkiyahu chizkiyahu commented Mar 12, 2026

exir: add flatbuffer-to-program reader

This continues the work from #17333.

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell

This continues the work from pytorch#17333.

Change-Id: I35ac4cd5f6430ea89939453344c13e056b5c746c
Signed-off-by: Chizkiyahu Raful <chizkiyahu.raful@arm.com>
Change-Id: Iebb6ff9151b76b352ef5dbb4d9bd23e2e622c326
Signed-off-by: Chizkiyahu Raful <chizkiyahu.raful@arm.com>
Copilot AI review requested due to automatic review settings March 12, 2026 16:54
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 12, 2026

🔗 Helpful Links

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

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

❌ 10 Awaiting Approval, 1 New Failure

As of commit 1a41600 with merge base be0cdee (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

NEW FAILURE - The following job has failed:

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

@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 Mar 12, 2026
@chizkiyahu
Copy link
Contributor Author

@pytorchbot label "partner: arm"

@pytorch-bot pytorch-bot bot added the partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm label Mar 12, 2026
@chizkiyahu
Copy link
Contributor Author

@pytorchbot label "release notes: exir"

@pytorch-bot pytorch-bot bot added the release notes: exir Changes to any dialects and passes on these dialects, such as memory planning label Mar 12, 2026
@chizkiyahu
Copy link
Contributor Author

@pytorchbot label ciflow/trunk

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 12, 2026

To add these label(s) (ciflow/trunk) to the PR, please first approve the workflows that are awaiting approval (scroll to the bottom of this page).

This helps ensure we don't trigger CI on this PR until it is actually authorized to do so. Please ping one of the reviewers if you do not have access to approve and run workflows.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the EXIR serialization stack by adding a direct FlatBuffers → Python Program reader and updating deserialization/tests to use it, continuing the move away from JSON/flatc roundtrips introduced in #17333.

Changes:

  • Add _flatbuffer_to_program() to deserialize FlatBuffer bytes directly into executorch.exir.schema.Program dataclasses.
  • Switch deserialize_pte_binary() and related tests to use the new direct reader.
  • Remove the legacy JSON/flatc conversion helpers and their associated tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
exir/_serialize/_flatbuffer_program.py Adds direct FlatBuffers unpack-to-dataclass conversion (including generated-module alias patching) via _flatbuffer_to_program().
exir/_serialize/_program.py Updates deserialize_pte_binary() to use _flatbuffer_to_program() instead of FlatBuffer→JSON→dataclass conversion.
exir/_serialize/_flatbuffer.py Removes JSON/flatc Program conversion helpers that are no longer referenced.
exir/_serialize/test/test_program.py Updates segment-peek tests to use _flatbuffer_to_program() and adds a richer-type deserialization test.
exir/_serialize/test/test_flatbuffer_program.py Simplifies roundtrip testing to only cover the direct Python path.
exir/_serialize/test/test_flatbuffer.py Removes tests for the deleted JSON-to-FlatBuffer Program conversion path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@@ -565,7 +637,7 @@ def test_round_trip_with_segments(self) -> None:
# this also implicity tests the case where we try parsing the entire
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

Typo in the comment: "implicity" should be "implicitly".

Suggested change
# this also implicity tests the case where we try parsing the entire
# this also implicitly tests the case where we try parsing the entire

Copilot uses AI. Check for mistakes.
@chizkiyahu
Copy link
Contributor Author

@JacobSzwejbka @lucylq
This is a follow-up to #17333.

  • Added a flatbuffer-to-program reader
  • Removed the JSON program conversion path

Please let me know if part 2 is too much. I made it a separate commit.

Thanks

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. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: exir Changes to any dialects and passes on these dialects, such as memory planning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants