Skip to content

Commit bae4cdb

Browse files
authored
[Bug] Fix memory allocation test in CAGRA graph optimization (rapidsai#1675)
rel: rapidsai#1619 The actual memory allocation is performed by `make_device_mdarray`, so the corresponding memory allocation test should also be done using this function. However, the current code uses `make_device_matrix` for the test. This PR fixes this inconsistency. In the same source file, `d_detour_count` and `d_num_no_detour_edges` are allocated via `make_device_mdarray`, and `d_input_graph` is allocated through `device_matrix_view_from_host` (defined in `cpp/src/neighbors/detail/cagra/utils.hpp`), which internally calls `make_device_mdarray`. Authors: - tsuki (https://github.com/enp1s0) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: rapidsai#1675
1 parent 4c004e7 commit bae4cdb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cpp/src/neighbors/detail/cagra/graph_core.cuh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#pragma once
@@ -1233,11 +1233,12 @@ void optimize(
12331233
bool _use_gpu = use_gpu;
12341234
if (_use_gpu) {
12351235
try {
1236-
auto d_detour_count =
1237-
raft::make_device_matrix<uint8_t, int64_t>(res, graph_size, knn_graph_degree);
1238-
auto d_num_no_detour_edges = raft::make_device_vector<uint32_t, int64_t>(res, graph_size);
1239-
auto d_input_graph =
1240-
raft::make_device_matrix<IdxT, int64_t>(res, graph_size, knn_graph_degree);
1236+
auto d_detour_count = raft::make_device_mdarray<uint8_t>(
1237+
res, large_tmp_mr, raft::make_extents<int64_t>(graph_size, knn_graph_degree));
1238+
auto d_num_no_detour_edges = raft::make_device_mdarray<uint32_t>(
1239+
res, large_tmp_mr, raft::make_extents<int64_t>(graph_size));
1240+
auto d_input_graph = raft::make_device_mdarray<IdxT>(
1241+
res, large_tmp_mr, raft::make_extents<int64_t>(graph_size, knn_graph_degree));
12411242
} catch (std::bad_alloc& e) {
12421243
RAFT_LOG_DEBUG("Insufficient memory for 2-hop node counting on GPU");
12431244
_use_gpu = false;

0 commit comments

Comments
 (0)