Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problems found attempting to build on i686 #1500

Merged
merged 3 commits into from
Aug 17, 2022

Conversation

daviesrob
Copy link
Member

  • Improve SIMD detection.

_mm256_extract_epi64(), used by the AVX2 rANS codec, is only available on X86_64. Adding it to the configure tests prevents it from being used on i686. Also change the ax_check_compile_flag test so it runs the linker, which catches missing symbols better than just running the compiler.

  • Fix some overflow warnings in the test_time_funcs program, when time_t is only four bytes long.

  • Silence an annoying gcc-10 format-truncation warning.

Change ax_check_compile_flag to use AC_LINK_IFELSE so that it
can't cheat by making implicit declarations of the symbols
we're testing for.

Include _mm256_extract_epi64() in the AVX2 tests.  This only
exists on X86_64, so trying to build the AVX2 code on i686 didn't
work.
Apparently `if (sizeof(time_t) < 8)` isn't enough to keep the
compiler from warning about the code that only runs when it's
bigger.
It gets upset because in theory the combination of prefix and
filename could be longer than the value snprintf() can return.
Trying to use a filename that long would be somewhat bizarre.
@jkbonfield jkbonfield merged commit b47469a into samtools:develop Aug 17, 2022
@daviesrob daviesrob deleted the i686_fixes branch August 17, 2022 11:04
jkbonfield added a commit to jkbonfield/htscodecs that referenced this pull request Aug 17, 2022
On this platform _mm256_extract_epi64 isn't defined, but the rest of
AVX2 is.  It needs to fail auto-detection.

Also we get unaligned accesses in the SSE4 code with tbuf due to
differing data alignment caused by 32-bit pointers instead of 64-bit.
This exposes an underlying problem of using aligned SIMD writes on
tbuf without explicitly asking for alignment. (The new code is also
sometimes a little faster.)

See also samtools/htslib#1500
daviesrob pushed a commit to samtools/htscodecs that referenced this pull request Aug 25, 2022
On this platform _mm256_extract_epi64 isn't defined, but the rest of
AVX2 is.  It needs to fail auto-detection.

Also we get unaligned accesses in the SSE4 code with tbuf due to
differing data alignment caused by 32-bit pointers instead of 64-bit.
This exposes an underlying problem of using aligned SIMD writes on
tbuf without explicitly asking for alignment. (The new code is also
sometimes a little faster.)

See also samtools/htslib#1500
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.

2 participants