Shard Windows ASan test runs - #29503
Merged
Merged
Conversation
The windows_x64_asan leg was consistently failing with 'AddressSanitizer: Out of memory. The process has exhausted 8192MB for size class 8192'. This is a per-process ASan primary-allocator size-class arena hitting its fixed ceiling, not a leak. Splitting onnxruntime_test_all across N GoogleTest shards (fresh process each) resets the arena between shards so the peak stays ~1/N. Convert the single cmd build+test step into a job-level SHARD_COUNT knob plus three pwsh steps: write a shared build.py @options file, build once, then run the tests in a shard loop setting GTEST_TOTAL_SHARDS / GTEST_SHARD_INDEX. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Windows x64 AddressSanitizer CI workflow to reduce peak memory usage during unit testing by splitting the test run into multiple GoogleTest shards, executed sequentially in the same job.
Changes:
- Introduces a configurable
SHARD_COUNTjob env var to control GoogleTest sharding. - Splits the previous combined build+test step into separate Build and Test steps with shared
build.pyoptions written to a file. - Runs the test phase in a loop, setting
GTEST_TOTAL_SHARDS/GTEST_SHARD_INDEXper shard and invokingbuild.py --testfor each shard.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
sanaa-hamel-microsoft
approved these changes
Jul 3, 2026
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.
Description
Use GoogleTest sharding (
GTEST_TOTAL_SHARDSandGTEST_SHARD_INDEX) to split up unit tests into multiple runs in Windows ASan CI build.Motivation and Context
AddressSanitizer runs out of memory. Splitting the tests into multiple runs seems to mitigate it.