dbarts icon indicating copy to clipboard operation
dbarts copied to clipboard

`incomatible type` errors when compiling on Arm

Open bedroge opened this issue 1 year ago • 4 comments

I'm trying to install dbarts with R 4.2.2 (and GCC 12.2.0, using EasyBuild) on an AWS Arm-based VM, but on both Neoverse N1 and V1 CPUs I'm getting the following errors:

partition_neon.c: In function vmovemask_u8:
partition_neon.c:16:3: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts
   16 |   uint8x16_t vmask = vandq_u8(input, vdupq_n_u8(0x80));
      |   ^~~~~~~~~~
partition_neon.c:16:31: error: incompatible type for argument 1 of vandq_u8
   16 |   uint8x16_t vmask = vandq_u8(input, vdupq_n_u8(0x80));
      |                               ^~~~~
      |                               |
      |                               uint16x8_t
In file included from ../include/misc/intrinsic.h:9,
                 from partition_neon.c:8:
/cvmfs/software.eessi.io/versions/2023.06/software/linux/aarch64/neoverse_v1/software/GCCcore/12.2.0/lib/gcc/aarch64-unknown-linux-gnu/12.2.0/include/arm_neon.h:1120:22: note: expected uint8x16_t but argument is of type uint16x8_t
 1120 | vandq_u8 (uint8x16_t __a, uint8x16_t __b)
      |           ~~~~~~~~~~~^~~
partition_neon.c:19:27: error: incompatible type for argument 2 of vshlq_u8
   19 |   vmask = vshlq_u8(vmask, vshift);
      |                           ^~~~~~
      |                           |
      |                           uint8x16_t
/cvmfs/software.eessi.io/versions/2023.06/software/linux/aarch64/neoverse_v1/software/GCCcore/12.2.0/lib/gcc/aarch64-unknown-linux-gnu/12.2.0/include/arm_neon.h:23830:37: note: expected int8x16_t but argument is of type uint8x16_t
23830 | vshlq_u8 (uint8x16_t __a, int8x16_t __b)
      |                           ~~~~~~~~~~^~~
In file included from partition_neon.c:29:
partition_body.c: In function misc_partitionRange_neon:
partition_body.c:147:38: error: incompatible type for argument 1 of vmovemask_u8
  147 | #  define movemask(_X_) vmovemask_u8(vreinterpretq_u8_u16(_X_))
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      uint8x16_t
partition_body.c:173:30: note: in expansion of macro movemask
  173 |     lh_mask = (unsigned int) movemask(lh_comp);
      |                              ^~~~~~~~
partition_neon.c:12:29: note: expected uint16x8_t but argument is of type uint8x16_t
   12 | int vmovemask_u8(uint16x8_t input)
      |                  ~~~~~~~~~~~^~~~~
partition_body.c:147:38: error: incompatible type for argument 1 of vmovemask_u8
  147 | #  define movemask(_X_) vmovemask_u8(vreinterpretq_u8_u16(_X_))
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      uint8x16_t
partition_body.c:175:30: note: in expansion of macro movemask
  175 |     rh_mask = (unsigned int) movemask(rh_comp);
      |                              ^~~~~~~~
partition_neon.c:12:29: note: expected uint16x8_t but argument is of type uint8x16_t
   12 | int vmovemask_u8(uint16x8_t input)
      |                  ~~~~~~~~~~~^~~~~
partition_body.c:147:38: error: incompatible type for argument 1 of vmovemask_u8
  147 | #  define movemask(_X_) vmovemask_u8(vreinterpretq_u8_u16(_X_))
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      uint8x16_t
partition_body.c:181:34: note: in expansion of macro movemask
  181 |         lh_mask = (unsigned int) movemask(lh_comp);
      |                                  ^~~~~~~~
partition_neon.c:12:29: note: expected uint16x8_t but argument is of type uint8x16_t
   12 | int vmovemask_u8(uint16x8_t input)
      |                  ~~~~~~~~~~~^~~~~
partition_body.c:147:38: error: incompatible type for argument 1 of vmovemask_u8
  147 | #  define movemask(_X_) vmovemask_u8(vreinterpretq_u8_u16(_X_))
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      uint8x16_t
partition_body.c:187:34: note: in expansion of macro movemask
  187 |         rh_mask = (unsigned int) movemask(rh_comp);
      |                                  ^~~~~~~~
partition_neon.c:12:29: note: expected uint16x8_t but argument is of type uint8x16_t
   12 | int vmovemask_u8(uint16x8_t input)
      |                  ~~~~~~~~~~~^~~~~
In file included from partition_neon.c:37:
partition_body.c: In function misc_partitionIndices_neon:
partition_body.c:147:38: error: incompatible type for argument 1 of vmovemask_u8
  147 | #  define movemask(_X_) vmovemask_u8(vreinterpretq_u8_u16(_X_))
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      uint8x16_t
partition_body.c:255:30: note: in expansion of macro movemask
  255 |     lh_mask = (unsigned int) movemask(lh_comp);
      |                              ^~~~~~~~
partition_neon.c:12:29: note: expected uint16x8_t but argument is of type uint8x16_t
   12 | int vmovemask_u8(uint16x8_t input)
      |                  ~~~~~~~~~~~^~~~~
partition_body.c:147:38: error: incompatible type for argument 1 of vmovemask_u8
  147 | #  define movemask(_X_) vmovemask_u8(vreinterpretq_u8_u16(_X_))
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      uint8x16_t
partition_body.c:257:30: note: in expansion of macro movemask
  257 |     rh_mask = (unsigned int) movemask(rh_comp);
      |                              ^~~~~~~~
partition_neon.c:12:29: note: expected uint16x8_t but argument is of type uint8x16_t
   12 | int vmovemask_u8(uint16x8_t input)
      |                  ~~~~~~~~~~~^~~~~
partition_body.c:147:38: error: incompatible type for argument 1 of vmovemask_u8
  147 | #  define movemask(_X_) vmovemask_u8(vreinterpretq_u8_u16(_X_))
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      uint8x16_t
partition_body.c:263:34: note: in expansion of macro movemask
  263 |         lh_mask = (unsigned int) movemask(lh_comp);
      |                                  ^~~~~~~~
partition_neon.c:12:29: note: expected uint16x8_t but argument is of type uint8x16_t
   12 | int vmovemask_u8(uint16x8_t input)
      |                  ~~~~~~~~~~~^~~~~
partition_body.c:147:38: error: incompatible type for argument 1 of vmovemask_u8
  147 | #  define movemask(_X_) vmovemask_u8(vreinterpretq_u8_u16(_X_))
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      uint8x16_t
partition_body.c:269:34: note: in expansion of macro movemask
  269 |         rh_mask = (unsigned int) movemask(rh_comp);
      |                                  ^~~~~~~~
partition_neon.c:12:29: note: expected uint16x8_t but argument is of type uint8x16_t
   12 | int vmovemask_u8(uint16x8_t input)
      |                  ~~~~~~~~~~~^~~~~
make[1]: *** [Makefile:163: partition_neon.o] Error 1
make[1]: Leaving directory '/tmp/bot/easybuild/build/R/4.2.2/foss-2022b/dbarts/dbarts/src/misc'
make: *** [Makevars:51: sublibs] Error 1
ERROR: compilation failed for package dbarts

Do you know how to fix this?

bedroge avatar Mar 14 '24 08:03 bedroge

Adding -flax-vector-conversions, as suggested in the error message, does work. Is that indeed the recommended way to compile the package on Arm?

bedroge avatar Mar 26 '24 10:03 bedroge

Adding -flax-vector-conversions, as suggested in the error message, does work. Is that indeed the recommended way to compile the package on Arm?

@bedroge Top answer at https://stackoverflow.com/questions/67311569/what-does-flax-vector-conversions-exactly-mean-for-arm-compiler seems to confirm that using this option is fine for legacy code (as is the case here)

boegel avatar Mar 26 '24 10:03 boegel