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

Please add a basic support for PowerPC builds (or just generic CPU) #5

Open
barracuda156 opened this issue Mar 27, 2024 · 3 comments
Open

Comments

@barracuda156
Copy link

The first issue when building on PowerPC that a wrong intrinsics header gets pulled in:

In file included from ./include/n2/simd.h:31,
                 from hnsw.cc:32:
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:54:2: error: #error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
   54 | #error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
      |  ^~~~~
In file included from /opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:79:
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/mmintrin.h:52:2: error: #error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
   52 | #error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
      |  ^~~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_loadu_ps(const float*)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:122:11: error: 'vec_vsx_ld' was not declared in this scope; did you mean 'vec_vsld'?
  122 |   return (vec_vsx_ld(0, __P));
      |           ^~~~~~~~~~
      |           vec_vsld
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_sqrt_ss(__m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:342:18: error: '__builtin_vsx_xvsqrtsp' requires the '-mvsx' option
  342 |   __c = vec_sqrt (__a);
      |                  ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:342:18: note: overloaded builtin '__builtin_vec_sqrt' is implemented by builtin '__builtin_vsx_xvsqrtsp'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_sqrt_ps(__m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:376:20: error: '__builtin_vsx_xvsqrtsp' requires the '-mvsx' option
  376 |   return (vec_sqrt ((__v4sf)__A));
      |                    ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:376:20: note: overloaded builtin '__builtin_vec_sqrt' is implemented by builtin '__builtin_vsx_xvsqrtsp'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m64 _mm_cvtps_pi32(__m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:996:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
  996 |   __vector unsigned long long __result;
      |                               ^~~~~~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:999:47: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
  999 |   __temp = (__v4sf) vec_splat ((__vector long long)__A, 0);
      |                                               ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:999:31: error: '__builtin_vsx_xxspltd_2di' requires the '-mvsx' option
  999 |   __temp = (__v4sf) vec_splat ((__vector long long)__A, 0);
      |                               ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:999:31: note: overloaded builtin '__builtin_vec_splat' is implemented by builtin '__builtin_vsx_xxspltd_2di'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1000:24: error: '__builtin_vsx_xvrspic' requires the '-mvsx' option
 1000 |   __rounded = vec_rint (__temp);
      |                        ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1000:24: note: overloaded builtin '__builtin_vec_rint' is implemented by builtin '__builtin_vsx_xvrspic'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1001:38: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1001 |   __result = (__vector unsigned long long) vec_cts (__rounded, 0);
      |                                      ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1003:34: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1003 |   return (__m64) ((__vector long long) __result)[0];
      |                                  ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m64 _mm_cvttps_pi32(__m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1054:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1054 |   __vector unsigned long long __result;
      |                               ^~~~~~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1057:47: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1057 |   __temp = (__v4sf) vec_splat ((__vector long long)__A, 0);
      |                                               ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1057:31: error: '__builtin_vsx_xxspltd_2di' requires the '-mvsx' option
 1057 |   __temp = (__v4sf) vec_splat ((__vector long long)__A, 0);
      |                               ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1057:31: note: overloaded builtin '__builtin_vec_splat' is implemented by builtin '__builtin_vsx_xxspltd_2di'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1058:38: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1058 |   __result = (__vector unsigned long long) vec_cts (__temp, 0);
      |                                      ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1060:34: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1060 |   return (__m64) ((__vector long long) __result)[0];
      |                                  ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_cvtpi32_ps(__m128, __m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1111:57: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1111 |   __vm1 = (__vector signed int) (__vector unsigned long long) {__B, __B};
      |                                                         ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1114:44: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1114 |   return ((__m128) (__vector unsigned long long)
      |                                            ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1115:32: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1115 |     { ((__vector unsigned long long)__vf1) [0],
      |                                ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1116:34: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1116 |         ((__vector unsigned long long)__A) [1]});
      |                                  ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_cvtpi16_ps(__m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1133:59: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1133 |   __vs8 = (__vector signed short) (__vector unsigned long long) { __A, __A };
      |                                                           ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_cvtpu16_ps(__m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1150:61: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1150 |   __vs8 = (__vector unsigned short) (__vector unsigned long long) { __A, __A };
      |                                                             ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_cvtpi8_ps(__m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1171:59: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1171 |   __vc16 = (__vector signed char) (__vector unsigned long long) { __A, __A };
      |                                                           ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_cvtpu8_ps(__m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1191:61: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1191 |   __vc16 = (__vector unsigned char) (__vector unsigned long long) { __A, __A };
      |                                                             ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_cvtpi32x2_ps(__m64, __m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1213:57: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1213 |   __vi4 = (__vector signed int) (__vector unsigned long long) { __A, __B };
      |                                                         ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m64 _mm_cvtps_pi16(__m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1224:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1224 |   __vector unsigned long long __result;
      |                               ^~~~~~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1226:23: error: '__builtin_vsx_xvrspic' requires the '-mvsx' option
 1226 |   __rounded = vec_rint(__A);
      |                       ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1226:23: note: overloaded builtin '__builtin_vec_rint' is implemented by builtin '__builtin_vsx_xvrspic'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1228:38: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1228 |   __result = (__vector unsigned long long) vec_pack (__temp, __temp);
      |                                      ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1230:34: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1230 |   return (__m64) ((__vector long long) __result)[0];
      |                                  ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m64 _mm_cvtps_pi8(__m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1243:23: error: '__builtin_vsx_xvrspic' requires the '-mvsx' option
 1243 |   __rounded = vec_rint(__A);
      |                       ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1243:23: note: overloaded builtin '__builtin_vec_rint' is implemented by builtin '__builtin_vsx_xvrspic'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1247:34: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1247 |   return (__m64) ((__vector long long) __res_v)[0];
      |                                  ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_loadh_pi(__m128, const __m64*)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1295:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1295 |   __vector unsigned long long __a = (__vector unsigned long long)__A;
      |                               ^~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1295:61: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1295 |   __vector unsigned long long __a = (__vector unsigned long long)__A;
      |                                                             ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1296:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1296 |   __vector unsigned long long __p = vec_splats(*__P);
      |                               ^~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function 'void _mm_storeh_pi(__m64*, __m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1306:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1306 |   __vector unsigned long long __a = (__vector unsigned long long) __A;
      |                               ^~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1306:61: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1306 |   __vector unsigned long long __a = (__vector unsigned long long) __A;
      |                                                             ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_movehl_ps(__m128, __m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1315:55: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1315 |   return (__m128) vec_mergel ((__vector unsigned long long)__B,
      |                                                       ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1316:55: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1316 |                               (__vector unsigned long long)__A);
      |                                                       ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1315:30: error: '__builtin_vsx_mergel_2di' requires the '-mvsx' option
 1315 |   return (__m128) vec_mergel ((__vector unsigned long long)__B,
      |                              ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1315:30: note: overloaded builtin '__builtin_vec_mergel' is implemented by builtin '__builtin_vsx_mergel_2di'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_movelh_ps(__m128, __m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1323:55: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1323 |   return (__m128) vec_mergeh ((__vector unsigned long long)__A,
      |                                                       ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1324:55: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1324 |                               (__vector unsigned long long)__B);
      |                                                       ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1323:30: error: '__builtin_vsx_mergeh_2di' requires the '-mvsx' option
 1323 |   return (__m128) vec_mergeh ((__vector unsigned long long)__A,
      |                              ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1323:30: note: overloaded builtin '__builtin_vec_mergeh' is implemented by builtin '__builtin_vsx_mergeh_2di'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m128 _mm_loadl_pi(__m128, const __m64*)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1332:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1332 |   __vector unsigned long long __a = (__vector unsigned long long)__A;
      |                               ^~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1332:61: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1332 |   __vector unsigned long long __a = (__vector unsigned long long)__A;
      |                                                             ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1333:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1333 |   __vector unsigned long long __p = vec_splats(*__P);
      |                               ^~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function 'void _mm_storel_pi(__m64*, __m128)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1343:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1343 |   __vector unsigned long long __a = (__vector unsigned long long) __A;
      |                               ^~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1343:61: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1343 |   __vector unsigned long long __a = (__vector unsigned long long) __A;
      |                                                             ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m64 _mm_mulhi_pu16(__m64, __m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1636:34: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1636 |   return (__m64) ((__vector long long) __c)[0];
      |                                  ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m64 _mm_shuffle_pi16(__m64, int)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1663:31: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1663 |   __vector unsigned long long __a, __p, __r;
      |                               ^~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1663:36: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1663 |   __vector unsigned long long __a, __p, __r;
      |                                    ^~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1663:41: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1663 |   __vector unsigned long long __a, __p, __r;
      |                                         ^~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1678:18: error: '__builtin_altivec_vperm_2di_uns' requires the '-mvsx' option
 1678 |   __r = vec_perm (__a, __a, (__vector unsigned char)__p);
      |                  ^
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1678:18: note: overloaded builtin '__builtin_vec_perm' is implemented by builtin '__builtin_altivec_vperm_2di_uns'
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1679:34: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1679 |   return (__m64) ((__vector long long) __r)[0];
      |                                  ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m64 _mm_avg_pu8(__m64, __m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1719:34: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1719 |   return (__m64) ((__vector long long) __c)[0];
      |                                  ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m64 _mm_avg_pu16(__m64, __m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1737:34: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1737 |   return (__m64) ((__vector long long) __c)[0];
      |                                  ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h: In function '__m64 _mm_sad_pu8(__m64, __m64)':
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1759:58: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1759 |   __a = (__vector unsigned char) (__vector unsigned long long) { 0UL, __A };
      |                                                          ^~~~
/opt/local/lib/gcc13/gcc/powerpc-apple-darwin10/13.2.0/include/xmmintrin.h:1760:58: error: use of 'long long' in AltiVec types is invalid without '-mvsx'
 1760 |   __b = (__vector unsigned char) (__vector unsigned long long) { 0UL, __B };
      |                                                          ^~~~
make[1]: *** [hnsw.o] Error 1
make: *** [sublibraries] Error 1

Those implementations are little-endian and require VSX support in ISA, which is a small subset of PowerPC cpus.

When that header is removed, build fails a step further due to a missing define for prefetch:

/opt/local/bin/g++-mp-13 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppSpdlog/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppEigen/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include   -I"./include" -fPIC  -pipe -Os -arch ppc  -c hnsw.cc -o hnsw.o
hnsw.cc: In member function 'void n2::Hnsw::Insert(n2::HnswNode*)':
hnsw.cc:539:34: error: '_MM_HINT_T0' was not declared in this scope
  539 |         _mm_prefetch(&dist_cls_, _MM_HINT_T0);
      |                                  ^~~~~~~~~~~
hnsw.cc:539:9: error: '_mm_prefetch' was not declared in this scope
  539 |         _mm_prefetch(&dist_cls_, _MM_HINT_T0);
      |         ^~~~~~~~~~~~
hnsw.cc:565:42: error: '_MM_HINT_T0' was not declared in this scope
  565 |     _mm_prefetch(&selecting_policy_cls_, _MM_HINT_T0);
      |                                          ^~~~~~~~~~~
hnsw.cc:565:5: error: '_mm_prefetch' was not declared in this scope
  565 |     _mm_prefetch(&selecting_policy_cls_, _MM_HINT_T0);
      |     ^~~~~~~~~~~~
hnsw.cc: In member function 'void n2::Hnsw::Link(n2::HnswNode*, n2::HnswNode*, int, bool, size_t)':
hnsw.cc:605:56: error: '_MM_HINT_T0' was not declared in this scope
  605 |             _mm_prefetch((char*)&((*iter)->GetData()), _MM_HINT_T0);
      |                                                        ^~~~~~~~~~~
hnsw.cc:605:13: error: '_mm_prefetch' was not declared in this scope
  605 |             _mm_prefetch((char*)&((*iter)->GetData()), _MM_HINT_T0);
      |             ^~~~~~~~~~~~
hnsw.cc: In member function 'void n2::Hnsw::SearchById_(int, float, const float*, size_t, size_t, std::vector<std::pair<int, float> >&)':
hnsw.cc:698:37: error: '_MM_HINT_T0' was not declared in this scope
  698 |             _mm_prefetch(dist_cls_, _MM_HINT_T0);
      |                                     ^~~~~~~~~~~
hnsw.cc:698:13: error: '_mm_prefetch' was not declared in this scope
  698 |             _mm_prefetch(dist_cls_, _MM_HINT_T0);
      |             ^~~~~~~~~~~~
hnsw.cc:725:29: error: '_MM_HINT_T0' was not declared in this scope
  725 |     _mm_prefetch(&res_t[0], _MM_HINT_T0);
      |                             ^~~~~~~~~~~
hnsw.cc:725:5: error: '_mm_prefetch' was not declared in this scope
  725 |     _mm_prefetch(&res_t[0], _MM_HINT_T0);
      |     ^~~~~~~~~~~~
hnsw.cc: In member function 'void n2::Hnsw::SearchByVector(const std::vector<float>&, size_t, size_t, std::vector<std::pair<int, float> >&)':
hnsw.cc:784:30: error: '_MM_HINT_T0' was not declared in this scope
  784 |     _mm_prefetch(&dist_cls_, _MM_HINT_T0);
      |                              ^~~~~~~~~~~
hnsw.cc:784:5: error: '_mm_prefetch' was not declared in this scope
  784 |     _mm_prefetch(&dist_cls_, _MM_HINT_T0);
      |     ^~~~~~~~~~~~
hnsw.cc: In member function 'void n2::Hnsw::SearchAtLayer(const std::vector<float>&, n2::HnswNode*, int, size_t, std::priority_queue<n2::FurtherFirst>&)':
hnsw.cc:839:30: error: '_MM_HINT_T0' was not declared in this scope
  839 |     _mm_prefetch(&dist_cls_, _MM_HINT_T0);
      |                              ^~~~~~~~~~~
hnsw.cc:839:5: error: '_mm_prefetch' was not declared in this scope
  839 |     _mm_prefetch(&dist_cls_, _MM_HINT_T0);
      |     ^~~~~~~~~~~~
make[1]: *** [hnsw.o] Error 1

Perhaps adding proper intrinsics for PowerPC is not easy, but maybe generic CPU fallback can be added (just considering endianness)?

@barracuda156
Copy link
Author

@evanbiederstedt
Copy link
Contributor

evanbiederstedt commented Mar 27, 2024

@barracuda156

Thanks for the GitHub issue.

You're referring to the 32-bit PowerPC? Hmmm, I guess I didn't know people still used this. I'm genuinely interested/curious to hear what you're doing with this architecture.

In terms of fixing this, I don't have access to this architecture. You're probably right that conditionals to detect the presence of x86 would work.

I think there are two ways forward:

  • Convince the developers of https://github.com/kakao/n2 to do this, and I could incorporate these changes in this R library.
  • Create a pull request with the above conditionals and have it work on PowerPC for you. If it installs on all other architectures for CRAN, I'll incorporate these changes into this library.

Sound reasonable? I think the ball is in your court.

Best, Evan

@barracuda156
Copy link
Author

@evanbiederstedt Thank you for responding!

I checked n2 repo, and turns out I have opened an issue there last year: kakao/n2#51
No response ever since.

Let me see if I can fix it. Won’t invest much time if it happens to be non-trivial, but why not try at least.

P. S. It looks like your code is improved over the original, right? And what you define for aarch64 might actually work for PowerPC too:

FORCE_INLINE void _mm_prefetch(const void *p, int i) {
(void) i;
__builtin_prefetch(p);
}

GCC builtins do work there.
There is a way to use assembler too, but perhaps unneeded, since GCC does that via builtin anyway. Ref: https://github.com/ivmai/bdwgc/blob/58e55d40a1a0220c511feaea9217cffe38dcdccb/include/private/gcconfig.h#L1201-L1207

I'm genuinely interested/curious to hear what you're doing with this architecture.

I got a PowerMac two year ago and thought I can run some Bayesian models with Stan on it. Turned out that R is broken, new compilers are not there, etc.
Well, since then I have fixed pretty much everything I wanted for R, and added it to Macports. With a very few exceptions I can do the same on 10.6 PowerPC as on 14.4 aarch64 now :)

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

No branches or pull requests

2 participants