Skip to content

Reduce allocation size in test Gather_oveflow_check from 4GiB to >2GiB#27483

Merged
adrianlizarraga merged 4 commits intomainfrom
adrianl/AndroidTestOoM_Fix
Feb 28, 2026
Merged

Reduce allocation size in test Gather_oveflow_check from 4GiB to >2GiB#27483
adrianlizarraga merged 4 commits intomainfrom
adrianl/AndroidTestOoM_Fix

Conversation

@adrianlizarraga
Copy link
Copy Markdown
Contributor

@adrianlizarraga adrianlizarraga commented Feb 27, 2026

Description

This PR reduces the size of the memory allocation for expected outputs from ~4GiB to ~2GiB in the Gather_overflow_check test. The updated test still verifies that the integer overflow fix from PR #27444 is valid. That is, that the CPU Gather operator correctly handles output tensors with element counts that exceed INT32_MAX.

Changes:

  • Reduced test dimension from 65537 to 46341 (output shape from 65537×65537 to 46341×46341), which results in a total number of elements that is just over INT32_MAX, which is required to test the bug fix.
    • The peak memory usage is reduced to ~4GiB + overhead.
  • Increase Android emulator memory to 5GiB (from 4GiB) to be able to run the test.

Motivation

Android CI fails to run the unit test introduced in #27444 due to memory usage that exceeds the Android emulator's default memory of 4GiB. This PR lowers the peak memory usage of the unit test and increases the Android emulator's memory by 1GiB.

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 reduces the memory allocation in the Gather_overflow_check test from ~4GiB to ~2.1GiB while maintaining the test's effectiveness in verifying the integer overflow fix from PR #27444. The test validates that the CPU Gather operator correctly handles output tensors with dimensions that exceed INT32_MAX.

Changes:

  • Reduced test dimension from 65537 to 46341 (output shape from 65537×65537 to 46341×46341)
  • Updated comments to reflect the new dimensions and calculation (2,147,488,281 elements, just over INT32_MAX)
  • Removed the 32-bit platform skip since the new allocation size no longer overflows size_t on 32-bit platforms

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

…ize. Increase Android emulator memory to 5GiB
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 2 out of 2 changed files in this pull request and generated 3 comments.


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

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 2 out of 2 changed files in this pull request and generated 2 comments.


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

@adrianlizarraga adrianlizarraga marked this pull request as ready for review February 27, 2026 23:23
@adrianlizarraga adrianlizarraga merged commit 0768f42 into main Feb 28, 2026
97 of 106 checks passed
@adrianlizarraga adrianlizarraga deleted the adrianl/AndroidTestOoM_Fix branch February 28, 2026 03:56
tianleiwu pushed a commit that referenced this pull request Feb 28, 2026
#27483)

### Description
This PR reduces the size of the memory allocation for expected outputs
from ~4GiB to ~2GiB in the Gather_overflow_check test. The updated test
still verifies that the integer overflow fix from PR
#27444 is valid. That is,
that the CPU Gather operator correctly handles output tensors with
element counts that exceed INT32_MAX.

Changes:

- Reduced test dimension from 65537 to 46341 (output shape from
65537×65537 to 46341×46341), which results in a total number of elements
that is just over INT32_MAX, which is required to test the bug fix.
  - The peak memory usage is reduced to ~4GiB + overhead.
- Increase Android emulator memory to 5GiB (from 4GiB) to be able to run
the test.

### Motivation
Android CI fails to run the unit test introduced in
#27444 due to memory usage
that exceeds the Android emulator's default memory of 4GiB. This PR
lowers the peak memory usage of the unit test and increases the Android
emulator's memory by 1GiB.
tianleiwu added a commit that referenced this pull request Feb 28, 2026
This cherry-picks the following commits for the release:

| Commit ID | PR Number | Commit Title |
|-----------|-----------|-------------|
| 2604d31 | #27480 | Move JAR testing pipelines to canonical pipeline
template |
| 0768f42 | #27483 | Reduce allocation size in test
Gather_oveflow_check from 4GiB to >2GiB |

---------

Co-authored-by: eserscor <erscor@microsoft.com>
Co-authored-by: Adrian Lizarraga <adlizarraga@microsoft.com>
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.

4 participants