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

Add missing headers in faiss/[gpu/]CMakeLists.txt #1666

Closed
wants to merge 3 commits into from

Conversation

h-vetinari
Copy link
Contributor

@h-vetinari h-vetinari commented Feb 3, 2021

While preparing conda-forge/faiss-split-feedstock#26, I grepped for the expected headers based on the files in the repo, à la:

>ls faiss/invlists/ | grep -E "h$"
BlockInvertedLists.h
DirectMap.h
InvertedLists.h
InvertedListsIOHook.h
OnDiskInvertedLists.h

Doing so uncovered that there were some headers missing (apparently) in CMakeLists.txt, namely:

faiss/impl/ResultHandler.h
faiss/gpu/impl/IVFInterleaved.cuh
faiss/gpu/impl/InterleavedCodes.h
faiss/gpu/utils/WarpPackedBits.cuh

It's possible that they were left out intentionally, but I didn't see something that would make me think so e.g. in ResultHandler.h.

While I was at it, I decided to order the filenames consistently (alphabetically, except for the increasing bit-sizes for blockselect/warpselect, as is already the case for impl/scan/IVFInterleaved<x>.cu), but of course, those commits could easily be dropped.

By reviewing the commits separately, it should be clear (for the first two) from the equal number of deletions/insertions (and the simple diff) that this is just a reshuffle. The only additions are in the last commit.

@h-vetinari
Copy link
Contributor Author

@beauby @mdouze @wickedfoo
Would be glad to have a quick 👍 / 👎 on this, so I can move ahead with 1.7.0 one way or another (as it currently blocks 3 PRs).

Sidenote: the build times basically doubled across the board from 1.6.5 to 1.7.0 - not sure if you're seeing similar increases here, but just FYI.

@mdouze
Copy link
Contributor

mdouze commented Feb 4, 2021

LGTM, although I am not the cmake expert here. Will import it to the FB review system.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdouze has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@mdouze merged this pull request in 73141fb.

@h-vetinari h-vetinari deleted the headers branch February 4, 2021 17:37
facebook-github-bot pushed a commit that referenced this pull request Feb 18, 2021
Summary:
Trying to compile windows for AVX2 in conda-forge/faiss-split-feedstock#27
(after #1600) surfaced a bunch of things (#1680, #1681, #1682), but the most voluminous problem
was MSVC being much worse at dealing with operator overloads and casts around `__m128` / `__m256`.

This lead to loads of errors that looked as follows:
```
[...]\faiss\utils\distances_simd.cpp(411): error C2676: binary '+=': '__m128' does not define this operator or a conversion to a type acceptable to the predefined operator
[...]\faiss\utils\distances_simd.cpp(440): error C2676: binary '-': '__m256' does not define this operator or a conversion to a type acceptable to the predefined operator
[...]\faiss\utils\distances_simd.cpp(441): error C2676: binary '*': 'const __m256' does not define this operator or a conversion to a type acceptable to the predefined operator
[...]\faiss\utils\distances_simd.cpp(446): error C2676: binary '+=': '__m128' does not define this operator or a conversion to a type acceptable to the predefined operator
[...]\faiss\utils\distances_simd.cpp(451): error C2676: binary '-': '__m128' does not define this operator or a conversion to a type acceptable to the predefined operator
[...]\faiss\utils\distances_simd.cpp(452): error C2676: binary '*': 'const __m128' does not define this operator or a conversion to a type acceptable to the predefined operator
[...]\faiss\utils\distances_simd.cpp(459): error C2676: binary '-': '__m128' does not define this operator or a conversion to a type acceptable to the predefined operator
[...]\faiss\utils\distances_simd.cpp(460): error C2676: binary '*': '__m128' does not define this operator or a conversion to a type acceptable to the predefined operator
[...]\faiss\utils\distances_simd.cpp(471): error C2440: '<function-style-cast>': cannot convert from '__m256i' to '__m256'
```

I've followed https://software.intel.com/sites/landingpage/IntrinsicsGuide/ to try to replace everything correctly,
but this will surely require close review, because I'm not sure how well these code-paths are checked by the
test suite.

In any case, with the commits from #1600 #1666 #1680 #1681 #1682, I was able to build `libfaiss` & `faiss`
for AVX2 on windows (while remaining "green" on linux/osx, both with & without AVX2).

Sidenote: the issues in the last commit (26fc7cf)
were uncovered by adding the `__SSE3__` compat macros in #1681.

Pull Request resolved: #1684

Test Plan: buck test //faiss/tests/...

Reviewed By: beauby

Differential Revision: D26454443

Pulled By: mdouze

fbshipit-source-id: 70df0818e357f1ecea6a056d619618df0236e0eb
facebook-github-bot pushed a commit that referenced this pull request Jun 7, 2021
Summary:
Some small fixes from conda-forge/faiss-split-feedstock#46; some missing (and unsorted) headers like in #1666, and a missing `<algorithm>` include like in  #1895

Pull Request resolved: #1933

Reviewed By: mdouze

Differential Revision: D28931009

Pulled By: beauby

fbshipit-source-id: c8a9e52a9237dc0bb87664441a76a5db47cc821a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants