Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Sync scalar_type.fbs and extend test to check all copies#17085

Merged
lucylq merged 8 commits into
pytorch:mainfrom
mohammed-saalim:scalar-type-fbs-sync-test
Feb 4, 2026
Merged

Sync scalar_type.fbs and extend test to check all copies#17085
lucylq merged 8 commits into
pytorch:mainfrom
mohammed-saalim:scalar-type-fbs-sync-test

Conversation

@mohammed-saalim

@mohammed-saalim mohammed-saalim commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #11572
This PR:

  1. Extends the existing test in devtools/bundled_program/schema/test/test_schema.py to check all 4 copies of scalar_type.fbs
  2. Syncs extension/flat_tensor/serialize/scalar_type.fbs which was out of date (missing FLOAT8E* and UINT* types)
    The test now validates that these 4 files remain in sync:
  • schema/scalar_type.fbs (canonical)
  • devtools/bundled_program/schema/scalar_type.fbs
  • devtools/etdump/scalar_type.fbs
  • extension/flat_tensor/serialize/scalar_type.fbs
    Uses subTest() for clearer error messages when files drift out of sync.

cc @JacobSzwejbka @angelayi

Copilot AI review requested due to automatic review settings February 2, 2026 03:45
@pytorch-bot

pytorch-bot Bot commented Feb 2, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 4 New Failures

As of commit e22e231 with merge base b698260 (image):

NEW FAILURES - The following jobs have 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 Feb 2, 2026
@mohammed-saalim

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: none"

Copilot AI 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.

Pull request overview

This PR keeps all copies of scalar_type.fbs in sync across the repository and adds a regression test to ensure they stay synchronized, addressing issue #11572.

Changes:

  • Updated extension/flat_tensor/serialize/scalar_type.fbs to match the canonical schema/scalar_type.fbs, including FLOAT8E* and UINT* scalar types and aligned header comments.
  • Replaced the previous one-off equality check in test_schema.py with a subtest-based loop that verifies all known copies of scalar_type.fbs match the canonical schema and emits clearer, tooling-agnostic error messages.

Reviewed changes

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

File Description
extension/flat_tensor/serialize/scalar_type.fbs Synchronizes this schema copy with the canonical schema/scalar_type.fbs, including new FLOAT8 and UINT scalar types and matching header comments.
devtools/bundled_program/schema/test/test_schema.py Expands test_schema_sync to validate all four scalar_type.fbs copies against the canonical schema using subTest() and updates the failure message to a generic, OSS-friendly sync instruction.

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

@lucylq

lucylq commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Hi @mohammed-saalim, changes look good. Thank you so much for adding this. Given the source of truth is in executorch/schema, could we move this test to https://github.com/pytorch/executorch/tree/main/schema/test?

Comment thread schema/test/test_schema.py
Move test to schema/test per maintainer request
@mohammed-saalim

mohammed-saalim commented Feb 2, 2026

Copy link
Copy Markdown
Contributor Author

made changes as suggested. @lucylq

Copilot AI 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.

Pull request overview

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

Comments suppressed due to low confidence (1)

devtools/bundled_program/schema/test/test_schema.py:1

  • Removing this test file will leave the internal BUCK target at devtools/bundled_program/schema/test/BUCK with a python_unittest that still lists test_schema.py in srcs, which will cause that target to fail to build or run; please either update the BUCK rule to point at the new shared test under schema/test/test_schema.py or keep a thin wrapper test in this directory so the declared target remains valid.

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

@lucylq

lucylq commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Thanks @mohammed-saalim. I had a check and I think this isn't covered by CI because there weren't python tests in this directory before. Can you add the schema/ directory to pytest.ini, and keep an eye on the unittest ci jobs (e.g. unittest / linux / linux-job, and the macos/windows equivalents), to make sure it's running and passing?

For example, see the test: https://github.com/pytorch/executorch/actions/runs/21601350041/job/62247864130#step:16:15427

---------- coverage: platform linux, python 3.10.19-final-0 ----------
Coverage XML written to file coverage.xml

================ 1348 passed, 11 skipped in 2615.36s (0:43:35) =================

I guess we want to check that schema/test_schema.py appears in the logs.

Move test to schema/test per maintainer request
@lucylq

lucylq commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Pull request overview

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

Comments suppressed due to low confidence (1)
devtools/bundled_program/schema/test/test_schema.py:1

  • Removing this test file will leave the internal BUCK target at devtools/bundled_program/schema/test/BUCK with a python_unittest that still lists test_schema.py in srcs, which will cause that target to fail to build or run; please either update the BUCK rule to point at the new shared test under schema/test/test_schema.py or keep a thin wrapper test in this directory so the declared target remains valid.

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

@mohammed-saalim sorry last one - can you also remove the BUCK target here? https://github.com/pytorch/executorch/blob/main/devtools/bundled_program/schema/test/BUCK#L12-L17

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@mohammed-saalim

Copy link
Copy Markdown
Contributor Author

@lucylq my bad! i have removed it. Anything else?

@lucylq

lucylq commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

@mohammed-saalim I think that's all good. Thanks for the edits and feel free to merge it once the tests are good 🎉

I don't think this should cause any test failures/github should indicate any flaky tests, but if there are you can check https://hud.pytorch.org/hud/pytorch/executorch/main/1?per_page=50 to see if it's an existing failure (that github didn't catch), or ping me to double check.

We may want to add a BUCK target to schema/test but I can do that in a follow-up and test with the internal buck build.

@lucylq

lucylq commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

@mohammed-saalim seems like there's a linter issue, do you mind fixing it? You can fix it manually or install the lintrunner following: https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md#lintrunner

>>> Lint for devtools/bundled_program/schema/test/BUCK:

  Error (NEWLINE) Trailing newline
    Trailing newline found. Run `lintrunner --take NEWLINE -a` to apply
    changes.

    You can run `lintrunner -a` to apply this patch.

     7   7 | # !!!! fbcode/executorch/devtools/bundled_program/schema/test/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!!
     8   8 | 
     9   9 | load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest")
     9     |-
    10     |-

+ echo ''

Copilot AI review requested due to automatic review settings February 3, 2026 21:50

Copilot AI 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.

Pull request overview

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


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

Comment thread schema/test/test_schema.py Outdated
Copilot AI review requested due to automatic review settings February 3, 2026 21:58

Copilot AI 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.

Pull request overview

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


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

@mohammed-saalim

Copy link
Copy Markdown
Contributor Author

@lucylq The 3 failing checks appear to be infrastructure issues unrelated to my changes:

2 Windows build failures
ARM backend Docker container failure (was already flagged as flaky in the original PR)
The Lint check is now passing after fixing the trailing newline. Let me know if you'd like me to investigate further, but these seem to be pre-existing issues on trunk.

@lucylq lucylq merged commit 6f780c7 into pytorch:main Feb 4, 2026
150 of 154 checks passed
@lucylq

lucylq commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

@mohammed-saalim merged. Thank you for your contribution!

@nil-is-all nil-is-all added the module: exir Issues related to Export IR and the code under exir/ label Mar 25, 2026
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. module: exir Issues related to Export IR and the code under exir/ release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test to ensure scalar_type.fbs remains in sync across the executorch repo

4 participants