Skip to content

[Espressif] Verify BundleIO tolerances from the generated header - #26098

Closed
rascani wants to merge 1 commit into
pytorch:mainfrom
rascani:esp32-tolerance-header
Closed

rascani wants to merge 1 commit into
pytorch:mainfrom
rascani:esp32-tolerance-header

Conversation

@rascani

@rascani rascani commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Tolerances for BundleIO verification are currently compile definitions, so the ESP-NN emulator loop reconfigures the firmware for every tolerance group. This prototype removes them as build parameters for the loop: pte_to_header.py emits model_atol and model_rtol constants in the generated model header from a tolerance file, the ESP-IDF component build treats that file as a header dependency and skips the ET_ATOL/ET_RTOL compile definitions when it is given, and the runner reads the header constants when no definition is given. The ESP-NN loop configures the firmware once and stages each program and its tolerances at fixed paths, so each case only rebuilds. The define path is unchanged for builds without a tolerance file, including the smoke firmware and the operator-library tests, which still pass -DET_ATOL/-DET_RTOL. The standalone (non-ESP-IDF) build is unchanged in behavior: it never defined the tolerances and now reads the header defaults of 0.01.

Authored with AI assistance using Muse Code powered by muse-latest.

Test plan

Local verification: bash -n and shellcheck pass on .ci/scripts/test_espressif.sh, and pte_to_header.py compiles and rejects malformed tolerance files (wrong count, non-numeric, non-finite) with clear errors. A simulation ran the loop text from the script against a tiny CMake project mirroring the new mechanics: one configure for four interleaved cases (no ET_ATOL passed), every case ran with its own model bytes and tolerances, the exact tolerance representation was preserved in the header, the define path still won when -DET_ATOL/-DET_RTOL were given, and the default path stayed at 0.01.

The Test ESP32 Emulators workflow on this pull request is the verification run. It should show the ESP-NN loop's logged step total falling from the 200 to 232 second range with tolerance grouping to a single configure plus incremental builds, with the same 24 ESP-NN cases passing on each emulator job, and the smoke firmware and operator-library implementation tests passing on the unchanged define path.

Tolerances are currently compile definitions, so running programs with different tolerances needs a reconfigure per tolerance group. Let the generated model header carry them instead: pte_to_header.py emits model_atol and model_rtol from a tolerance file, the ESP-IDF component build adds the file as a header dependency and skips the compile definitions when it is given, and the runner reads the header constants when no definition is given. The define path is unchanged for builds without a tolerance file, including the smoke firmware and the operator-library tests. The ESP-NN loop configures the firmware once and stages each program and its tolerances at fixed paths.

Authored with AI assistance using Muse Code powered by muse-latest.
@pytorch-bot

pytorch-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 56 Pending

As of commit 6db0541 with merge base b2e7366 (image):
💚 Looks good so far! There are no failures yet. 💚

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 Dec 4, 2026
@rascani

rascani commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Closing: this prototype was rejected in review as too convoluted for the saving over tolerance grouping. The grouping approach in #26097 is the way forward instead.

@rascani rascani closed this Dec 4, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant