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

try to fix the compile errors for related packages #4015

Closed
wants to merge 2 commits into from

Conversation

mdouze
Copy link
Contributor

@mdouze mdouze commented Nov 5, 2024

Summary:
While Faiss GPU itself compiles fine, some related packages don't (presumably because they opt-in for cuda 11). This diff attempts to fix this by narrowing down the #ifdefs to a specific cuda version.

There is some imrpovement, but the full code does not compile because the bfloat162 data type does not appear to be supported.

Differential Revision: D65466700

Jeff Johnson and others added 2 commits November 5, 2024 00:59
Summary:

This diff adds support for bfloat16 vector/query data types with the GPU brute-force k-nearest neighbor function (`bfKnn`).

The change is largely just plumbing the new data type through the template hierarchy (so distances can be computed in bfloat16).

Of note, by design, all final distance results are produced in float32 regardless of input data type (float32, float16, bfloat16). This is because the true nearest neighbors in many data sets can often differ by only ~1000 float32 ULPs in terms of distance which will result in possible false equivalency. This seems to be one area where lossy compression/quantization thoughout does not work as well (and is also why `CUBLAS_MATH_DISALLOW_REDUCED_PRECISION_REDUCTION` is set in `StandardGpuResources.cpp`. However, given that there is native bf16 x bf16 = fp32 tensor core support on Ampere+ architectures, the matrix multiplication itself should 

WARNING: The one thing this diff does not yet handle properly is header inclusion / compilation for GPUs older than Ampere. This will need to be fixed before landing (so that compiling with an older CUDA SDK or compiling for the Volta architecture will simply error out at runtime properly with lack of support, instead of failing to compile (?)

Differential Revision: D65459723
Summary:
While Faiss GPU itself compiles fine, some related packages don't (presumably because they opt-in for cuda 11). This diff attempts to fix this by narrowing down the `#ifdefs` to a specific cuda version.

There is some imrpovement, but the full code does not compile because the `bfloat162` data type does not appear to be supported.

Differential Revision: D65466700
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D65466700

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.

2 participants