Skip to content
Open
Changes from all commits
Commits
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
19 changes: 15 additions & 4 deletions cpp/src/neighbors/mg/snmg.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,22 @@ void sharded_search_with_direct_merge(
d_trans.view(),
raft::make_host_vector_view<const searchIdxT>(h_trans.data(), index.num_ranks_));

// Results from each rank are packed using the current batch size. Use matching logical views
// so the final partial batch is merged with the same per-rank stride used above.
auto in_distances_batch = raft::make_device_matrix_view<const float, int64_t, row_major>(
in_distances.data_handle(), index.num_ranks_ * n_rows_of_current_batch, n_neighbors);
auto in_neighbors_batch = raft::make_device_matrix_view<const searchIdxT, int64_t, row_major>(
in_neighbors.data_handle(), index.num_ranks_ * n_rows_of_current_batch, n_neighbors);
auto out_distances_batch = raft::make_device_matrix_view<float, int64_t, row_major>(
out_distances.data_handle(), n_rows_of_current_batch, n_neighbors);
auto out_neighbors_batch = raft::make_device_matrix_view<searchIdxT, int64_t, row_major>(
out_neighbors.data_handle(), n_rows_of_current_batch, n_neighbors);

knn_merge_parts(root_handle_,
in_distances.view(),
in_neighbors.view(),
out_distances.view(),
out_neighbors.view(),
in_distances_batch,
in_neighbors_batch,
out_distances_batch,
out_neighbors_batch,
d_trans.view());

raft::copy(
Expand Down
Loading