You signed in with another tab or window. Reload to refresh your session.
8000
You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AVX-512 encoder path fails to compile with GCC: __m512d / __m512i mixed without casts #49
The #ifdef __AVX512F__ exception-detection block in include/alp/encoder.hpp mixes floating-point and integer vector types without casts. Clang accepts this; GCC rejects it, so any translation unit that includes alp.hpp fails to build with GCC when AVX-512 is enabled (e.g. -march=native on an AVX-512 host, or -mavx512f).
Where (main, 31ca0ed):
Double branch, line 356: __m512i index = _mm512_loadu_pd(DOUBLE_INDEX_ARR + i); assigns a __m512d to a __m512i. Line 358 then passes index to _mm512_mask_compressstoreu_pd, which expects a __m512d.
Float branch, line 367: index is an __m512i loaded with _mm512_loadu_si512, but it is passed to _mm512_mask_compressstoreu_ps, which expects a __m512.
Error (GCC 14.2.0, Debian 14.2.0-19, x86-64 with AVX-512, -O3 -march=native):
include/alp/encoder.hpp:356:...: error: cannot convert '__m512d' to '__m512i' in initialization
include/alp/encoder.hpp:358:109: error: cannot convert '__m512i' to '__m512d'
358 | _mm512_mask_compressstoreu_pd(TMP_INDEX_ARR + exceptions_idx, is_exception, index);
Adding -flax-vector-conversions does not make it compile. Clang 19 / Apple clang 21 compile it.
Suggested fix (bit-for-bit identical behaviour, since only register types change):
Double branch: declare __m512d index = _mm512_loadu_pd(DOUBLE_INDEX_ARR + i);.
Float branch: load with _mm512_loadu_ps into a __m512, or pass _mm512_castsi512_ps(index).
The code only matters for encoding; decoding never reaches it. Thanks for ALP. We hit this while benchmarking it as a page encoding for a columnar storage engine.
Activity