infiniflow / infinity

The AI-native database built for LLM applications, providing incredibly fast hybrid search of dense vector, sparse vector, tensor (multi-vector), and full-text
https://infiniflow.org
Apache License 2.0
2.43k stars 265 forks source link

[Feature Request]: Make Infinity work under Mac #1720

Open yingfeng opened 3 weeks ago

yingfeng commented 3 weeks ago

Is there an existing issue for the same feature request?

Is your feature request related to a problem?

No response

Describe the feature you'd like

Both Intel and ARM would be supported under Mac OS

Describe implementation you've considered

No response

Documentation, adoption, use case

No response

Additional information

No response

yingfeng commented 3 weeks ago

Build source from Mac

# Make sure clang-18 is installed
brew install llvm 

# .bash_profile
export CC=/usr/local/opt/llvm/bin/clang
export CXX=/usr/local/opt/llvm/bin/clang++
export CPPFLAGS = "-I/usr/local/opt/llvm/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/include"
export LDFLAGS = "-L/usr/local/opt/llvm/lib/c++ -L/usr/local/opt/llvm/lib -L/usr//local/Cellar/llvm/18.1.8/lib -lunwind -L/usr/local/lib"
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/llvm/lib/c++:/usr/local/opt/llvm/lib:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib:/usr/local/lib:/usr//local/Cellar/gcc/14.1.0_2/lib/gcc/14"
export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/local/include:/usr/local//Cellar/boost/1.86.0/include"
export DYLD_LIBRARY_PATH="/usr/local/opt/llvm/lib:$DYLD_LIBRARY_PATH"
yingfeng commented 3 weeks ago

Help wanted. We need Mac apple sillicon to verify infinity

ballontt commented 1 week ago

Can the code on the main branch be compiled on the Mac Apple Silicon platform?

yingfeng commented 1 week ago

Can the code on the main branch be compiled on the Mac Apple Silicon platform?

We do not have such a mackbook, so we could not tell the answer right now ...

vsian commented 1 week ago

The code won't compile on my mac with m1 pro since the cpu does not support FMA and AVX instructions even with Rosetta on.

JinHai-CN commented 1 week ago

To support AArch CPU, we have to implement vector distance computation functions with neon instructions of AArch64 in the directory of src/common/simd .

ballontt commented 1 week ago

Help wanted. We need Mac apple sillicon to verify infinity

By fixing the CMakeLists.txt and some header files, I was able to successfully compile the project on my M1 Mac (Apple OS). The unit tests passed, and ran a partial pytest.

After running all the tests, I can create a PR if needed.