@@ -29,9 +29,8 @@ full_chain_algorithm::full_chain_algorithm(
2929 m_queue(),
3030 m_vecmem_objects(m_queue),
3131 m_host_mr(host_mr),
32- m_cached_device_mr(
33- std::make_unique<::vecmem::binary_page_memory_resource>(
34- m_vecmem_objects.device_mr())),
32+ m_cached_pinned_host_mr(m_vecmem_objects.host_mr()),
33+ m_cached_device_mr(m_vecmem_objects.device_mr()),
3534 m_field_vec{0 .f , 0 .f , finder_config.bFieldInZ },
3635 m_field (field),
3736 m_det_descr(det_descr),
@@ -40,29 +39,27 @@ full_chain_algorithm::full_chain_algorithm(
4039 m_det_descr.get().size()),
4140 m_vecmem_objects.device_mr()),
4241 m_detector(detector),
43- m_clusterization(memory_resource{* m_cached_device_mr, &m_host_mr },
42+ m_clusterization({ m_cached_device_mr, &m_cached_pinned_host_mr },
4443 m_vecmem_objects.async_copy(), m_queue,
4544 clustering_config),
46- m_measurement_sorting(memory_resource{* m_cached_device_mr, &m_host_mr },
45+ m_measurement_sorting({ m_cached_device_mr, &m_cached_pinned_host_mr },
4746 m_vecmem_objects.async_copy(), m_queue,
4847 logger->cloneWithSuffix(" MeasSortingAlg" )),
49- m_spacepoint_formation(memory_resource{* m_cached_device_mr, &m_host_mr },
48+ m_spacepoint_formation({ m_cached_device_mr, &m_cached_pinned_host_mr },
5049 m_vecmem_objects.async_copy(), m_queue,
5150 logger->cloneWithSuffix(" SpFormationAlg" )),
5251 m_seeding(finder_config, grid_config, filter_config,
53- memory_resource{* m_cached_device_mr, &m_host_mr },
52+ { m_cached_device_mr, &m_cached_pinned_host_mr },
5453 m_vecmem_objects.async_copy(), m_queue,
5554 logger->cloneWithSuffix(" SeedingAlg" )),
5655 m_track_parameter_estimation(
57- memory_resource{* m_cached_device_mr, &m_host_mr },
56+ { m_cached_device_mr, &m_cached_pinned_host_mr },
5857 m_vecmem_objects.async_copy(), m_queue,
5958 logger->cloneWithSuffix(" TrackParamEstAlg" )),
60- m_finding(finding_config,
61- memory_resource{*m_cached_device_mr, &m_host_mr},
59+ m_finding(finding_config, {m_cached_device_mr, &m_cached_pinned_host_mr},
6260 m_vecmem_objects.async_copy(), m_queue,
6361 logger->cloneWithSuffix(" TrackFindingAlg" )),
64- m_fitting(fitting_config,
65- memory_resource{*m_cached_device_mr, &m_host_mr},
62+ m_fitting(fitting_config, {m_cached_device_mr, &m_cached_pinned_host_mr},
6663 m_vecmem_objects.async_copy(), m_queue,
6764 logger->cloneWithSuffix(" TrackFittingAlg" )),
6865 m_clustering_config(clustering_config),
@@ -92,9 +89,8 @@ full_chain_algorithm::full_chain_algorithm(const full_chain_algorithm& parent)
9289 m_queue(),
9390 m_vecmem_objects(m_queue),
9491 m_host_mr(parent.m_host_mr),
95- m_cached_device_mr(
96- std::make_unique<::vecmem::binary_page_memory_resource>(
97- m_vecmem_objects.device_mr())),
92+ m_cached_pinned_host_mr(m_vecmem_objects.host_mr()),
93+ m_cached_device_mr(m_vecmem_objects.device_mr()),
9894 m_field_vec(parent.m_field_vec),
9995 m_field(parent.m_field),
10096 m_det_descr(parent.m_det_descr),
@@ -103,30 +99,30 @@ full_chain_algorithm::full_chain_algorithm(const full_chain_algorithm& parent)
10399 m_det_descr.get().size()),
104100 m_vecmem_objects.device_mr()),
105101 m_detector(parent.m_detector),
106- m_clusterization(memory_resource{* m_cached_device_mr, &m_host_mr },
102+ m_clusterization({ m_cached_device_mr, &m_cached_pinned_host_mr },
107103 m_vecmem_objects.async_copy(), m_queue,
108104 parent.m_clustering_config),
109- m_measurement_sorting(memory_resource{* m_cached_device_mr, &m_host_mr },
105+ m_measurement_sorting({ m_cached_device_mr, &m_cached_pinned_host_mr },
110106 m_vecmem_objects.async_copy(), m_queue,
111107 parent.logger().cloneWithSuffix(" MeasSortingAlg" )),
112- m_spacepoint_formation(memory_resource{* m_cached_device_mr, &m_host_mr },
108+ m_spacepoint_formation({ m_cached_device_mr, &m_cached_pinned_host_mr },
113109 m_vecmem_objects.async_copy(), m_queue,
114110 parent.logger().cloneWithSuffix(" SpFormationAlg" )),
115111 m_seeding(parent.m_finder_config, parent.m_grid_config,
116112 parent.m_filter_config,
117- memory_resource{* m_cached_device_mr, &m_host_mr },
113+ { m_cached_device_mr, &m_cached_pinned_host_mr },
118114 m_vecmem_objects.async_copy(), m_queue,
119115 parent.logger().cloneWithSuffix(" SeedingAlg" )),
120116 m_track_parameter_estimation(
121- memory_resource{* m_cached_device_mr, &m_host_mr },
117+ { m_cached_device_mr, &m_cached_pinned_host_mr },
122118 m_vecmem_objects.async_copy(), m_queue,
123119 parent.logger().cloneWithSuffix(" TrackParamEstAlg" )),
124120 m_finding(parent.m_finding_config,
125- memory_resource{* m_cached_device_mr, &m_host_mr },
121+ { m_cached_device_mr, &m_cached_pinned_host_mr },
126122 m_vecmem_objects.async_copy(), m_queue,
127123 parent.logger().cloneWithSuffix(" TrackFindingAlg" )),
128124 m_fitting(parent.m_fitting_config,
129- memory_resource{* m_cached_device_mr, &m_host_mr },
125+ { m_cached_device_mr, &m_cached_pinned_host_mr },
130126 m_vecmem_objects.async_copy(), m_queue,
131127 parent.logger().cloneWithSuffix(" TrackFittingAlg" )),
132128 m_clustering_config(parent.m_clustering_config),
@@ -156,7 +152,7 @@ full_chain_algorithm::output_type full_chain_algorithm::operator()(
156152
157153 // Create device copy of input collections
158154 edm::silicon_cell_collection::buffer cells_buffer (
159- static_cast <unsigned int >(cells.size ()), * m_cached_device_mr);
155+ static_cast <unsigned int >(cells.size ()), m_cached_device_mr);
160156 m_vecmem_objects.async_copy ()(::vecmem::get_data (cells), cells_buffer)
161157 ->ignore ();
162158
@@ -184,8 +180,12 @@ full_chain_algorithm::output_type full_chain_algorithm::operator()(
184180 m_device_detector_view, m_field, {track_candidates, measurements});
185181
186182 // Copy a limited amount of result data back to the host.
183+ const auto host_tracks = m_vecmem_objects.async_copy ().to (
184+ track_states.tracks , m_cached_pinned_host_mr, nullptr ,
185+ ::vecmem::copy::type::device_to_host);
187186 output_type result{m_host_mr};
188- m_vecmem_objects.async_copy ()(track_states.tracks , result)->wait ();
187+ ::vecmem::copy host_copy;
188+ host_copy (host_tracks, result)->wait ();
189189 return result;
190190
191191 }
@@ -207,7 +207,7 @@ bound_track_parameters_collection_types::host full_chain_algorithm::seeding(
207207
208208 // Create device copy of input collections
209209 edm::silicon_cell_collection::buffer cells_buffer (
210- static_cast <unsigned int >(cells.size ()), * m_cached_device_mr);
210+ static_cast <unsigned int >(cells.size ()), m_cached_device_mr);
211211 m_vecmem_objects.async_copy ()(::vecmem::get_data (cells), cells_buffer)
212212 ->ignore ();
213213
@@ -227,8 +227,12 @@ bound_track_parameters_collection_types::host full_chain_algorithm::seeding(
227227 m_seeding (spacepoints), m_field_vec);
228228
229229 // Copy a limited amount of result data back to the host.
230+ const auto host_seeds = m_vecmem_objects.async_copy ().to (
231+ track_params, m_cached_pinned_host_mr,
232+ ::vecmem::copy::type::device_to_host);
230233 bound_track_parameters_collection_types::host result{&m_host_mr};
231- m_vecmem_objects.async_copy ()(track_params, result)->wait ();
234+ ::vecmem::copy host_copy;
235+ host_copy (host_seeds, result)->wait ();
232236 return result;
233237
234238 }
0 commit comments