Skip to content

BUG: Off by one in memory overlap check#27077

Merged
charris merged 2 commits into
numpy:maintenance/2.0.xfrom
charris:backport-26972
Jul 30, 2024
Merged

BUG: Off by one in memory overlap check#27077
charris merged 2 commits into
numpy:maintenance/2.0.xfrom
charris:backport-26972

Conversation

@charris

@charris charris commented Jul 30, 2024

Copy link
Copy Markdown
Member

Backport of #26972.

An off-by-one in the nomemoverlap check caused heisenbugs in platforms where the SIMD and non-SIMD code paths produced different results, due to arrays which semi-randomly got allocated adjacent to the input array failed the test and used the uncommon non-SIMD fallback.

This PR was originally part of #26956, but split at the request of @seberg as well as fixed after a bug he noticed in the originally suggested fix.

yairchu added 2 commits July 29, 2024 18:42
The test fails when compiling on clang with "-ffp-contract=off", due to a combination of factors:
* Difference between SIMD and non-SIMD loops
* nomemoverlap falling back to non-SIMD loop due to off-by-one bug
The original check (since introduced in 085cdbe) returned overlap for adjacent arrays.

This fixes one of the factors causing test_repeated_square_consistency failure, so the test should now always pass.
@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Jul 30, 2024
@charris charris added this to the 2.0.2 release milestone Jul 30, 2024
@charris charris merged commit 4f0dcfa into numpy:maintenance/2.0.x Jul 30, 2024
@charris charris deleted the backport-26972 branch July 30, 2024 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00 - Bug 08 - Backport Used to tag backport PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants