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

The build forces VSX instruction on PowerPC without checking for their support, which breaks the build #307

Closed
barracuda156 opened this issue Jun 13, 2024 · 3 comments · Fixed by #315
Milestone

Comments

@barracuda156
Copy link

INFO:root:/opt/local/bin/gcc-mp-13 -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -arch ppc -isysroot/ -DSHUFFLE_NEON_ENABLED=1 -DHAVE_ZLIB=1 -DHAVE_ZSTD=1 -DH5_USE_18_API -Isrc/hdf5/include -Isrc/hdf5/include/darwin -Isrc/c-blosc2 -Isrc/c-blosc2/blosc -Isrc/c-blosc2/include -Isrc/c-blosc2/internal-complibs/lz4-1.9.4 -Isrc/c-blosc/internal-complibs/zlib-1.2.13 -Isrc/c-blosc2/internal-complibs/zstd-1.5.5 -Isrc/c-blosc2/internal-complibs/zstd-1.5.5/common -Isrc/PyTables/hdf5-blosc2/src -I/opt/local/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/c-blosc2/blosc/b2nd.c -o build/temp.macosx-10.6-ppc-cpython-311/src/c-blosc2/blosc/b2nd.o -std=gnu99 -O3 -ffast-math -pthread
In file included from /usr/include/string.h:148,
                 from src/c-blosc2/include/blosc2/blosc2-common.h:17,
                 from src/c-blosc2/include/blosc2.h:23,
                 from src/c-blosc2/include/b2nd.h:29,
                 from src/c-blosc2/blosc/b2nd.c:11:
In function '__inline_memcpy_chk',
    inlined from 'swap_store' at src/c-blosc2/include/blosc2.h:2159:3,
    inlined from 'b2nd_serialize_meta' at src/c-blosc2/blosc/b2nd.c:84:3:
/usr/include/secure/_string.h:58:10: warning: '*(unsigned int *)pa2_' may be used uninitialized [-Wmaybe-uninitialized]
   58 |   return __builtin___memcpy_chk (__dest, __src, __len, __darwin_obsz0(__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'swap_store',
    inlined from 'b2nd_deserialize_meta' at src/c-blosc2/include/b2nd.h:582:5,
    inlined from 'b2nd_from_schunk' at src/c-blosc2/blosc/b2nd.c:382:3:
src/c-blosc2/include/blosc2.h:2159:3: warning: '*(unsigned int *)pa2_' may be used uninitialized [-Wmaybe-uninitialized]
 2159 |   memcpy(dest, pa2_, size);
      |   ^~~~~~
In function 'swap_store',
    inlined from 'b2nd_deserialize_meta' at src/c-blosc2/include/b2nd.h:582:5,
    inlined from 'b2nd_print_meta' at src/c-blosc2/blosc/b2nd.c:1099:3:
src/c-blosc2/include/blosc2.h:2159:3: warning: '*(unsigned int *)pa2_' may be used uninitialized [-Wmaybe-uninitialized]
 2159 |   memcpy(dest, pa2_, size);
      |   ^~~~~~
INFO:root:/opt/local/bin/gcc-mp-13 -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -arch ppc -isysroot/ -DSHUFFLE_NEON_ENABLED=1 -DHAVE_ZLIB=1 -DHAVE_ZSTD=1 -DH5_USE_18_API -Isrc/hdf5/include -Isrc/hdf5/include/darwin -Isrc/c-blosc2 -Isrc/c-blosc2/blosc -Isrc/c-blosc2/include -Isrc/c-blosc2/internal-complibs/lz4-1.9.4 -Isrc/c-blosc/internal-complibs/zlib-1.2.13 -Isrc/c-blosc2/internal-complibs/zstd-1.5.5 -Isrc/c-blosc2/internal-complibs/zstd-1.5.5/common -Isrc/PyTables/hdf5-blosc2/src -I/opt/local/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/c-blosc2/blosc/b2nd_utils.c -o build/temp.macosx-10.6-ppc-cpython-311/src/c-blosc2/blosc/b2nd_utils.o -std=gnu99 -O3 -ffast-math -pthread
INFO:root:/opt/local/bin/gcc-mp-13 -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -arch ppc -isysroot/ -DSHUFFLE_NEON_ENABLED=1 -DHAVE_ZLIB=1 -DHAVE_ZSTD=1 -DH5_USE_18_API -Isrc/hdf5/include -Isrc/hdf5/include/darwin -Isrc/c-blosc2 -Isrc/c-blosc2/blosc -Isrc/c-blosc2/include -Isrc/c-blosc2/internal-complibs/lz4-1.9.4 -Isrc/c-blosc/internal-complibs/zlib-1.2.13 -Isrc/c-blosc2/internal-complibs/zstd-1.5.5 -Isrc/c-blosc2/internal-complibs/zstd-1.5.5/common -Isrc/PyTables/hdf5-blosc2/src -I/opt/local/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/c-blosc2/blosc/bitshuffle-altivec.c -o build/temp.macosx-10.6-ppc-cpython-311/src/c-blosc2/blosc/bitshuffle-altivec.o -std=gnu99 -O3 -ffast-math -pthread
src/c-blosc2/blosc/bitshuffle-altivec.c: In function 'bitunshuffle1_altivec':
src/c-blosc2/blosc/bitshuffle-altivec.c:132:9: error: '__builtin_vsx_lxvw4x_v16qi' requires the '-mvsx' option
  132 |         xmm0[kk] = vec_xl((ii +kk) * nbyte_row + jj, in_b);
      |         ^~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:132:9: note: overloaded builtin '__builtin_vec_vsx_ld' is implemented by builtin '__builtin_vsx_lxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:170:12: error: '__builtin_altivec_vbpermq2' requires the '-mcpu=power8' and '-mvsx' options
  170 |            tmp = (__vector uint16_t) vec_bperm(xmm, masks[kk]);
      |            ^~~
src/c-blosc2/blosc/bitshuffle-altivec.c:170:12: note: overloaded builtin '__builtin_vec_vbperm_api' is implemented by builtin '__builtin_altivec_vbpermq2'
src/c-blosc2/blosc/bitshuffle-altivec.c: In function 'bshuf_trans_byte_elem_16':
src/c-blosc2/blosc/bitshuffle-altivec.c:188:7: error: '__builtin_vsx_lxvw4x_v16qi' requires the '-mvsx' option
  188 |       xmm0[j] = vec_xl(bytesoftype * i + 16 * j, (const uint8_t*)in);
      |       ^~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:188:7: note: overloaded builtin '__builtin_vec_vsx_ld' is implemented by builtin '__builtin_vsx_lxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:194:7: error: '__builtin_vsx_stxvw4x_v16qi' requires the '-mvsx' option
  194 |       vec_xst(xmm0[j], i + j * size, (uint8_t*)out);
      |       ^~~~~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:194:7: note: overloaded builtin '__builtin_vec_vsx_st' is implemented by builtin '__builtin_vsx_stxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c: In function 'bshuf_trans_byte_elem_32':
src/c-blosc2/blosc/bitshuffle-altivec.c:208:7: error: '__builtin_vsx_lxvw4x_v16qi' requires the '-mvsx' option
  208 |       xmm0[j] = vec_xl(bytesoftype * i + 16 * j, (const uint8_t*)in);
      |       ^~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:208:7: note: overloaded builtin '__builtin_vec_vsx_ld' is implemented by builtin '__builtin_vsx_lxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:214:7: error: '__builtin_vsx_stxvw4x_v16qi' requires the '-mvsx' option
  214 |       vec_xst(xmm0[j], i + j * size, (uint8_t*)out);
      |       ^~~~~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:214:7: note: overloaded builtin '__builtin_vec_vsx_st' is implemented by builtin '__builtin_vsx_stxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c: In function 'bshuf_trans_byte_elem_64':
src/c-blosc2/blosc/bitshuffle-altivec.c:228:7: error: '__builtin_vsx_lxvw4x_v16qi' requires the '-mvsx' option
  228 |       xmm0[j] = vec_xl(bytesoftype * i + 16 * j, (const uint8_t*)in);
      |       ^~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:228:7: note: overloaded builtin '__builtin_vec_vsx_ld' is implemented by builtin '__builtin_vsx_lxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:234:7: error: '__builtin_vsx_stxvw4x_v16qi' requires the '-mvsx' option
  234 |       vec_xst(xmm0[j], i + j * size, (uint8_t*)out);
      |       ^~~~~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:234:7: note: overloaded builtin '__builtin_vec_vsx_st' is implemented by builtin '__builtin_vsx_stxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c: In function 'bshuf_trans_byte_elem_128':
src/c-blosc2/blosc/bitshuffle-altivec.c:248:7: error: '__builtin_vsx_lxvw4x_v16qi' requires the '-mvsx' option
  248 |       xmm0[j] = vec_xl(bytesoftype * i + 16 * j, (const uint8_t*)in);
      |       ^~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:248:7: note: overloaded builtin '__builtin_vec_vsx_ld' is implemented by builtin '__builtin_vsx_lxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:254:7: error: '__builtin_vsx_stxvw4x_v16qi' requires the '-mvsx' option
  254 |       vec_xst(xmm0[j], i + j * size, (uint8_t*)out);
      |       ^~~~~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:254:7: note: overloaded builtin '__builtin_vec_vsx_st' is implemented by builtin '__builtin_vsx_stxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c: In function 'bshuf_trans_bit_byte_altivec':
src/c-blosc2/blosc/bitshuffle-altivec.c:359:5: error: '__builtin_vsx_lxvw4x_v16qi' requires the '-mvsx' option
  359 |     data = vec_xl(ii, in_b);
      |     ^~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:359:5: note: overloaded builtin '__builtin_vec_vsx_ld' is implemented by builtin '__builtin_vsx_lxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:363:7: error: '__builtin_altivec_vbpermq2' requires the '-mcpu=power8' and '-mvsx' options
  363 |       tmp = (__vector uint16_t) vec_bperm(data, masks[kk]);
      |       ^~~
src/c-blosc2/blosc/bitshuffle-altivec.c:363:7: note: overloaded builtin '__builtin_vec_vbperm_api' is implemented by builtin '__builtin_altivec_vbpermq2'
src/c-blosc2/blosc/bitshuffle-altivec.c: In function 'bshuf_trans_byte_bitrow_altivec':
src/c-blosc2/blosc/bitshuffle-altivec.c:439:11: error: '__builtin_vsx_lxvw4x_v16qi' requires the '-mvsx' option
  439 |           xmm0[k] = vec_xl((ii + k) * nbyte_row + jj, in_b);
      |           ^~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:439:11: note: overloaded builtin '__builtin_vec_vsx_ld' is implemented by builtin '__builtin_vsx_lxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:470:11: error: '__builtin_vsx_stxvw4x_v16qi' requires the '-mvsx' option
  470 |           vec_xst(xmm1[k], (jj + k * 2) * nrows + ii, out_b);
      |           ^~~~~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:470:11: note: overloaded builtin '__builtin_vec_vsx_st' is implemented by builtin '__builtin_vsx_stxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:477:9: error: '__builtin_vsx_lxvw4x_v16qi' requires the '-mvsx' option
  477 |         xmm0[k] = vec_xl((ii + k) * nbyte_row + jj, in_b);
      |         ^~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:477:9: note: overloaded builtin '__builtin_vec_vsx_ld' is implemented by builtin '__builtin_vsx_lxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:525:9: error: '__builtin_vsx_stxvw4x_v16qi' requires the '-mvsx' option
  525 |         vec_xst(xmm0[k], (jj + k) * nrows + ii, out_b);
      |         ^~~~~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:525:9: note: overloaded builtin '__builtin_vec_vsx_st' is implemented by builtin '__builtin_vsx_stxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c: In function 'bshuf_shuffle_bit_eightelem_altivec':
src/c-blosc2/blosc/bitshuffle-altivec.c:566:9: error: '__builtin_vsx_lxvw4x_v16qi' requires the '-mvsx' option
  566 |         data = vec_xl(ii + jj, in_b);
      |         ^~~~
src/c-blosc2/blosc/bitshuffle-altivec.c:566:9: note: overloaded builtin '__builtin_vec_vsx_ld' is implemented by builtin '__builtin_vsx_lxvw4x_v16qi'
src/c-blosc2/blosc/bitshuffle-altivec.c:570:11: error: '__builtin_altivec_vbpermq2' requires the '-mcpu=power8' and '-mvsx' options
  570 |           tmp = (__vector uint16_t) vec_bperm(data, masks[kk]);
      |           ^~~
src/c-blosc2/blosc/bitshuffle-altivec.c:570:11: note: overloaded builtin '__builtin_vec_vbperm_api' is implemented by builtin '__builtin_altivec_vbpermq2'
error: command '/opt/local/bin/gcc-mp-13' failed with exit code 1

ERROR Backend subprocess exited when trying to invoke build_wheel
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_python_py-hdf5plugin/py311-hdf5plugin/work/hdf5plugin-4.2.0" && /opt/local/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 -m build --no-isolation --wheel --outdir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_python_py-hdf5plugin/py311-hdf5plugin/work 
Exit code: 1
Error: Failed to build py311-hdf5plugin: command execution failed

VSX is ISA 2.06+, they should be used conditionally.

@kif
Copy link
Member

kif commented Jun 13, 2024

Duplicate of Blosc/c-blosc2#592
which should be re-opened.

@t20100
Copy link
Member

t20100 commented Jun 14, 2024

@barracuda156, can you try building hdf5plugin with the following patch?

diff --git a/src/c-blosc2/blosc/bitshuffle-altivec.c b/src/c-blosc2/blosc/bitshuffle-altivec.c
index 0dd33b8..634396c 100644
--- a/src/c-blosc2/blosc/bitshuffle-altivec.c
+++ b/src/c-blosc2/blosc/bitshuffle-altivec.c
@@ -26,7 +26,7 @@
 #include "bitshuffle-generic.h"
 
 /* Make sure ALTIVEC is available for the compilation target and compiler. */
-#if defined(__ALTIVEC__)
+#if defined(__ALTIVEC__) && defined(__VSX__) && defined(_ARCH_PWR8)
 
 #include "transpose-altivec.h"
 
diff --git a/src/c-blosc2/blosc/shuffle-altivec.c b/src/c-blosc2/blosc/shuffle-altivec.c
index d0077c5..b1d936f 100644
--- a/src/c-blosc2/blosc/shuffle-altivec.c
+++ b/src/c-blosc2/blosc/shuffle-altivec.c
@@ -12,7 +12,7 @@
 #include "shuffle-generic.h"
 
 /* Make sure ALTIVEC is available for the compilation target and compiler. */
-#if defined(__ALTIVEC__)
+#if defined(__ALTIVEC__) && defined(__VSX__) && defined(_ARCH_PWR8)
 
 #include "transpose-altivec.h"
 
diff --git a/src/c-blosc2/blosc/shuffle.h b/src/c-blosc2/blosc/shuffle.h
index 3421e52..21f146d 100644
--- a/src/c-blosc2/blosc/shuffle.h
+++ b/src/c-blosc2/blosc/shuffle.h
@@ -39,7 +39,7 @@
 #define SHUFFLE_USE_SSE2
 #endif
 
-#if defined(SHUFFLE_ALTIVEC_ENABLED) && defined(__ALTIVEC__)
+#if defined(SHUFFLE_ALTIVEC_ENABLED) && defined(__ALTIVEC__) && defined(__VSX__) && defined(_ARCH_PWR8)
 #define SHUFFLE_USE_ALTIVEC
 #endif

With this patch, on Ubuntu20.04 on Power9 it compiles blosc2 with the altivec implementation, and trying to compile with -mcpu=power6|power7|power8 also works.

@t20100
Copy link
Member

t20100 commented Jul 5, 2024

This will be fixed by updating the embedded version of c-blosc2 to >= v2.15.0.
Actually waiting for a c-blosc2 release including Blosc/c-blosc2#622.

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 a pull request may close this issue.

3 participants