Skip to content

Commit

Permalink
Restructure device CKF for readability (#728)
Browse files Browse the repository at this point in the history
This commit doesn't change the CKF much functionally, but improves its
readability a bit by moving variables closer to where they are used, and
by adding smaller scopes. Also increases the clarity of the double
buffering solution.

May decrease memory consumption slightly as it encourages the compiler
to free memory earlier.
  • Loading branch information
stephenswat authored Oct 7, 2024
1 parent 5eda9c8 commit 35706ff
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 243 deletions.
1 change: 0 additions & 1 deletion device/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ traccc_add_library( traccc_device_common device_common TYPE SHARED
"include/traccc/device/container_d2h_copy_alg.hpp"
"include/traccc/device/impl/container_d2h_copy_alg.ipp"
# EDM class(es).
"include/traccc/edm/device/finding_global_counter.hpp"
"include/traccc/edm/device/seeding_global_counter.hpp"
"include/traccc/edm/device/doublet_counter.hpp"
"include/traccc/edm/device/triplet_counter.hpp"
Expand Down
24 changes: 0 additions & 24 deletions device/common/include/traccc/edm/device/finding_global_counter.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ TRACCC_DEVICE inline void propagate_to_next_surface(
bound_track_parameters_collection_types::const_view in_params_view,
const vecmem::data::vector_view<const unsigned int>& param_ids_view,
vecmem::data::vector_view<const candidate_link> links_view,
const unsigned int step, const unsigned int& n_in_params,
const unsigned int step, const unsigned int n_in_params,
bound_track_parameters_collection_types::view out_params_view,
vecmem::data::vector_view<unsigned int> param_to_link_view,
vecmem::data::vector_view<typename candidate_link::link_index_type>
tips_view,
vecmem::data::vector_view<unsigned int> n_tracks_per_seed_view,
unsigned int& n_out_params) {
unsigned int* n_out_params) {

if (globalIndex >= n_in_params) {
return;
Expand Down Expand Up @@ -116,7 +116,7 @@ TRACCC_DEVICE inline void propagate_to_next_surface(

// If a surface found, add the parameter for the next step
if (s4.success) {
vecmem::device_atomic_ref<unsigned int> num_out_params(n_out_params);
vecmem::device_atomic_ref<unsigned int> num_out_params(*n_out_params);
const unsigned int out_param_id = num_out_params.fetch_add(1);

out_params[out_param_id] = propagation._stepping._bound_params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ TRACCC_DEVICE inline void propagate_to_next_surface(
bound_track_parameters_collection_types::const_view in_params_view,
const vecmem::data::vector_view<const unsigned int>& param_ids_view,
vecmem::data::vector_view<const candidate_link> links_view,
const unsigned int step, const unsigned int& n_in_params,
const unsigned int step, const unsigned int n_in_params,
bound_track_parameters_collection_types::view out_params_view,
vecmem::data::vector_view<unsigned int> param_to_link_view,
vecmem::data::vector_view<typename candidate_link::link_index_type>
tips_view,
vecmem::data::vector_view<unsigned int> n_tracks_per_seed_view,
unsigned int& n_out_params);
unsigned int* n_out_params);

} // namespace traccc::device

Expand Down
Loading

0 comments on commit 35706ff

Please sign in to comment.