Skip to content

Use PTEFile class in serialize_pte_binary#15801

Merged
meta-codesync[bot] merged 6 commits intogh/lucylq/126/basefrom
gh/lucylq/126/head
Nov 18, 2025
Merged

Use PTEFile class in serialize_pte_binary#15801
meta-codesync[bot] merged 6 commits intogh/lucylq/126/basefrom
gh/lucylq/126/head

Conversation

@lucylq
Copy link
Contributor

@lucylq lucylq commented Nov 13, 2025

Stack from ghstack (oldest at bottom):

Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.

Differential Revision: D86908241

Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 13, 2025

🔗 Helpful Links

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

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

❌ 6 New Failures, 3 Unrelated Failures

As of commit 41d4aca with merge base b1e3e28 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but were 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.

@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 Nov 13, 2025
@github-actions
Copy link

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.

@lucylq lucylq mentioned this pull request Nov 13, 2025
Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)

[ghstack-poisoned]
get_common_executorch_program,
)
from executorch.exir._serialize import _serialize_pte_binary
from executorch.exir._serialize import _PTEFile, _serialize_pte_binary
Copy link
Contributor

Choose a reason for hiding this comment

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

why _PTEFile but not PTEFile

Copy link
Contributor

Choose a reason for hiding this comment

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

Is PTEFile supposed to be private only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly following _serialize_pte_binary and _deserialize_pte_binary ...

I think those are fairly public though haha

Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Nov 14, 2025
Pull Request resolved: #15801

Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.
ghstack-source-id: 323125958
@exported-using-ghexport

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)
Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Nov 14, 2025
Pull Request resolved: #15801

Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.
ghstack-source-id: 323439314
@exported-using-ghexport

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)
@mergennachin mergennachin requested a review from Copilot November 17, 2025 15:41
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 pull request refactors the serialize_pte_binary function to accept a PTEFile class instance instead of separate parameters (program, mutable_data, named_data). This change improves the API design by grouping related data into a single structured object.

Key Changes:

  • Introduced PTEFile class to encapsulate program and segment data
  • Updated serialize_pte_binary to accept pte_file parameter instead of individual parameters
  • Refactored all call sites across the codebase to use the new API

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
exir/lowered_backend_module.py Updated to construct _PTEFile object when calling _serialize_pte_binary
exir/backend/test/test_compatibility.py Updated test cases to use _PTEFile wrapper
exir/_serialize/test/test_program.py Updated test cases to use PTEFile wrapper with program and named_data
exir/_serialize/_serialize.py Updated to construct PTEFile object when calling serialize_pte_binary
exir/_serialize/_program.py Modified function signature to accept pte_file parameter and access fields via the object
devtools/bundled_program/test/test_bundle_data.py Updated test to construct _PTEFile object for serialization

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

Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Nov 17, 2025
Pull Request resolved: #15801

Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.
ghstack-source-id: 323439314
@exported-using-ghexport

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)
Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Nov 17, 2025
Pull Request resolved: #15801

Take in a PTE file for serialization instead of program, mutable_segments, named_data segments separately.
ghstack-source-id: 323860790
@exported-using-ghexport

Differential Revision: [D86908241](https://our.internmc.facebook.com/intern/diff/D86908241/)
@meta-codesync meta-codesync bot merged commit d4e8fda into gh/lucylq/126/base Nov 18, 2025
162 of 173 checks passed
@meta-codesync meta-codesync bot deleted the gh/lucylq/126/head branch November 18, 2025 06:10
lucylq added a commit that referenced this pull request Nov 18, 2025
Differential Revision: D86908241

Pull Request resolved: #15801
lucylq added a commit that referenced this pull request Nov 18, 2025
manual merge to main of:
#15801

from branch gh/lucylq/126/base
jirioc pushed a commit to nxp-upstream/executorch that referenced this pull request Dec 19, 2025
manual merge to main of:
pytorch#15801

from branch gh/lucylq/126/base
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. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants