Skip to content

Shard Windows ASan test runs - #29503

Merged
edgchen1 merged 4 commits into
mainfrom
edgchen1/shard_win_asan_tests
Jul 3, 2026
Merged

Shard Windows ASan test runs#29503
edgchen1 merged 4 commits into
mainfrom
edgchen1/shard_win_asan_tests

Conversation

@edgchen1

@edgchen1 edgchen1 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

Use GoogleTest sharding (GTEST_TOTAL_SHARDS and GTEST_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.

edgchen1 and others added 2 commits July 2, 2026 14:54
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>
@edgchen1
edgchen1 requested a review from tianleiwu July 2, 2026 22:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

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 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_COUNT job env var to control GoogleTest sharding.
  • Splits the previous combined build+test step into separate Build and Test steps with shared build.py options written to a file.
  • Runs the test phase in a loop, setting GTEST_TOTAL_SHARDS/GTEST_SHARD_INDEX per shard and invoking build.py --test for each shard.

Comment thread .github/workflows/windows_build_x64_asan.yml
Comment thread .github/workflows/windows_build_x64_asan.yml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@edgchen1
edgchen1 merged commit abe7ba9 into main Jul 3, 2026
104 of 108 checks passed
@edgchen1
edgchen1 deleted the edgchen1/shard_win_asan_tests branch July 3, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants