Skip to content

Make BundleIO ATOL/RTOL configurable per-test via runtime args#18739

Open
BryanBradfo wants to merge 1 commit intopytorch:mainfrom
BryanBradfo:bryanbradfo/configurable-bundleio-tolerances
Open

Make BundleIO ATOL/RTOL configurable per-test via runtime args#18739
BryanBradfo wants to merge 1 commit intopytorch:mainfrom
BryanBradfo:bryanbradfo/configurable-bundleio-tolerances

Conversation

@BryanBradfo
Copy link
Copy Markdown

@BryanBradfo BryanBradfo commented Apr 7, 2026

Summary

Previously ATOL/RTOL were compile-time constants baked into the executor runner binary, applied uniformly to all models. This masked numerical regressions on models that could pass with tighter bounds.

  • Add -atol and -rtol CLI args to the semihosting runner for runtime override
  • Tighten defaults from 0.01 to 1e-3
  • Remove hardcoded -DET_ATOL=5.0 -DET_RTOL=1.0 from build_test_runner.sh
  • Add per-model tolerance lookup table in test_cortex_m_e2e.sh

Fixes #18424

Test plan

Ran bash .ci/scripts/test_cortex_m_e2e.sh mv2 on Corstone-300 FVP:

  • Confirmed runtime args are parsed: Setting atol to 5.000000 / Setting rtol to 2.500000
  • Confirmed Test_result: PASS with calibrated tolerances (ATOL=5.0, RTOL=2.5)
  • Confirmed Test_result: FAIL with zero tolerances (-atol 0.0 -rtol 0.0), proving runtime override works

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @psiddh @AdrianLundell, @rascani, @AdrianLundell

Copilot AI review requested due to automatic review settings April 7, 2026 15:48
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Apr 7, 2026

🔗 Helpful Links

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

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

⚠️ 13 Awaiting Approval

As of commit d85f1a5 with merge base c11ba1b (image):

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

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 Apr 7, 2026
Copy link
Copy Markdown
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 makes BundleIO output-comparison tolerances (ATOL/RTOL) configurable per test run for the ARM semihosting executor_runner, enabling tighter defaults while allowing per-model overrides in Cortex-M end-to-end tests.

Changes:

  • Add runtime -atol / -rtol CLI args to the semihosting runner and tighten default tolerances to 1e-3.
  • Remove hardcoded tolerance compile definitions from the Cortex-M test runner build script.
  • Add a per-model tolerance lookup table in the Cortex-M e2e script and pass tolerances through the FVP semihosting command line.

Reviewed changes

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

File Description
examples/arm/executor_runner/CMakeLists.txt Tightens default ET_ATOL/ET_RTOL CMake cache values and fixes RTOL help text.
examples/arm/executor_runner/arm_executor_runner.cpp Introduces runtime -atol/-rtol overrides for BundleIO comparisons and updates defaults/usage text.
backends/cortex_m/test/build_test_runner.sh Stops baking relaxed ATOL/RTOL into the runner binary at build time.
.ci/scripts/test_cortex_m_e2e.sh Adds per-model tolerances and forwards them to the runner via semihosting cmd line.

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

@BryanBradfo BryanBradfo force-pushed the bryanbradfo/configurable-bundleio-tolerances branch from 1c01def to 143c585 Compare April 7, 2026 15:55
Copilot AI review requested due to automatic review settings April 7, 2026 16:00
@BryanBradfo BryanBradfo force-pushed the bryanbradfo/configurable-bundleio-tolerances branch from 143c585 to 7abb0a6 Compare April 7, 2026 16:00
@BryanBradfo
Copy link
Copy Markdown
Author

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot bot added the release notes: none Do not include this in the release notes label Apr 7, 2026
Copy link
Copy Markdown
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

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


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

Previously tolerances were compile-time constants (ET_ATOL=5.0, ET_RTOL=1.0) baked into the executor runner binary, applied uniformly to all models. This masked numerical regressions on precise models.

Add -atol and -rtol CLI args to the semihosting runner so tolerances can be set per-model at runtime. Tighten defaults to 1e-3 and move per-model overrides to a lookup table in test_cortex_m_e2e.sh.

Resolves pytorch#18424
@BryanBradfo BryanBradfo force-pushed the bryanbradfo/configurable-bundleio-tolerances branch from 7abb0a6 to d85f1a5 Compare April 7, 2026 19:50
@nil-is-all nil-is-all added module: arm Issues related to arm backend module: microcontrollers For embedded MCUs like Cortex-M, or RTOS like Zephyr, does not track NPU backend like Arm Ethos. labels Apr 7, 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: arm Issues related to arm backend module: microcontrollers For embedded MCUs like Cortex-M, or RTOS like Zephyr, does not track NPU backend like Arm Ethos. release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ATOL and RTOL should probably be configurable per-test. Ideally, we also make the defaults as small as possible and override it on tests that need it.

3 participants