diff --git a/device/common/include/traccc/device/globalIndex.hpp b/device/common/include/traccc/device/globalIndex.hpp new file mode 100644 index 000000000..134c43bbd --- /dev/null +++ b/device/common/include/traccc/device/globalIndex.hpp @@ -0,0 +1,16 @@ +/** + * traccc library, part of the ACTS project (R&D line) + * + * (c) 2025 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +#pragma once + +namespace traccc::device { + +/// Type for passing "global indices" to device functions +using globalIndex_t = unsigned int; + +} // namespace traccc::device diff --git a/device/common/include/traccc/finding/device/apply_interaction.hpp b/device/common/include/traccc/finding/device/apply_interaction.hpp index 5650d129e..b6ce5d68a 100644 --- a/device/common/include/traccc/finding/device/apply_interaction.hpp +++ b/device/common/include/traccc/finding/device/apply_interaction.hpp @@ -1,20 +1,26 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once +// Local include(s). +#include "traccc/device/globalIndex.hpp" + // Project include(s). -#include "detray/navigation/navigator.hpp" -#include "detray/propagator/actors/pointwise_material_interactor.hpp" #include "traccc/definitions/qualifiers.hpp" +#include "traccc/edm/track_parameters.hpp" #include "traccc/finding/finding_config.hpp" -#include "traccc/utils/particle.hpp" + +// VecMem include(s). +#include namespace traccc::device { + +/// (Event Data) Payload for the @c traccc::device::apply_interaction function template struct apply_interaction_payload { /** @@ -25,7 +31,7 @@ struct apply_interaction_payload { /** * @brief Total number of input parameters (including non-live ones) */ - const int n_params; + unsigned int n_params; /** * @brief View object to the vector of bound track parameters @@ -39,16 +45,19 @@ struct apply_interaction_payload { vecmem::data::vector_view params_liveness_view; }; -/// Function applying the Pre material interaction to tracks spawned by bound -/// track parameters +/// Function applying the material interaction to tracks spawned described by +/// bound track parameters /// /// @param[in] globalIndex The index of the current thread /// @param[in] cfg Track finding config object /// @param[inout] payload The function call payload +/// template TRACCC_DEVICE inline void apply_interaction( - std::size_t globalIndex, const finding_config& cfg, + globalIndex_t globalIndex, const finding_config& cfg, const apply_interaction_payload& payload); + } // namespace traccc::device +// Include the implementation. #include "./impl/apply_interaction.ipp" diff --git a/device/common/include/traccc/finding/device/build_tracks.hpp b/device/common/include/traccc/finding/device/build_tracks.hpp index b364d3130..35f2513f0 100644 --- a/device/common/include/traccc/finding/device/build_tracks.hpp +++ b/device/common/include/traccc/finding/device/build_tracks.hpp @@ -1,20 +1,30 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once +// Local include(s). +#include "traccc/device/globalIndex.hpp" + // Project include(s). #include "traccc/definitions/qualifiers.hpp" #include "traccc/edm/measurement.hpp" #include "traccc/edm/track_candidate.hpp" #include "traccc/edm/track_parameters.hpp" #include "traccc/finding/candidate_link.hpp" +#include "traccc/finding/finding_config.hpp" + +// VecMem include(s). +#include +#include namespace traccc::device { + +/// (Event Data) Payload for the @c traccc::device::build_tracks function struct build_tracks_payload { /** * @brief View object to the vector of measurements @@ -64,11 +74,12 @@ struct build_tracks_payload { /// @param[in] globalIndex The index of the current thread /// @param[in] cfg Track finding config object /// @param[inout] payload The function call payload -template -TRACCC_DEVICE inline void build_tracks(std::size_t globalIndex, - const config_t cfg, +/// +TRACCC_DEVICE inline void build_tracks(globalIndex_t globalIndex, + const finding_config& cfg, const build_tracks_payload& payload); } // namespace traccc::device +// Include the implementation. #include "./impl/build_tracks.ipp" diff --git a/device/common/include/traccc/finding/device/fill_sort_keys.hpp b/device/common/include/traccc/finding/device/fill_sort_keys.hpp index 37d610ae9..797af55d5 100644 --- a/device/common/include/traccc/finding/device/fill_sort_keys.hpp +++ b/device/common/include/traccc/finding/device/fill_sort_keys.hpp @@ -1,17 +1,25 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once +// Local include(s). +#include "traccc/device/globalIndex.hpp" + // Project include(s). #include "traccc/edm/device/sort_key.hpp" -#include "traccc/edm/track_candidate.hpp" +#include "traccc/edm/track_parameters.hpp" + +// VecMem include(s). +#include namespace traccc::device { + +/// (Event Data) Payload for the @c traccc::device::fill_sort_keys function struct fill_sort_keys_payload { /** * @brief View object to the vector of bound track parameters @@ -34,8 +42,11 @@ struct fill_sort_keys_payload { /// /// @param[in] globalIndex The index of the current thread /// @param[inout] payload The function call payload +/// TRACCC_HOST_DEVICE inline void fill_sort_keys( - std::size_t globalIndex, const fill_sort_keys_payload& payload); + globalIndex_t globalIndex, const fill_sort_keys_payload& payload); + } // namespace traccc::device +// Include the implementation. #include "./impl/fill_sort_keys.ipp" diff --git a/device/common/include/traccc/finding/device/find_tracks.hpp b/device/common/include/traccc/finding/device/find_tracks.hpp index 7d03ea3db..8072fd333 100644 --- a/device/common/include/traccc/finding/device/find_tracks.hpp +++ b/device/common/include/traccc/finding/device/find_tracks.hpp @@ -1,6 +1,6 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023-2024 CERN for the benefit of the ACTS project + * (c) 2023-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -14,12 +14,18 @@ #include "traccc/device/concepts/thread_id.hpp" #include "traccc/edm/measurement.hpp" #include "traccc/edm/track_parameters.hpp" -#include "traccc/edm/track_state.hpp" #include "traccc/finding/candidate_link.hpp" #include "traccc/finding/finding_config.hpp" -#include "traccc/fitting/kalman_filter/gain_matrix_updater.hpp" + +// VecMem include(s). +#include + +// System include(s). +#include namespace traccc::device { + +/// (Global Event Data) Payload for the @c traccc::device::find_tracks function template struct find_tracks_payload { /** @@ -48,7 +54,7 @@ struct find_tracks_payload { /** * @brief The total number of input parameters */ - const unsigned int n_in_params; + unsigned int n_in_params; /** * @brief View object to the vector of barcodes for each measurement @@ -69,12 +75,12 @@ struct find_tracks_payload { /** * @brief The current step identifier */ - const unsigned int step; + unsigned int step; /** * @brief The maximum number of new tracks to find */ - const unsigned int n_max_candidates; + unsigned int n_max_candidates; /** * @brief View object to the output track parameter vector @@ -98,6 +104,7 @@ struct find_tracks_payload { unsigned int* n_total_candidates; }; +/// (Shared Event Data) Payload for the @c traccc::device::find_tracks function struct find_tracks_shared_payload { /** * @brief Shared-memory vector with the number of measurements found per @@ -129,12 +136,15 @@ struct find_tracks_shared_payload { /// @param[in] cfg Track finding config object /// @param[inout] payload The global memory payload /// @param[inout] shared_payload The shared memory payload -template +/// +template TRACCC_DEVICE inline void find_tracks( - thread_id_t& thread_id, barrier_t& barrier, const config_t cfg, + thread_id_t& thread_id, barrier_t& barrier, const finding_config& cfg, const find_tracks_payload& payload, const find_tracks_shared_payload& shared_payload); + } // namespace traccc::device +// Include the implementation. #include "./impl/find_tracks.ipp" diff --git a/device/common/include/traccc/finding/device/impl/apply_interaction.ipp b/device/common/include/traccc/finding/device/impl/apply_interaction.ipp index bfbb587cc..013bedac5 100644 --- a/device/common/include/traccc/finding/device/impl/apply_interaction.ipp +++ b/device/common/include/traccc/finding/device/impl/apply_interaction.ipp @@ -1,6 +1,6 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,17 +8,17 @@ #pragma once // Project include(s). -#include "detray/navigation/navigator.hpp" -#include "detray/propagator/actors/pointwise_material_interactor.hpp" -#include "traccc/definitions/qualifiers.hpp" -#include "traccc/finding/finding_config.hpp" #include "traccc/utils/particle.hpp" +// Detray include(s). +#include +#include + namespace traccc::device { template TRACCC_DEVICE inline void apply_interaction( - std::size_t globalIndex, const finding_config& cfg, + const globalIndex_t globalIndex, const finding_config& cfg, const apply_interaction_payload& payload) { // Type definitions diff --git a/device/common/include/traccc/finding/device/impl/build_tracks.ipp b/device/common/include/traccc/finding/device/impl/build_tracks.ipp index 149d9aa55..239f6819e 100644 --- a/device/common/include/traccc/finding/device/impl/build_tracks.ipp +++ b/device/common/include/traccc/finding/device/impl/build_tracks.ipp @@ -1,37 +1,29 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once -// Project include(s). -#include "traccc/definitions/qualifiers.hpp" -#include "traccc/edm/measurement.hpp" -#include "traccc/edm/track_candidate.hpp" -#include "traccc/edm/track_parameters.hpp" -#include "traccc/finding/candidate_link.hpp" - namespace traccc::device { -template -TRACCC_DEVICE inline void build_tracks(std::size_t globalIndex, - const config_t cfg, +TRACCC_DEVICE inline void build_tracks(const globalIndex_t globalIndex, + const finding_config& cfg, const build_tracks_payload& payload) { - measurement_collection_types::const_device measurements( + const measurement_collection_types::const_device measurements( payload.measurements_view); - bound_track_parameters_collection_types::const_device seeds( + const bound_track_parameters_collection_types::const_device seeds( payload.seeds_view); - vecmem::jagged_device_vector links( + const vecmem::jagged_device_vector links( payload.links_view); - vecmem::device_vector tips( - payload.tips_view); + const vecmem::device_vector + tips(payload.tips_view); track_candidate_container_types::device track_candidates( payload.track_candidates_view); diff --git a/device/common/include/traccc/finding/device/impl/fill_sort_keys.ipp b/device/common/include/traccc/finding/device/impl/fill_sort_keys.ipp index 23d207f32..2d2033041 100644 --- a/device/common/include/traccc/finding/device/impl/fill_sort_keys.ipp +++ b/device/common/include/traccc/finding/device/impl/fill_sort_keys.ipp @@ -1,22 +1,18 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once -// Project include(s). -#include "traccc/edm/device/sort_key.hpp" -#include "traccc/edm/track_candidate.hpp" - namespace traccc::device { TRACCC_HOST_DEVICE inline void fill_sort_keys( - std::size_t globalIndex, const fill_sort_keys_payload& payload) { + const globalIndex_t globalIndex, const fill_sort_keys_payload& payload) { - bound_track_parameters_collection_types::const_device params( + const bound_track_parameters_collection_types::const_device params( payload.params_view); // Keys @@ -29,10 +25,8 @@ TRACCC_HOST_DEVICE inline void fill_sort_keys( return; } - keys_device.at(static_cast(globalIndex)) = - device::get_sort_key(params.at(static_cast(globalIndex))); - ids_device.at(static_cast(globalIndex)) = - static_cast(globalIndex); + keys_device.at(globalIndex) = device::get_sort_key(params.at(globalIndex)); + ids_device.at(globalIndex) = globalIndex; } } // namespace traccc::device diff --git a/device/common/include/traccc/finding/device/impl/find_tracks.ipp b/device/common/include/traccc/finding/device/impl/find_tracks.ipp index 0a860f77e..5765b2329 100644 --- a/device/common/include/traccc/finding/device/impl/find_tracks.ipp +++ b/device/common/include/traccc/finding/device/impl/find_tracks.ipp @@ -1,6 +1,6 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023-2024 CERN for the benefit of the ACTS project + * (c) 2023-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,27 +8,18 @@ #pragma once // Project include(s). -#include "traccc/definitions/primitives.hpp" -#include "traccc/definitions/qualifiers.hpp" -#include "traccc/device/concepts/barrier.hpp" -#include "traccc/device/concepts/thread_id.hpp" -#include "traccc/edm/measurement.hpp" -#include "traccc/edm/track_parameters.hpp" -#include "traccc/edm/track_state.hpp" -#include "traccc/finding/candidate_link.hpp" -#include "traccc/finding/finding_config.hpp" #include "traccc/fitting/kalman_filter/gain_matrix_updater.hpp" -// Thrust include(s) +// Thrust include(s). #include #include namespace traccc::device { -template +template TRACCC_DEVICE inline void find_tracks( - thread_id_t& thread_id, barrier_t& barrier, const config_t cfg, + thread_id_t& thread_id, barrier_t& barrier, const finding_config& cfg, const find_tracks_payload& payload, const find_tracks_shared_payload& shared_payload) { diff --git a/device/common/include/traccc/finding/device/impl/make_barcode_sequence.ipp b/device/common/include/traccc/finding/device/impl/make_barcode_sequence.ipp index a70b6f684..a2c0b0cac 100644 --- a/device/common/include/traccc/finding/device/impl/make_barcode_sequence.ipp +++ b/device/common/include/traccc/finding/device/impl/make_barcode_sequence.ipp @@ -1,23 +1,20 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once -// Project include(s). -#include "traccc/definitions/primitives.hpp" -#include "traccc/definitions/qualifiers.hpp" -#include "traccc/edm/measurement.hpp" - namespace traccc::device { TRACCC_DEVICE inline void make_barcode_sequence( - std::size_t globalIndex, const make_barcode_sequence_payload& payload) { + const globalIndex_t globalIndex, + const make_barcode_sequence_payload& payload) { - measurement_collection_types::const_device uniques(payload.uniques_view); + const measurement_collection_types::const_device uniques( + payload.uniques_view); vecmem::device_vector barcodes(payload.barcodes_view); assert(uniques.size() >= barcodes.size()); diff --git a/device/common/include/traccc/finding/device/impl/propagate_to_next_surface.ipp b/device/common/include/traccc/finding/device/impl/propagate_to_next_surface.ipp index 06ea73949..2234166c9 100644 --- a/device/common/include/traccc/finding/device/impl/propagate_to_next_surface.ipp +++ b/device/common/include/traccc/finding/device/impl/propagate_to_next_surface.ipp @@ -1,6 +1,6 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,21 +8,16 @@ #pragma once // Project include(s). -#include "detray/core/detail/tuple_container.hpp" -#include "detray/propagator/constrained_step.hpp" -#include "detray/utils/tuple.hpp" -#include "traccc/definitions/primitives.hpp" -#include "traccc/definitions/qualifiers.hpp" -#include "traccc/edm/measurement.hpp" -#include "traccc/edm/track_parameters.hpp" -#include "traccc/finding/candidate_link.hpp" #include "traccc/utils/particle.hpp" +// Detray include(s). +#include "detray/utils/tuple.hpp" + namespace traccc::device { -template +template TRACCC_DEVICE inline void propagate_to_next_surface( - std::size_t globalIndex, const config_t cfg, + const globalIndex_t globalIndex, const finding_config& cfg, const propagate_to_next_surface_payload& payload) { if (globalIndex >= payload.n_in_params) { diff --git a/device/common/include/traccc/finding/device/impl/prune_tracks.ipp b/device/common/include/traccc/finding/device/impl/prune_tracks.ipp index d9979241f..f68d09a57 100644 --- a/device/common/include/traccc/finding/device/impl/prune_tracks.ipp +++ b/device/common/include/traccc/finding/device/impl/prune_tracks.ipp @@ -1,25 +1,20 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once -// Project include(s). -#include "traccc/definitions/primitives.hpp" -#include "traccc/definitions/qualifiers.hpp" -#include "traccc/edm/track_candidate.hpp" - namespace traccc::device { -TRACCC_DEVICE inline void prune_tracks(std::size_t globalIndex, +TRACCC_DEVICE inline void prune_tracks(const globalIndex_t globalIndex, const prune_tracks_payload& payload) { - track_candidate_container_types::const_device track_candidates( + const track_candidate_container_types::const_device track_candidates( payload.track_candidates_view); - vecmem::device_vector valid_indices( + const vecmem::device_vector valid_indices( payload.valid_indices_view); track_candidate_container_types::device prune_candidates( payload.prune_candidates_view); diff --git a/device/common/include/traccc/finding/device/make_barcode_sequence.hpp b/device/common/include/traccc/finding/device/make_barcode_sequence.hpp index f7d17c6ed..4227f5268 100644 --- a/device/common/include/traccc/finding/device/make_barcode_sequence.hpp +++ b/device/common/include/traccc/finding/device/make_barcode_sequence.hpp @@ -1,18 +1,29 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once +// Local include(s). +#include "traccc/device/globalIndex.hpp" + // Project include(s). -#include "traccc/definitions/primitives.hpp" #include "traccc/definitions/qualifiers.hpp" #include "traccc/edm/measurement.hpp" +// Detray include(s). +#include + +// VecMem include(s). +#include + namespace traccc::device { + +/// (Event Data) Payload for the @c traccc::device::make_barcode_sequence +/// function struct make_barcode_sequence_payload { /** * @brief View object to the vector of unique measurement indices @@ -29,8 +40,11 @@ struct make_barcode_sequence_payload { /// /// @param[in] globalIndex The index of the current thread /// @param[inout] payload The function call payload +/// TRACCC_DEVICE inline void make_barcode_sequence( - std::size_t globalIndex, const make_barcode_sequence_payload& payload); + globalIndex_t globalIndex, const make_barcode_sequence_payload& payload); + } // namespace traccc::device +// Include the implementation. #include "./impl/make_barcode_sequence.ipp" diff --git a/device/common/include/traccc/finding/device/propagate_to_next_surface.hpp b/device/common/include/traccc/finding/device/propagate_to_next_surface.hpp index e88639571..4b4cec4fd 100644 --- a/device/common/include/traccc/finding/device/propagate_to_next_surface.hpp +++ b/device/common/include/traccc/finding/device/propagate_to_next_surface.hpp @@ -1,21 +1,27 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once +// Local include(s). +#include "traccc/device/globalIndex.hpp" + // Project include(s). -#include "traccc/definitions/primitives.hpp" #include "traccc/definitions/qualifiers.hpp" -#include "traccc/edm/measurement.hpp" #include "traccc/edm/track_parameters.hpp" #include "traccc/finding/candidate_link.hpp" -#include "traccc/utils/particle.hpp" + +// VecMem include(s). +#include namespace traccc::device { + +/// (Event Data) Payload for the @c traccc::device::propagate_to_next_surface +/// function template struct propagate_to_next_surface_payload { /** @@ -41,7 +47,7 @@ struct propagate_to_next_surface_payload { /** * @brief View object to the access order of parameters so they are sorted */ - const vecmem::data::vector_view param_ids_view; + vecmem::data::vector_view param_ids_view; /** * @brief View object to the vector of candidate links @@ -51,12 +57,12 @@ struct propagate_to_next_surface_payload { /** * @brief Current CKF step number */ - const unsigned int step; + unsigned int step; /** * @brief Total number of input track parameters */ - const unsigned int n_in_params; + unsigned int n_in_params; /** * @brief View object to the vector of tips @@ -81,10 +87,13 @@ struct propagate_to_next_surface_payload { /// @param[in] globalIndex The index of the current thread /// @param[in] cfg Track finding config object /// @param[inout] payload The function call payload -template +/// +template TRACCC_DEVICE inline void propagate_to_next_surface( - std::size_t globalIndex, const config_t cfg, + globalIndex_t globalIndex, const finding_config& cfg, const propagate_to_next_surface_payload& payload); + } // namespace traccc::device +// Include the implementation. #include "./impl/propagate_to_next_surface.ipp" diff --git a/device/common/include/traccc/finding/device/prune_tracks.hpp b/device/common/include/traccc/finding/device/prune_tracks.hpp index bc3692565..dfe8cc56e 100644 --- a/device/common/include/traccc/finding/device/prune_tracks.hpp +++ b/device/common/include/traccc/finding/device/prune_tracks.hpp @@ -1,19 +1,25 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2025 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ #pragma once +// Local include(s). +#include "traccc/device/globalIndex.hpp" + // Project include(s). -#include "traccc/definitions/primitives.hpp" #include "traccc/definitions/qualifiers.hpp" #include "traccc/edm/track_candidate.hpp" +// VecMem include(s). +#include + namespace traccc::device { +/// (Event Data) Payload for the @c traccc::device::prune_tracks function struct prune_tracks_payload { /** * @brief View object to the vector of track candidates @@ -35,8 +41,11 @@ struct prune_tracks_payload { /// /// @param[in] globalIndex The index of the current thread /// @param[inout] payload The function call payload -TRACCC_DEVICE inline void prune_tracks(std::size_t globalIndex, +/// +TRACCC_DEVICE inline void prune_tracks(globalIndex_t globalIndex, const prune_tracks_payload& payload); + } // namespace traccc::device +// Include the implementation. #include "./impl/prune_tracks.ipp"