#2530: Thorn Vectors fails to compile using gcc 8.X on POWER9
Reporter: Roland Haas Status: new Milestone: Version: development version Type: bug Priority: minor Component: EinsteinToolkit thorn
Vectors provides SIMD instructions for doubles on POWER9 using the `vec_st` intrinsic for aligned stores. However that intrinsic seems to differ in gcc 8 and gcc 9.
This demo code:
``` #if 0 g++ -mcpu=power9 -mvsx $0 exit #endif
#include <altivec.h>
#define CCTK_REAL8 double typedef vector double CCTK_REAL8_VEC;
static inline void vec8_store(CCTK_REAL8 &p, CCTK_REAL8_VEC x) { vec_st(x, 0 , &p); }
int main(void) { CCTK_REAL8 p[2]; CCTK_REAL8_VEC x; vec8_store(p[0], x); return 0; } ```
demonstrates the issue and fails to compile when using eg `module load gcc/8.1.0` on summit but is fine with `module load gcc/9.1.0`:
```plaintext $ bash vec.cc vec.cc: In function 'void vec8_store(double&, CCTK_REAL8_VEC)': vec.cc:13:19: error: invalid parameter combination for AltiVec intrinsic '__builtin_vec_st' vec_st(x, 0 , &p); ```
Replacing `vec_st` by `vec_vsx_st` compiles the code with gcc 8.1.0 and gcc 9.1.0 on Summit (which allows unaligned loads). Though no matter how much alignment I try to specify, `vec_st` never compiles for me:
```c++ #if 0 g++ -mcpu=power9 -mvsx $0 exit #endif
#include <altivec.h>
int main(void) { double p[8] __attribute__((aligned(16))); vector double x __attribute__((aligned(16))); vec_st(x, 0 , p); return 0; } ```
This is not a very worrysome issue right now since gcc 9.X is usually available, however it would be nice to not fail in this manner but rather check something to detect this issue or find out a workaround.
-- Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2530/thorn-vectors-fail...
trac@lists.einsteintoolkit.org