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

matrix::select_k: move selection and warp-sort primitives #1085

Merged
merged 42 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
39c10a9
Make warp-level bitonic sort public
achirkin Dec 9, 2022
6cda736
Move spatial::*::select_topk to matrix::select_k
achirkin Dec 9, 2022
c5631bf
Fix includes style
achirkin Dec 9, 2022
fb88433
Use cmake-format
achirkin Dec 9, 2022
f64325b
Refactored warpsort module and made tests for all implementations in …
achirkin Dec 13, 2022
20d01d7
Resort to UVM when radix buffers are too big
achirkin Dec 14, 2022
4813bae
Adjust the dummy_block_sort_t to the changes in the warpsort impl
achirkin Dec 14, 2022
6cdb79a
Fix incorrect include
achirkin Dec 14, 2022
870fc86
Add benchmarks
achirkin Dec 14, 2022
2af45bf
Update CMakeLists.txt style
achirkin Dec 14, 2022
5b336ee
Update CMakeLists.txt style
achirkin Dec 14, 2022
b3e5d9c
Add mdspanified interface
achirkin Dec 15, 2022
164157b
Remove benchmarks for the legacy interface
achirkin Dec 15, 2022
69c81dd
Remove a TODO comment about a seemingly resolved bug
achirkin Dec 15, 2022
d64b12b
Merge remote-tracking branch 'rapidsai/branch-23.02' into enh-matrix-…
achirkin Dec 15, 2022
9d4476a
Fix the changed include extension
achirkin Dec 15, 2022
3e40435
Fix includes in tests
achirkin Dec 16, 2022
e20578e
Merge remote-tracking branch 'rapidsai/branch-23.02' into enh-matrix-…
achirkin Dec 16, 2022
b2c79f5
Merge branch 'branch-23.02' into enh-matrix-topk
achirkin Dec 20, 2022
98e2c2a
Address comments: bitonic_sort
achirkin Dec 20, 2022
af4c146
Replace stream argument with handle_t
achirkin Dec 20, 2022
471828e
rename files to select.* -> select_k.*
achirkin Dec 20, 2022
f6ff223
Use raft macros
achirkin Dec 20, 2022
066208d
Try to pass null and non-null arguments to select_k
achirkin Dec 20, 2022
aeaa1ef
Remove raw-pointer api from the public namespace
achirkin Dec 20, 2022
685b6bf
Updates public docs (add example usage)
achirkin Dec 21, 2022
5c42209
Merge remote-tracking branch 'rapidsai/branch-23.02' into enh-matrix-…
achirkin Jan 9, 2023
2cea50d
Add device_mem_resource
achirkin Jan 9, 2023
a31e61e
Add Doxygen docs
achirkin Jan 10, 2023
a8c5a70
Merge remote-tracking branch 'rapidsai/branch-23.02' into enh-matrix-…
achirkin Jan 10, 2023
8a5978b
Revert the memory_resource param changes in the detail namespace to a…
achirkin Jan 10, 2023
8e58cab
Merge remote-tracking branch 'rapidsai/branch-23.02' into enh-matrix-…
achirkin Jan 11, 2023
a01a75f
Remove device_mem_resource
achirkin Jan 11, 2023
c6256b7
Merge branch 'branch-23.02' into enh-matrix-topk
achirkin Jan 16, 2023
c25e859
Merge branch 'branch-23.02' into enh-matrix-topk
cjnolet Jan 19, 2023
6e56106
Merge branch 'branch-23.02' into enh-matrix-topk
achirkin Jan 20, 2023
c78d9b0
Reference a TODO issue
achirkin Jan 20, 2023
a55a6cb
Merge branch 'enh-matrix-topk' of github.com:achirkin/raft into enh-m…
achirkin Jan 20, 2023
307b113
Deprecation notice
achirkin Jan 20, 2023
c0ce160
Add [in] annotation to all arguments
achirkin Jan 20, 2023
e2cc7ad
Merge branch 'branch-23.02' into enh-matrix-topk
achirkin Jan 23, 2023
dc3043c
Merge branch 'branch-23.02' into enh-matrix-topk
cjnolet Jan 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'branch-23.02' into enh-matrix-topk
  • Loading branch information
achirkin committed Jan 16, 2023
commit c6256b7bdcecacb9d69090bfb431cc05bcadc853
26 changes: 21 additions & 5 deletions cpp/include/raft/matrix/detail/select_warpsort.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,23 @@ class warp_sort {
* @param[out] out_idx
* device pointer to a contiguous array, unique per-subwarp of size `kWarpWidth`
* (length: k <= kWarpWidth * kMaxArrLen).
* @param valF (optional) postprocess values (T -> OutT)
* @param idxF (optional) postprocess indices (IdxT -> OutIdxT)
*/
_RAFT_DEVICE void store(T* out, IdxT* out_idx) const
template <typename OutT,
typename OutIdxT,
typename ValF = identity_op,
typename IdxF = identity_op>
_RAFT_DEVICE void store(OutT* out,
OutIdxT* out_idx,
ValF valF = raft::identity_op{},
IdxF idxF = raft::identity_op{}) const
{
int idx = Pow2<kWarpWidth>::mod(laneId());
#pragma unroll kMaxArrLen
for (int i = 0; i < kMaxArrLen && idx < k; i++, idx += kWarpWidth) {
out[idx] = post_process(val_arr_[i]);
out_idx[idx] = idx_arr_[i];
out[idx] = valF(val_arr_[i]);
out_idx[idx] = idxF(idx_arr_[i]);
}
}

Expand Down Expand Up @@ -713,9 +722,16 @@ class block_sort {
}

/** Save the content by the pointer location. */
_RAFT_DEVICE void store(T* out, IdxT* out_idx) const
template <typename OutT,
typename OutIdxT,
typename ValF = identity_op,
typename IdxF = identity_op>
_RAFT_DEVICE void store(OutT* out,
OutIdxT* out_idx,
ValF valF = raft::identity_op{},
IdxF idxF = raft::identity_op{}) const
{
if (threadIdx.x < subwarp_align::Value) { queue_.store(out, out_idx, post_process); }
if (threadIdx.x < subwarp_align::Value) { queue_.store(out, out_idx, valF, idxF); }
}

private:
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/raft/spatial/knn/detail/ivf_flat_search.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ __global__ void __launch_bounds__(kThreadsPerBlock)
// finalize and store selected neighbours
__syncthreads();
queue.done(interleaved_scan_kernel_smem);
queue.store(distances, neighbors);
queue.store(distances, neighbors, post_process);
}

/**
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.