-
Notifications
You must be signed in to change notification settings - Fork 197
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
[QST] 23.06 IVFPQ VS Faiss 1.7.2 #1621
Comments
Hi, thanks for the report! Could you please tell which parameters did you use calling FAISS? We've been reworking some memory allocation internals lately, this could affect the performance, but should be fixed in the coming release. To see if this is the case, you can set the rmm memory resource to a pool, perhaps with somewhat large initial size: #include <rmm/mr/device/per_device_resource.hpp>
#include <rmm/mr/device/pool_memory_resource.hpp>
...
auto pool_mr = rmm::mr::pool_memory_resource(
rmm::mr::get_current_device_resource(), initial_pool_size
);
rmm::mr::set_current_device_resource(&pool_mr); |
Thanks for your reply! I added the codes you provided and it becomes a bit faster than before:
However I found a new issue: the SEARCH function of faiss includes: copy query from host to device, search on GPU, copy result from device to host. But SEARCH function of RAFT does not include the memory copy part. So for the sake of fairness, when calculate search QPS, I also include memory copy time while using RAFT. I searched the queries batch by batch and also do the memory copy part batch by batch and the results are listed in the table above. I also calculate the time cost of memcpy from host to device, search, time of memcpy from device to host by adding sync_stream function after each part (if I am correct), and results are listed below:
As shown in the first table, when search batch is small, RAFT performs better than FAISS. But when search batch becomes larger, FAISS gets better results. Is there still anything wrong with my test? For better understanding, I also listed some codes below:
|
Thanks for the detailed update! I'll be digging this more, but for now I can share a quick bit of info observed independently in other benchmarks: it looks like raft's IVF-PQ has performance problems specifically for |
Hello, I read some test results in you posted PPT named [S51945] Improving Dense Text Retrieval Accuracy with Approximate Nearest Neighbor Search(https://www.nvidia.com/en-us/on-demand/session/gtcspring23-s51945/). According to your result, you can reach up to 8.0x faster than FAISS with small batch size and 2.4x faster than FAISS with large batch size. I tested with the settings below:
And I got the results:
As we can see, I can get more than 3x faster than FAISS with large batches, which is consistent with your result. But I can only get 1~2x faster with small batches, which is not consistent to the result in the PPT. I did all tests using the codes I provided in my last comment. Is there anything wrong with my tests? By the way, do you support FP16 data in BRUTE-FORCE and IVFPQ? Thanks! |
Fix occasional slowdown of the compute similarity kernels: 1. Allow using the fused version for small work size cases 2. Switch to the warpsort implementation that uses less registers at the expense of shared memory. Addresses (at least partially) #1621 Authors: - Artem M. Chirkin (https://github.com/achirkin) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: #1726
Hello, I am trying to compare the performance of IVFPQ implemented by RAFT 23.06 and FAISS 1.7.2 on Nvidia T4 and cuda 11.8.
The tested data size is :
Train Size: 100000
Base Size: 1000000
Query Size: 5000
Dimension: 256
And I run RAFT IVFPQ by:
index_params.n_lists = 1024;
index_params.pq_bits = 8;
index_params.pd_dim= 32;
index_params.metric = raft::distance::DistanceType::L2Expanded;
search_params.n_probes = 128;
topK = 100;
auto index = raft::neighbors::ivf_pq::build<float. std::uint32_t>(handle_, index_params, base_view);
The size of indices_out_view and dists_out_view are (Query_num, topK)
raft::neighbors::ivf_pq::search(handle_, search_params, index, query_view, indices_out_view, dists_out_view);
The results are listed below:
As shown in the table, I don't see any significant QPS improvement using RAFT(even slower). So I am wondering if the result I got is expected? Or is there anything wrong with my usage?
The text was updated successfully, but these errors were encountered: