Skip to content

MAINT: Mark npy_memchr with no_sanitize("alignment") on clang#21467

Merged
charris merged 1 commit intonumpy:mainfrom
seberg:mark-no-sanitize-on-npy-memchr
May 9, 2022
Merged

MAINT: Mark npy_memchr with no_sanitize("alignment") on clang#21467
charris merged 1 commit intonumpy:mainfrom
seberg:mark-no-sanitize-on-npy-memchr

Conversation

@seberg
Copy link
Copy Markdown
Member

@seberg seberg commented May 6, 2022

Clangs sanitizer reports unaligned access here, which is correct
but intentional. It may well be that the code would be better of
trying to avoid this unaligned access (and rather vectorizing harder).

But, this is a bit of a tricky choice, since we have to optimize for
different use-cases (in particular very short scans may be interesting).

So changing this would best be done together with some more careful
benchmarks.

See also gh-21117, which introduced manual loop unrolling to avoid the
unaligned access.

Closes gh-21116

@seberg seberg added the 09 - Backport-Candidate PRs tagged should be backported label May 6, 2022
Clangs sanitizer reports unaligned access here, which is correct
but intentional.  It may well be that the code would be better of
trying to avoid this unaligned access (and rather vectorizing harder).

But, this is a bit of a tricky choice, since we have to optimize for
different use-cases (in particular very short scans may be interesting).

So changing this would best be done together with some more careful
benchmarks.

See also numpygh-21117, which introduced manual loop unrolling to avoid the
unaligned access.

Closes numpygh-21116
@seberg seberg force-pushed the mark-no-sanitize-on-npy-memchr branch from bc1efb3 to 3257ab0 Compare May 6, 2022 13:42
@charris charris merged commit b0b912f into numpy:main May 9, 2022
@charris
Copy link
Copy Markdown
Member

charris commented May 9, 2022

Thanks Sebastian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: npy_memchr has misaligned memory access

2 participants