giaf / hpipm

High-performance interior-point-method QP and QCQP solvers
Other
548 stars 130 forks source link

Build issue on Mac OSX #95

Closed seanjkanderson closed 3 years ago

seanjkanderson commented 3 years ago

Hi there,

I'm having an issue building for MATLAB on a Mac running Catalina (10.15.7).

From the ~/blasfeo I run make shared_library -j4 && sudo make install_shared and get a very long list of errors:

Parsing Makefile.rule
touch ./include/blasfeo_target.h
echo "#ifndef TARGET_X64_INTEL_HASWELL" >  ./include/blasfeo_target.h
echo "#define TARGET_X64_INTEL_HASWELL" >> ./include/blasfeo_target.h
echo "#endif"                           >> ./include/blasfeo_target.h
echo "#ifndef TARGET_NEED_FEATURE_AVX2" >> ./include/blasfeo_target.h
echo "#define TARGET_NEED_FEATURE_AVX2" >> ./include/blasfeo_target.h
echo "#endif"                           >> ./include/blasfeo_target.h
echo "#ifndef TARGET_NEED_FEATURE_FMA"  >> ./include/blasfeo_target.h
echo "#define TARGET_NEED_FEATURE_FMA"  >> ./include/blasfeo_target.h
echo "#endif"                           >> ./include/blasfeo_target.h
echo "#ifndef LA_HIGH_PERFORMANCE" >> ./include/blasfeo_target.h
echo "#define LA_HIGH_PERFORMANCE" >> ./include/blasfeo_target.h
echo "#endif" >> ./include/blasfeo_target.h
echo "#ifndef MF_PANELMAJ" >> ./include/blasfeo_target.h
echo "#define MF_PANELMAJ" >> ./include/blasfeo_target.h
echo "#endif" >> ./include/blasfeo_target.h
echo "#ifndef EXT_DEP" >> ./include/blasfeo_target.h
echo "#define EXT_DEP" >> ./include/blasfeo_target.h
echo "#endif" >> ./include/blasfeo_target.h
echo "#ifndef BLAS_API" >> ./include/blasfeo_target.h
echo "#define BLAS_API" >> ./include/blasfeo_target.h
echo "#endif" >> ./include/blasfeo_target.h
( cd auxiliary; /Applications/Xcode.app/Contents/Developer/usr/bin/make obj)
Parsing Makefile.rule
make[1]: Nothing to be done for `obj'.
( cd kernel; /Applications/Xcode.app/Contents/Developer/usr/bin/make obj)
Parsing Makefile.rule
( cd avx2; /Applications/Xcode.app/Contents/Developer/usr/bin/make obj)
Parsing Makefile.rule
cc   -DLA_HIGH_PERFORMANCE -DMF_PANELMAJ -DBLAS_API -DMACRO_LEVEL=1 -DOS_MAC   -c -o kernel_dgemm_12x4_lib4.o kernel_dgemm_12x4_lib4.S
cc   -DLA_HIGH_PERFORMANCE -DMF_PANELMAJ -DBLAS_API -DMACRO_LEVEL=1 -DOS_MAC   -c -o kernel_dgemm_8x8_lib4.o kernel_dgemm_8x8_lib4.S
cc   -DLA_HIGH_PERFORMANCE -DMF_PANELMAJ -DBLAS_API -DMACRO_LEVEL=1 -DOS_MAC   -c -o kernel_dgemm_8x4_lib4.o kernel_dgemm_8x4_lib4.S
cc   -DLA_HIGH_PERFORMANCE -DMF_PANELMAJ -DBLAS_API -DMACRO_LEVEL=1 -DOS_MAC   -c -o kernel_dgemm_4x4_lib4.o kernel_dgemm_4x4_lib4.S
<instantiation>:12:13: error: invalid operand for instruction
 vperm2f128 x20, %ymm14, %ymm12, %ymm0
            ^~~
kernel_dgemm_8x8_lib4.S:4312:2: note: while in macro instantiation
 INNER_TRAN_SCALE_AB_8X8_LIB4
 ^
<instantiation>:13:13: error: invalid operand for instruction
 vperm2f128 x31, %ymm14, %ymm12, %ymm2
            ^~~
kernel_dgemm_8x8_lib4.S:4312:2: note: while in macro instantiation
 INNER_TRAN_SCALE_AB_8X8_LIB4
 ^
<instantiation>:14:13: error: invalid operand for instruction
 vperm2f128 x20, %ymm15, %ymm13, %ymm1
            ^~~
kernel_dgemm_8x8_lib4.S:4312:2: note: while in macro instantiation
 INNER_TRAN_SCALE_AB_8X8_LIB4
 ^
<instantiation>:15:13: error: invalid operand for instruction
 vperm2f128 x31, %ymm15, %ymm13, %ymm3
            ^~~
kernel_dgemm_8x8_lib4.S:4312:2: note: while in macro instantiation
 INNER_TRAN_SCALE_AB_8X8_LIB4
...

Not sure if it's helpful to include more of the output. Are there dependencies from XCode or the like?

Thank you.

giaf commented 3 years ago

Hi there,

the issue seems to be related to the compilation of BLASFEO assembly kernels on your system/toolchain, rather than anything in HPIPM, so I would suggest to reopen the issue on the BLASFEO github, also for future reference.

Anyway, for now, something that surely works is to use the GENERIC target in BLASFEO as there are no assembly kernels in there.

The specific issue seems related to the use of hexadecimal constants in the source code (which uses AT&T assembly dialect, and not Intel assembly dialect). More specifically, the first line with an error actually looks like vperm2f128 $0x20, %ymm14, %ymm12, %ymm0 where somehow the $0 has been removed by your compiler. You could try a bit to see if other formatting works, e.g. some that you can find in here https://stackoverflow.com/questions/11733731/how-to-represent-hex-value-such-as-ffffffbb-in-x86-assembly-programming If some other formatting works for both you and other systems such as linux/gcc then that would be preferably.

giaf commented 3 years ago

This commit in BLASFEO should fix the issue https://github.com/giaf/blasfeo/commit/e6356a7aea2458c57176073bd27a78091aabb7f7