File indexing completed on 2025-08-06 08:11:12
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011
0012 #include "Acts/Plugins/Sycl/Seeding/detail/Types.hpp"
0013
0014 #include "../Utilities/Arrays.hpp"
0015 #include "SpacePointType.hpp"
0016
0017
0018 #include "vecmem/containers/data/jagged_vector_view.hpp"
0019 #include "vecmem/containers/data/vector_view.hpp"
0020 #include "vecmem/containers/device_vector.hpp"
0021 #include "vecmem/containers/jagged_device_vector.hpp"
0022
0023
0024 #include <CL/sycl.hpp>
0025
0026
0027 #include <cstdint>
0028
0029 namespace Acts::Sycl::detail {
0030
0031
0032 template <SpacePointType OtherSPType>
0033 class DupletSearch {
0034
0035 static_assert((OtherSPType == SpacePointType::Bottom) ||
0036 (OtherSPType == SpacePointType::Top),
0037 "Class must be instantiated with either "
0038 "Acts::Sycl::detail::SpacePointType::Bottom or "
0039 "Acts::Sycl::detail::SpacePointType::Top");
0040
0041 public:
0042
0043 DupletSearch(vecmem::data::vector_view<const DeviceSpacePoint> middleSPs,
0044 vecmem::data::vector_view<const DeviceSpacePoint> otherSPs,
0045 vecmem::data::jagged_vector_view<uint32_t> middleOtherSPIndices,
0046 const DeviceSeedFinderConfig& config)
0047 : m_middleSPs(middleSPs),
0048 m_otherSPs(otherSPs),
0049 m_middleOtherSPIndices(middleOtherSPIndices),
0050 m_config(config) {}
0051
0052
0053 void operator()(cl::sycl::nd_item<2> item) const {
0054
0055 const auto middleIndex = item.get_global_id(0);
0056 const auto otherIndex = item.get_global_id(1);
0057
0058
0059
0060
0061 if ((middleIndex >= m_middleSPs.size()) ||
0062 (otherIndex >= m_otherSPs.size())) {
0063 return;
0064 }
0065
0066
0067
0068
0069 const vecmem::device_vector<const DeviceSpacePoint> middleSPs(m_middleSPs);
0070 const DeviceSpacePoint middleSP = middleSPs[middleIndex];
0071 const vecmem::device_vector<const DeviceSpacePoint> otherSPs(m_otherSPs);
0072 const DeviceSpacePoint otherSP = otherSPs[otherIndex];
0073
0074
0075
0076
0077 float deltaR = 0.0f, cotTheta = 0.0f;
0078 if constexpr (OtherSPType == SpacePointType::Bottom) {
0079 deltaR = middleSP.r - otherSP.r;
0080 cotTheta = (middleSP.z - otherSP.z) / deltaR;
0081 } else {
0082 deltaR = otherSP.r - middleSP.r;
0083 cotTheta = (otherSP.z - middleSP.z) / deltaR;
0084 }
0085 const float zOrigin = middleSP.z - middleSP.r * cotTheta;
0086
0087
0088 if ((deltaR >= m_config.deltaRMin) && (deltaR <= m_config.deltaRMax) &&
0089 (cl::sycl::abs(cotTheta) <= m_config.cotThetaMax) &&
0090 (zOrigin >= m_config.collisionRegionMin) &&
0091 (zOrigin <= m_config.collisionRegionMax)) {
0092
0093 vecmem::jagged_device_vector<uint32_t> middleOtherSPIndices(
0094 m_middleOtherSPIndices);
0095 middleOtherSPIndices.at(middleIndex).push_back(otherIndex);
0096 }
0097 }
0098
0099 private:
0100
0101 vecmem::data::vector_view<const DeviceSpacePoint> m_middleSPs;
0102
0103 vecmem::data::vector_view<const DeviceSpacePoint> m_otherSPs;
0104
0105
0106 vecmem::data::jagged_vector_view<uint32_t> m_middleOtherSPIndices;
0107
0108
0109 DeviceSeedFinderConfig m_config;
0110
0111 };
0112
0113 }