I am working on a patch to add PowerPC optimization to the Milvus Knowhere source tree. I have add the new files:
<code>src/simd/distances_powerpc.cc
+fvec_L2sqr_ref_ppc(const float* x, const float* y, size_t d) {
+fvec_L1_ref_ppc(const float* x, const float* y, size_t d) {
for the various functions.
And src/simd/distances_powerpc.h
+/// Squared L2 distance between two vectors
+fvec_L2sqr_ref_ppc(const float* x, const float* y, size_t d);
+fvec_inner_product_ref_ppc(const float* x, const float* y, size_t d);
+fvec_L1_ref_ppc(const float* x, const float* y, size_t d);
+fvec_Linf_ref_ppc(const float* x, const float* y, size_t d);
<code>src/simd/distances_powerpc.cc
+namespace faiss {
+
+float
+fvec_L2sqr_ref_ppc(const float* x, const float* y, size_t d) {
size_t i;
...
+float
+fvec_L1_ref_ppc(const float* x, const float* y, size_t d) {
size_t i;
float res = 0;
/* PowerPC, vectorize
for the various functions.
And src/simd/distances_powerpc.h
+namespace faiss {
+
+/// Squared L2 distance between two vectors
+float
+fvec_L2sqr_ref_ppc(const float* x, const float* y, size_t d);
+
+/// inner product
+float
+fvec_inner_product_ref_ppc(const float* x, const float* y, size_t d);
+
+/// L1 distance
+float
+fvec_L1_ref_ppc(const float* x, const float* y, size_t d);
+
+/// infinity distance
+float
+fvec_Linf_ref_ppc(const float* x, const float* y, size_t d);
+
</code>
src/simd/distances_powerpc.cc
+namespace faiss {
+
+float
+fvec_L2sqr_ref_ppc(const float* x, const float* y, size_t d) {
size_t i;
...
+float
+fvec_L1_ref_ppc(const float* x, const float* y, size_t d) {
size_t i;
float res = 0;
/* PowerPC, vectorize
for the various functions.
And src/simd/distances_powerpc.h
+namespace faiss {
+
+/// Squared L2 distance between two vectors
+float
+fvec_L2sqr_ref_ppc(const float* x, const float* y, size_t d);
+
+/// inner product
+float
+fvec_inner_product_ref_ppc(const float* x, const float* y, size_t d);
+
+/// L1 distance
+float
+fvec_L1_ref_ppc(const float* x, const float* y, size_t d);
+
+/// infinity distance
+float
+fvec_Linf_ref_ppc(const float* x, const float* y, size_t d);
+
The file src/simd/hook.cc was updated as follows:
<code>Linking CXX executable knowhere_tests
/opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to `faiss::fvec_L2sqr_ref_ppc(float const*, float const*, unsigned long)'
/opt/at16.0/lib/gcc/power
<code>Linking CXX executable knowhere_tests
/opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to `faiss::fvec_L2sqr_ref_ppc(float const*, float const*, unsigned long)'
/opt/at16.0/lib/gcc/power
</code>
Linking CXX executable knowhere_tests
/opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to `faiss::fvec_L2sqr_ref_ppc(float const*, float const*, unsigned long)'
/opt/at16.0/lib/gcc/power
I am encountering a issue when I try to build milvus.
I created the build directory
cd into the build directory and run
conan install .. --build=missing -o with_ut=True -s compiler.libcxx=libstdc++11 -s build_type=Release
<code>knowhere/build
cd into the build directory and run
conan install .. --build=missing -o with_ut=True -s compiler.libcxx=libstdc++11 -s build_type=Release
which seems to run OK
</code>
knowhere/build
cd into the build directory and run
conan install .. --build=missing -o with_ut=True -s compiler.libcxx=libstdc++11 -s build_type=Release
which seems to run OK
Then I do conan build ..
I get the following errors:
<code>[100%] Linking CXX executable knowhere_tests
/opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to faiss::fvec_L2sqr_ref_ppc(float const*, float const*, unsigned long)' /opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to rust_demangle_callback'
/opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to `faiss::fvec_madd_ref_ppc(unsigned long, float const*, float, float const*, float*)'
<code>[100%] Linking CXX executable knowhere_tests
/opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to faiss::fvec_L2sqr_ref_ppc(float const*, float const*, unsigned long)' /opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to rust_demangle_callback'
/opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to `faiss::fvec_madd_ref_ppc(unsigned long, float const*, float, float const*, float*)'
</code>
[100%] Linking CXX executable knowhere_tests
/opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to faiss::fvec_L2sqr_ref_ppc(float const*, float const*, unsigned long)' /opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to rust_demangle_callback'
/opt/at16.0/lib/gcc/powerpc64le-linux-gnu/12.3.1/../../../../powerpc64le-linux-gnu/bin/ld: ../../libknowhere.so: undefined reference to `faiss::fvec_madd_ref_ppc(unsigned long, float const*, float, float const*, float*)'
I am guessing that I need to add the new files to the cmake but as of yet I have not been able to figure out what I need to add and to which cmake file.
Does anyone have any suggestions on how the cmake files should be updated? Thanks.