Arm backend: Seed tests before collection#20183
Merged
zingo merged 1 commit intoJun 11, 2026
Merged
Conversation
Seed the Arm test RNG during pytest configuration so module-level random inputs are deterministic before test collection imports model test modules. Keep the per-test seeding fixture for reproducible test execution. This will make tests behave less random and hopefully fix some flakeynes in testing/CI. For example test_dl3_arm.py failes about 5% of the time before this fix due to it getting non seeded random numbers. Signed-off-by: Zingo Andersen <Zingo.Andersen@arm.com> Change-Id: I7fa266477cfcb80e5e41bef075a6bf850a6d622a
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20183
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New Failures, 2 Unclassified FailuresAs of commit 5c3e595 with merge base 10bc51e ( NEW FAILURES - The following jobs have failed:
UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
There was a problem hiding this comment.
Pull request overview
Seeds the Arm backend test RNG earlier in the pytest lifecycle (during pytest_configure) so that module-level random/Torch-generated inputs are deterministic during test module import/collection, while keeping the per-test autouse seeding for reproducible execution.
Changes:
- Call the random seeding logic from
pytest_configureto ensure deterministic behavior before test collection imports modules. - Refactor the existing autouse seeding fixture to delegate to a shared
_set_random_seed()helper. - Adjust seed-printing to differentiate
RANDOMvs fixed-seed output.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
89
to
+93
| if seed_env == "RANDOM": | ||
| random.seed() # reset seed, in case any other test has fiddled with it | ||
| seed = random.randint(0, 2**32 - 1) # nosec B311 - non-crypto seed for tests | ||
| torch.manual_seed(seed) | ||
| print(f" ARM_TEST_SEED=RANDOM using:{seed} ", end=" ") |
rascani
approved these changes
Jun 10, 2026
zingo
force-pushed
the
Arm-backend-Seed-tests-before-collection
branch
from
June 11, 2026 06:50
0ab0ddc to
5c3e595
Compare
Comment on lines
89
to
+93
| if seed_env == "RANDOM": | ||
| random.seed() # reset seed, in case any other test has fiddled with it | ||
| seed = random.randint(0, 2**32 - 1) # nosec B311 - non-crypto seed for tests | ||
| torch.manual_seed(seed) | ||
| print(f" ARM_TEST_SEED=RANDOM using:{seed} ", end=" ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Seed the Arm test RNG during pytest configuration so module-level random inputs are deterministic before test collection imports model test modules. Keep the per-test seeding fixture for reproducible test execution.
This will make tests behave less random and hopefully fix some flakeynes in testing/CI.
For example test_dl3_arm.py failes about 5% of the time before this fix due to it getting non seeded random numbers.
cc @digantdesai @freddan80 @per @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani