11/*
2- * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved.
2+ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES . All rights reserved.
33 * SPDX-License-Identifier: Apache-2.0
44 */
55
@@ -86,8 +86,8 @@ std::tuple<size_t, size_t, size_t, size_t> optimize_workspace_size(size_t n_rows
8686
8787 size_t debug_host_size = 0 ;
8888 if (raft::default_logger ().should_log (rapids_logger::level_enum::debug)) {
89- // cagra::detail::graph::optimize() allocates extra memory to calculate
90- // graph metrics when debug logging is enabled
89+ // cagra::detail::graph::optimize() allocates extra memory to calculate
90+ // graph metrics when debug logging is enabled
9191 debug_host_size = n_rows * graph_degree * sizeof (uint32_t ) // host_copy_output_graph
9292 + n_rows * sizeof (uint32_t ) // in_edge_count
9393 + graph_degree * sizeof (uint32_t ); // hist
@@ -191,10 +191,13 @@ inline std::pair<size_t, size_t> ivf_pq_build_mem_usage(
191191 size_t kmeans_host_mem = kmeans_indices_host + kmeans_pinned_host;
192192
193193 // Extend phase
194- size_t extend_gpu_mem = params.build_params .add_data_on_build ? ivf_pq_extend_mem_usage (dataset, params, dtype_size) : 0 ;
195-
194+ size_t extend_gpu_mem = params.build_params .add_data_on_build
195+ ? ivf_pq_extend_mem_usage (dataset, params, dtype_size)
196+ : 0 ;
197+
196198 // Add graph to index on GPU
197- size_t attach_graph_gpu_mem = attach_dataset_on_build ? n_rows * graph_degree * sizeof (uint32_t ) : 0 ;
199+ size_t attach_graph_gpu_mem =
200+ attach_dataset_on_build ? n_rows * graph_degree * sizeof (uint32_t ) : 0 ;
198201
199202 // Search phase (build_knn_graph):
200203 constexpr size_t kWorkspaceRatio = 5 ;
@@ -214,7 +217,8 @@ inline std::pair<size_t, size_t> ivf_pq_build_mem_usage(
214217 + (sizeof (float ) + sizeof (int64_t )) * top_k); // refined_*
215218
216219 // Phases run sequentially (train/extend -> search -> optimize)
217- size_t total_dev = std::max ({kmeans_gpu_mem, extend_gpu_mem, attach_graph_gpu_mem, search_phase_dev, gpu_workspace_size});
220+ size_t total_dev = std::max (
221+ {kmeans_gpu_mem, extend_gpu_mem, attach_graph_gpu_mem, search_phase_dev, gpu_workspace_size});
218222
219223 // The graph (and its optimize workspace) stays resident across phases
220224 size_t total_host =
0 commit comments