-
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
Add support for nosync thrust exec policy #2293
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Rui for fixing this, it is indeed important to switch to async policy to improve vector search build time. Overall it looks good!
@achirkin could you also have a look at the changes in resource handling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I welcome introduction of the thrust_nosync_policy
, it could be useful to us in theory. However, both places you changed in kmean_balanced.cuh
could better be done with raft's own linalg::map
.
@abc99lr, I just want to give an additional +1 to @achirkin's comment here. In general, we prefer to reuse raft functions where at all possible across the codebase, even when the raft function itself might be a trivial wrapper around thrust, cub, or one of the math libs. The reason for this is that it centralizes these calls so that we can properly instrument, improve, or even fix bugs as they arise in a single place, rather than having to scrape through the codebase and fix them in many places. The other reason for this is API consistency- over time, raft has improved to become quite a pleasant API experience by being able to compose larger algorithms out of a series of raft functions, which improves code readability. |
Thanks for the comments. I'll change the thrust calls in |
c6520fa
to
bfd0677
Compare
If we aren't going to be using this nosync policy, I'd like to avoid merging changes just for the sake of merging changes. |
Closing. |
Most functions in RAFT are assumed to be async, so I suspect we could probably scrape through all of the places we use the |
Understand. But I do think RAFT should provide this functionality to developers and tell people to use nosync policy when could. Otherwise, there would be many unnecessary syncs introduced. |
Talked with @cjnolet, we think it's worth to try using |
Testing. Do not merge. Based on the discussions from #2293, it's a good idea to test if we could use nosync thrust calls by default. This PR changes the current `rmm::exec_policy` to its async version `rmm::exec_policy_nosync`. Authors: - Rui Lan (https://github.com/abc99lr) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: #2302
Currently, all the
thrust
calls used in RAFT are sync calls. There is another RMM execution policy that support async (or nosync)thrust
calls. Supporting async calls is important. For example, we need the kmeans predict to be async in order to achieve kernel/copy overlapping in IVF-Flat index build (#2106).This PR
raft::resource
Change the thrust calls in kmeans predict to nosync versions. This would enable us achieve memcpy and kernel overlapping in IVF-Flat index building.Based on discussions, we should useraft::linalg::map
instead. Will open another PR for this change.