Skip to content

Fix for index out of bounds in sve scatter test#128419

Merged
dhartglassMSFT merged 2 commits into
dotnet:mainfrom
dhartglassMSFT:128311
May 22, 2026
Merged

Fix for index out of bounds in sve scatter test#128419
dhartglassMSFT merged 2 commits into
dotnet:mainfrom
dhartglassMSFT:128311

Conversation

@dhartglassMSFT
Copy link
Copy Markdown
Contributor

Test Sve_Scatter8BitNarrowing_long_ulong gets "Index 1031 exceeds array length 1024" on osx arm64. This assert comes out of test setup

I could not reproduce this locally - a couple of these ScatterNBitNarrowing tests failed sporadically across different pipelines, but locally I couldn't get the RNG to line up.

The error itself is printed when the test input array contains out of bounds data. Likely a problem with test setup - SveScatterVector.template (see MakeDistinct) already clamps its index values to array length, so the same fix is needed in SveScatterVectorBases.template

fixes #128311

@dhartglassMSFT dhartglassMSFT requested review from SwapnilGaikwad and Copilot and removed request for Copilot May 20, 2026 22:50
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 20, 2026
@dhartglassMSFT
Copy link
Copy Markdown
Contributor Author

Hey @SwapnilGaikwad added you on this one, history says you edited these a while ago

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copilot AI review requested due to automatic review settings May 21, 2026 01:51
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 updates the SVE scatter test template setup logic to prevent generated scatter index values from exceeding the output buffer length, addressing a sporadic “Index … exceeds array length 1024” assertion during test construction.

Changes:

  • Fix MakeDistinct to keep indices within [0, OutElementCount) by wrapping with modulo when resolving duplicates.
  • Adjust the duplicate-handling step from += sizeof(...) (which can push indices out of range) to + 1 with clamping.
  • Minor comment grammar fix (“exists”).

Copy link
Copy Markdown
Contributor

@SwapnilGaikwad SwapnilGaikwad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@JulieLeeMSFT JulieLeeMSFT added this to the 11.0.0 milestone May 21, 2026
@dhartglassMSFT dhartglassMSFT enabled auto-merge (squash) May 21, 2026 23:43
Copy link
Copy Markdown
Contributor

@adamperlin adamperlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, especially if this behavior exists already in a similar test.

@dhartglassMSFT dhartglassMSFT merged commit 30359c8 into dotnet:main May 22, 2026
94 of 98 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot modified the milestones: 11.0.0, 11.0-preview6 May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ci-scan] Test failure: Sve_Scatter8BitNarrowing_long_ulong Index exceeds array length on osx-arm64

5 participants