microsoft / SPTAG

A distributed approximate nearest neighborhood search (ANN) library which provides a high quality vector index build, search and distributed online serving toolkits for large scale vector search scenario.
MIT License
4.8k stars 585 forks source link

‘_MM_HINT_T0’ was not declared in this scope #185

Open cristianmtr opened 3 years ago

cristianmtr commented 3 years ago

Describe the bug

I am building a docker image with Python and SPTAG

I am doing the following:

...

# build sptag
WORKDIR /app
RUN apt-get update && \
    apt-get -y install wget python3-dev python3-pip git swig libboost1.67 libboost1.67-dev

RUN wget https://cmake.org/files/v3.15/cmake-3.15.5.tar.gz && \
    tar zvxf cmake-3.15.5.tar.gz && \
    cd cmake-3.15.5 && \
    ./bootstrap && \
    make -j2 && \
    make install

RUN git clone https://github.com/microsoft/SPTAG.git
RUN cd SPTAG && \
    mkdir build && \
    cd build && \
    cmake .. && \
    grep -rl python2.7 CMakeCache.txt | xargs sed -i 's/python2.7/python3.7/g' && \
    make -j2 && \
    mv ../Release /app
...

This fails with this error:

In file included from /app/SPTAG/AnnService/src/Core/Common/NeighborhoodGraph.cpp:6:
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h: In member function ‘virtual void SPTAG::COMMON::RelativeNeighborhoodGraph::InsertNeighbors(SPTAG::VectorIndex*, SPTAG::SizeType, SPTAG::SizeType, float)’:
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h:45:50: error: ‘_MM_HINT_T0’ was not declared in this scope
                 _mm_prefetch((const char*)nodes, _MM_HINT_T0);
                                                  ^~~~~~~~~~~
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h:45:50: note: suggested alternative: ‘_SC_UINT_MAX’
                 _mm_prefetch((const char*)nodes, _MM_HINT_T0);
                                                  ^~~~~~~~~~~
                                                  _SC_UINT_MAX
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h:45:17: error: ‘_mm_prefetch’ was not declared in this scope
                 _mm_prefetch((const char*)nodes, _MM_HINT_T0);
                 ^~~~~~~~~~~~
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h:45:17: note: suggested alternative: ‘_mm_free’
                 _mm_prefetch((const char*)nodes, _MM_HINT_T0);
                 ^~~~~~~~~~~~
                 _mm_free
make[2]: *** [AnnService/CMakeFiles/SPTAGLibStatic.dir/build.make:76: AnnService/CMakeFiles/SPTAGLibStatic.dir/src/Core/Common/NeighborhoodGraph.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:176: AnnService/CMakeFiles/SPTAGLibStatic.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  7%] Building CXX object AnnService/CMakeFiles/SPTAGLib.dir/src/Core/Common/WorkSpacePool.cpp.o
In file included from /app/SPTAG/AnnService/src/Core/Common/NeighborhoodGraph.cpp:6:
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h: In member function ‘virtual void SPTAG::COMMON::RelativeNeighborhoodGraph::InsertNeighbors(SPTAG::VectorIndex*, SPTAG::SizeType, SPTAG::SizeType, float)’:
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h:45:50: error: ‘_MM_HINT_T0’ was not declared in this scope
                 _mm_prefetch((const char*)nodes, _MM_HINT_T0);
                                                  ^~~~~~~~~~~
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h:45:50: note: suggested alternative: ‘_SC_UINT_MAX’
                 _mm_prefetch((const char*)nodes, _MM_HINT_T0);
                                                  ^~~~~~~~~~~
                                                  _SC_UINT_MAX
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h:45:17: error: ‘_mm_prefetch’ was not declared in this scope
                 _mm_prefetch((const char*)nodes, _MM_HINT_T0);
                 ^~~~~~~~~~~~
/app/SPTAG/AnnService/inc/Core/Common/RelativeNeighborhoodGraph.h:45:17: note: suggested alternative: ‘_mm_free’
                 _mm_prefetch((const char*)nodes, _MM_HINT_T0);
                 ^~~~~~~~~~~~
                 _mm_free
make[2]: *** [AnnService/CMakeFiles/SPTAGLib.dir/build.make:76: AnnService/CMakeFiles/SPTAGLib.dir/src/Core/Common/NeighborhoodGraph.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:208: AnnService/CMakeFiles/SPTAGLib.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Searching by ‘_MM_HINT_T0’ was not declared in this scope lead me to https://stackoverflow.com/questions/40352891/error-mm-prefetch-was-not-declared-in-this-scope

Desktop (please complete the following information):

op-hunter commented 3 years ago

I solved this problem by adding the header file xmmintrin.h. @cristianmtr