Skip to content

Commit 997ee7c

Browse files
committed
Fuse inner loop kernels in device CKF
The inner loop of the device CKF consists of five loops: material interaction application, measurement counting, candidate finding, hole writing, and propagation. I believe that the middle three can be easily merged into a single kernel, reducing the amount of work we have to do on the host and simplifying thd code a lot. This commit makes that change.
1 parent c498ae4 commit 997ee7c

File tree

10 files changed

+283
-477
lines changed

10 files changed

+283
-477
lines changed

core/include/traccc/finding/finding_config.hpp

-6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ struct finding_config {
4848
/// Particle hypothesis
4949
detray::pdg_particle<traccc::scalar> ptc_hypothesis =
5050
detray::muon<traccc::scalar>();
51-
52-
/****************************
53-
* GPU-specfic parameters
54-
****************************/
55-
/// The number of measurements to be iterated per thread
56-
unsigned int n_measurements_per_thread = 8;
5751
};
5852

5953
} // namespace traccc

device/common/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,13 @@ traccc_add_library( traccc_device_common device_common TYPE SHARED
6363
# Track finding funtions(s).
6464
"include/traccc/finding/device/apply_interaction.hpp"
6565
"include/traccc/finding/device/build_tracks.hpp"
66-
"include/traccc/finding/device/count_measurements.hpp"
6766
"include/traccc/finding/device/find_tracks.hpp"
68-
"include/traccc/finding/device/add_links_for_holes.hpp"
6967
"include/traccc/finding/device/make_barcode_sequence.hpp"
7068
"include/traccc/finding/device/propagate_to_next_surface.hpp"
7169
"include/traccc/finding/device/prune_tracks.hpp"
7270
"include/traccc/finding/device/impl/apply_interaction.ipp"
7371
"include/traccc/finding/device/impl/build_tracks.ipp"
74-
"include/traccc/finding/device/impl/count_measurements.ipp"
7572
"include/traccc/finding/device/impl/find_tracks.ipp"
76-
"include/traccc/finding/device/impl/add_links_for_holes.ipp"
7773
"include/traccc/finding/device/impl/make_barcode_sequence.ipp"
7874
"include/traccc/finding/device/impl/propagate_to_next_surface.ipp"
7975
"include/traccc/finding/device/impl/prune_tracks.ipp"

device/common/include/traccc/edm/device/finding_global_counter.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ namespace traccc::device {
1111

1212
struct finding_global_counter {
1313

14-
// Sum of the number of measurements for every parameter
15-
unsigned int n_measurements_sum;
16-
1714
// Number of found measurements for the current step
1815
unsigned int n_candidates;
1916

device/common/include/traccc/finding/device/add_links_for_holes.hpp

-31
This file was deleted.

device/common/include/traccc/finding/device/count_measurements.hpp

-48
This file was deleted.

device/common/include/traccc/finding/device/find_tracks.hpp

+19-13
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
// Project include(s).
1111
#include "traccc/definitions/primitives.hpp"
1212
#include "traccc/definitions/qualifiers.hpp"
13+
#include "traccc/device/concepts/barrier.hpp"
14+
#include "traccc/device/concepts/thread_id.hpp"
1315
#include "traccc/edm/measurement.hpp"
1416
#include "traccc/edm/track_parameters.hpp"
1517

@@ -22,43 +24,47 @@ namespace traccc::device {
2224
/// If the chi2 of the measurement < chi2_max, its measurement index and the
2325
/// index of the link from the previous step are added to the link container.
2426
///
25-
/// @param[in] globalIndex The index of the current thread
27+
/// @param[in] thread_id A thread identifier object
28+
/// @param[in] barrier A block-wide barrier
2629
/// @param[in] cfg Track finding config object
2730
/// @param[in] det_data Detector view object
2831
/// @param[in] measurements_view Measurements container view
32+
/// @param[in] in_params_view Input parameters
33+
/// @param[in] n_in_params The number of input params
34+
/// @param[in] barcodes_view View of a measurement -> barcode map
2935
/// @param[in] upper_bounds_view Upper bounds of measurements unique w.r.t
3036
/// barcode
31-
/// @param[in] in_params_view Input parameters
32-
/// @param[in] n_measurements_prefix_sum_view Prefix sum of the number of
33-
/// measurements per parameter
34-
/// @param[in] ref_meas_idx_view The first index of measurements per parameter
3537
/// @param[in] prev_links_view link container from the previous step
3638
/// @param[in] prev_param_to_link_view param_to_link container from the
3739
/// previous step
3840
/// @param[in] step Step index
3941
/// @param[in] n_max_candidates Number of maximum candidates
4042
/// @param[out] out_params_view Output parameters
41-
/// @param[out] n_candidates_view Number of candidates per input parameter
4243
/// @param[out] links_view link container for the current step
4344
/// @param[out] n_total_candidates The number of total candidates for the
4445
/// current step
46+
/// @param shared_num_candidates Shared memory scratch space
47+
/// @param shared_candidates Shared memory scratch space
48+
/// @param shared_candidates_size Shared memory scratch space
4549
///
46-
template <typename detector_t, typename config_t>
50+
template <concepts::thread_id1 thread_id_t, concepts::barrier barrier_t,
51+
typename detector_t, typename config_t>
4752
TRACCC_DEVICE inline void find_tracks(
48-
std::size_t globalIndex, const config_t cfg,
53+
thread_id_t& thread_id, barrier_t& barrier, const config_t cfg,
4954
typename detector_t::view_type det_data,
5055
measurement_collection_types::const_view measurements_view,
5156
bound_track_parameters_collection_types::const_view in_params_view,
52-
vecmem::data::vector_view<const unsigned int>
53-
n_measurements_prefix_sum_view,
54-
vecmem::data::vector_view<const unsigned int> ref_meas_idx_view,
57+
const unsigned int n_in_params,
58+
vecmem::data::vector_view<const detray::geometry::barcode> barcodes_view,
59+
vecmem::data::vector_view<const unsigned int> upper_bounds_view,
5560
vecmem::data::vector_view<const candidate_link> prev_links_view,
5661
vecmem::data::vector_view<const unsigned int> prev_param_to_link_view,
5762
const unsigned int step, const unsigned int& n_max_candidates,
5863
bound_track_parameters_collection_types::view out_params_view,
59-
vecmem::data::vector_view<unsigned int> n_candidates_view,
6064
vecmem::data::vector_view<candidate_link> links_view,
61-
unsigned int& n_total_candidates);
65+
unsigned int& n_total_candidates, unsigned int* shared_num_candidates,
66+
std::pair<unsigned int, unsigned int>* shared_candidates,
67+
unsigned int& shared_candidates_size);
6268

6369
} // namespace traccc::device
6470

device/common/include/traccc/finding/device/impl/add_links_for_holes.ipp

-90
This file was deleted.

device/common/include/traccc/finding/device/impl/count_measurements.ipp

-57
This file was deleted.

0 commit comments

Comments
 (0)