Fix cagra::optimize modifying the state of raft::resources#2103
Conversation
The new, improved version of CAGRA optimize() function makes use of raft CUDA stream pool resource. Setting the resource (`raft::resource::set_cuda_stream_pool`) affects the state of `raft::resources` and may lead to unintended consequences for a user. Using non-const `raft::resources` will be enforced at compile time in rapidsai/raft#3005 , so this PR fixes the use case ahead of the upstream change by copying the resources handle.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe ChangesResource parameter isolation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| // raft::resource::set_cuda_stream_pool below modifies the resource, so it cannot be const. | ||
| // The optimize() is a heavy function, so copying the resource and creating a private stream pool | ||
| // is not a big overhead. | ||
| raft::resources res{res_const}; |
There was a problem hiding this comment.
Please add a GitHub issue for this and link it in the code so we don't lose sight of this.
There was a problem hiding this comment.
|
/merge |
The new, improved version of CAGRA optimize() function makes use of raft CUDA stream pool resource.
Setting the resource (
raft::resource::set_cuda_stream_pool) affects the state ofraft::resourcesand may lead to unintended consequences for a user.Using non-const
raft::resourceswill be enforced at compile time in rapidsai/raft#3005 , so this PR fixes the use case ahead of the upstream change by copying the resources handle.