CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Static Public Attributes
GPUCACell Class Reference

#include <GPUCACell.h>

Public Types

using CellNeighbors = caConstants::CellNeighbors
 
using CellNeighborsVector = caConstants::CellNeighborsVector
 
using CellTracks = caConstants::CellTracks
 
using CellTracksVector = caConstants::CellTracksVector
 
using hindex_type = Hits::hindex_type
 
using HitContainer = pixelTrack::HitContainer
 
using Hits = TrackingRecHit2DSOAView
 
using OuterHitOfCell = caConstants::OuterHitOfCell
 
using OuterHitOfCellContainer = caConstants::OuterHitOfCellContainer
 
using PtrAsInt = unsigned long long
 
using Quality = pixelTrack::Quality
 
enum  StatusBit : uint16_t { StatusBit::kUsed = 1, StatusBit::kInTrack = 2, StatusBit::kKilled = 1 << 15 }
 
using TmpTuple = cms::cuda::VecArray< uint32_t, 6 >
 

Public Member Functions

__device__ __attribute__ ((always_inline)) void init(CellNeighborsVector &cellNeighbors
 
__device__ __attribute__ ((always_inline)) int addOuterNeighbor(CellNeighbors
 
__device__ __attribute__ ((always_inline)) int addTrack(CellTracks
 
__device__ __attribute__ ((always_inline)) CellTracks &tracks()
 
__device__ __attribute__ ((always_inline)) CellTracks const &tracks() const
 
__device__ __attribute__ ((always_inline)) CellNeighbors &outerNeighbors()
 
__device__ __attribute__ ((always_inline)) CellNeighbors const &outerNeighbors() const
 
__device__ __attribute__ ((always_inline)) float inner_x(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_x(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float inner_y(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_y(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float inner_z(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_z(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float inner_r(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_r(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) auto inner_iphi(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) auto outer_iphi(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float inner_detIndex(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) float outer_detIndex(Hits const &hh) const
 
__device__ __attribute__ ((always_inline)) static bool areAlignedRZ(float r1
 
 assert (outerNeighbors().empty())
 
 assert (tracks().empty())
 
__device__ bool check_alignment (Hits const &hh, GPUCACell const &otherCell, const float ptmin, const float hardCurvCut, const float caThetaCutBarrel, const float caThetaCutForward, const float dcaCutInnerTriplet, const float dcaCutOuterTriplet) const
 
 GPUCACell ()=default
 
constexpr unsigned int inner_hit_id () const
 
constexpr unsigned int outer_hit_id () const
 
__device__ void print_cell () const
 

Public Attributes

__device__ CellTracksVectorcellTracks
 
float distance_13_squared = radius_diff * radius_diff + (z1 - zo) * (z1 - zo)
 
__device__ CellTracksVector Hits const & hh
 
__device__ CellTracksVector Hits const int hindex_type innerHitId
 
__device__ CellTracksVector Hits const int layerPairId
 
__device__ CellTracksVector Hits const int hindex_type hindex_type outerHitId
 
float pMin = ptmin * std::sqrt(distance_13_squared)
 
__device__ float float float float float const float ptmin
 
__device__ float float ri
 
__device__ float float float float ro
 
float tan_12_13_half_mul_distance_13_squared = fabs(z1 * (ri - ro) + zi * (ro - r1) + zo * (r1 - ri))
 
 theFishboneId = invalidHitId
 
 theInnerR = hh.rGlobal(innerHitId)
 
 theInnerZ = hh.zGlobal(innerHitId)
 
 theLayerPairId_ = layerPairId
 
 theOuterHitId = outerHitId
 
 theOuterNeighbors = &cellNeighbors[0]
 
 theStatus_ = 0
 
__device__ float float float float float const float const float thetaCut
 
 theTracks = &cellTracks[0]
 
__device__ float z1
 
__device__ float float float zi
 
__device__ float float float float float zo
 

Static Public Attributes

static constexpr auto bad = pixelTrack::Quality::bad
 
static constexpr auto invalidHitId = std::numeric_limits<caConstants::hindex_type>::max()
 
static constexpr auto maxCellsPerHit = caConstants::maxCellsPerHit
 

Detailed Description

Definition at line 20 of file GPUCACell.h.

Member Typedef Documentation

◆ CellNeighbors

Definition at line 28 of file GPUCACell.h.

◆ CellNeighborsVector

Definition at line 30 of file GPUCACell.h.

◆ CellTracks

Definition at line 29 of file GPUCACell.h.

◆ CellTracksVector

Definition at line 31 of file GPUCACell.h.

◆ hindex_type

Definition at line 34 of file GPUCACell.h.

◆ HitContainer

Definition at line 38 of file GPUCACell.h.

◆ Hits

Definition at line 33 of file GPUCACell.h.

◆ OuterHitOfCell

Definition at line 27 of file GPUCACell.h.

◆ OuterHitOfCellContainer

Definition at line 26 of file GPUCACell.h.

◆ PtrAsInt

using GPUCACell::PtrAsInt = unsigned long long

Definition at line 22 of file GPUCACell.h.

◆ Quality

Definition at line 39 of file GPUCACell.h.

◆ TmpTuple

Definition at line 36 of file GPUCACell.h.

Member Enumeration Documentation

◆ StatusBit

enum GPUCACell::StatusBit : uint16_t
strong
Enumerator
kUsed 
kInTrack 
kKilled 

Definition at line 42 of file GPUCACell.h.

42 : uint16_t { kUsed = 1, kInTrack = 2, kKilled = 1 << 15 };

Constructor & Destructor Documentation

◆ GPUCACell()

GPUCACell::GPUCACell ( )
default

Member Function Documentation

◆ __attribute__() [1/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) &
inline

◆ __attribute__() [2/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  )
inline

Definition at line 69 of file GPUCACell.h.

References cms::cudacompat::__threadfence(), cms::cudacompat::atomicCAS(), cellNeighbors, relativeConstraints::empty, mps_fire::i, submitPVValidationJobs::t, theOuterNeighbors, and SiPixelPI::zero.

69  {
70  // use smart cache
71  if (outerNeighbors().empty()) {
72  auto i = cellNeighbors.extend(); // maybe wasted....
73  if (i > 0) {
74  cellNeighbors[i].reset();
75  __threadfence();
76 #ifdef __CUDACC__
77  auto zero = (PtrAsInt)(&cellNeighbors[0]);
79  zero,
80  (PtrAsInt)(&cellNeighbors[i])); // if fails we cannot give "i" back...
81 #else
83 #endif
84  } else
85  return -1;
86  }
87  __threadfence();
88  return outerNeighbors().push_back(t);
89  }
unsigned long long PtrAsInt
Definition: GPUCACell.h:22
T1 atomicCAS(T1 *address, T1 compare, T2 val)
Definition: cudaCompat.h:36
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const * cellNeighbors
theOuterNeighbors
Definition: GPUCACell.h:63
void __threadfence()
Definition: cudaCompat.h:133

◆ __attribute__() [3/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  )
inline

Definition at line 91 of file GPUCACell.h.

References cms::cudacompat::__threadfence(), cms::cudacompat::atomicCAS(), cellTracks, relativeConstraints::empty, cms::cuda::SimpleVector< T >::extend(), mps_fire::i, cms::cuda::SimpleVector< T >::reset(), submitPVValidationJobs::t, theTracks, tracks, and SiPixelPI::zero.

91  {
92  if (tracks().empty()) {
93  auto i = cellTracks.extend(); // maybe wasted....
94  if (i > 0) {
95  cellTracks[i].reset();
96  __threadfence();
97 #ifdef __CUDACC__
98  auto zero = (PtrAsInt)(&cellTracks[0]);
99  atomicCAS((PtrAsInt*)(&theTracks), zero, (PtrAsInt)(&cellTracks[i])); // if fails we cannot give "i" back...
100 #else
101  theTracks = &cellTracks[i];
102 #endif
103  } else
104  return -1;
105  }
106  __threadfence();
107  return tracks().push_back(t);
108  }
unsigned long long PtrAsInt
Definition: GPUCACell.h:22
T1 atomicCAS(T1 *address, T1 compare, T2 val)
Definition: cudaCompat.h:36
__device__ int extend(int size=1)
Definition: SimpleVector.h:84
auto const & tracks
cannot be loose
constexpr void reset()
Definition: SimpleVector.h:108
__device__ CellTracksVector & cellTracks
Definition: GPUCACell.h:47
void __threadfence()
Definition: cudaCompat.h:133

◆ __attribute__() [4/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) &
inline

Definition at line 110 of file GPUCACell.h.

References theTracks.

110 { return *theTracks; }

◆ __attribute__() [5/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 111 of file GPUCACell.h.

References theTracks.

111 { return *theTracks; }

◆ __attribute__() [6/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) &
inline

Definition at line 112 of file GPUCACell.h.

References theOuterNeighbors.

112 { return *theOuterNeighbors; }
theOuterNeighbors
Definition: GPUCACell.h:63

◆ __attribute__() [7/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 113 of file GPUCACell.h.

References theOuterNeighbors.

113 { return *theOuterNeighbors; }
theOuterNeighbors
Definition: GPUCACell.h:63

◆ __attribute__() [8/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 114 of file GPUCACell.h.

References hh.

114 { return hh.xGlobal(theInnerHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [9/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 115 of file GPUCACell.h.

References hh, and theOuterHitId.

115 { return hh.xGlobal(theOuterHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [10/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 116 of file GPUCACell.h.

References hh.

116 { return hh.yGlobal(theInnerHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [11/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 117 of file GPUCACell.h.

References hh, and theOuterHitId.

117 { return hh.yGlobal(theOuterHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [12/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 118 of file GPUCACell.h.

References theInnerZ.

118 { return theInnerZ; }

◆ __attribute__() [13/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 120 of file GPUCACell.h.

References hh, and theOuterHitId.

120 { return hh.zGlobal(theOuterHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [14/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 121 of file GPUCACell.h.

References theInnerR.

121 { return theInnerR; }

◆ __attribute__() [15/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 123 of file GPUCACell.h.

References hh, and theOuterHitId.

123 { return hh.rGlobal(theOuterHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [16/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 125 of file GPUCACell.h.

References hh.

125 { return hh.iphi(theInnerHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [17/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 126 of file GPUCACell.h.

References hh, and theOuterHitId.

126 { return hh.iphi(theOuterHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [18/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 128 of file GPUCACell.h.

References hh.

128 { return hh.detectorIndex(theInnerHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [19/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  ) const &
inline

Definition at line 129 of file GPUCACell.h.

References hh, and theOuterHitId.

129 { return hh.detectorIndex(theOuterHitId); }
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47

◆ __attribute__() [20/20]

__device__ GPUCACell::__attribute__ ( (always_inline)  )
inline

◆ assert() [1/2]

GPUCACell::assert ( outerNeighbors().empty()  )

◆ assert() [2/2]

GPUCACell::assert ( tracks().empty()  )

◆ check_alignment()

__device__ bool GPUCACell::check_alignment ( Hits const &  hh,
GPUCACell const &  otherCell,
const float  ptmin,
const float  hardCurvCut,
const float  caThetaCutBarrel,
const float  caThetaCutForward,
const float  dcaCutInnerTriplet,
const float  dcaCutOuterTriplet 
) const
inline

Definition at line 141 of file GPUCACell.h.

References particleFlowDisplacedVertexCandidate_cfi::dcaCut, HLT_2022v12_cff::dcaCutInnerTriplet, HLT_2022v12_cff::dcaCutOuterTriplet, HLT_2022v12_cff::hardCurvCut, hh, PixelPluginsPhase0_cfi::isBarrel, caConstants::last_barrel_detIndex, caConstants::last_bpix1_detIndex, ptmin, diffTwoXMLs::r1, ri, ro, z1, zi, and zo.

148  {
149  // detIndex of the layerStart for the Phase1 Pixel Detector:
150  // [BPX1, BPX2, BPX3, BPX4, FP1, FP2, FP3, FN1, FN2, FN3, LAST_VALID]
151  // [ 0, 96, 320, 672, 1184, 1296, 1408, 1520, 1632, 1744, 1856]
152  auto ri = inner_r(hh);
153  auto zi = inner_z(hh);
154 
155  auto ro = outer_r(hh);
156  auto zo = outer_z(hh);
157 
158  auto r1 = otherCell.inner_r(hh);
159  auto z1 = otherCell.inner_z(hh);
160  auto isBarrel = otherCell.outer_detIndex(hh) < caConstants::last_barrel_detIndex;
161  bool aligned = areAlignedRZ(r1,
162  z1,
163  ri,
164  zi,
165  ro,
166  zo,
167  ptmin,
168  isBarrel ? caThetaCutBarrel : caThetaCutForward); // 2.f*thetaCut); // FIXME tune cuts
169  return (aligned && dcaCut(hh,
170  otherCell,
171  otherCell.inner_detIndex(hh) < caConstants::last_bpix1_detIndex ? dcaCutInnerTriplet
173  hardCurvCut)); // FIXME tune cuts
174  }
__device__ float float float float ro
Definition: GPUCACell.h:177
__device__ float float float float float zo
Definition: GPUCACell.h:177
__device__ float float float zi
Definition: GPUCACell.h:177
__device__ float float float float float const float ptmin
Definition: GPUCACell.h:177
__device__ float z1
Definition: GPUCACell.h:177
__device__ CellTracksVector Hits const & hh
Definition: GPUCACell.h:47
constexpr uint32_t last_bpix1_detIndex
Definition: CAConstants.h:64
constexpr uint32_t last_barrel_detIndex
Definition: CAConstants.h:65
__device__ float float ri
Definition: GPUCACell.h:177

◆ inner_hit_id()

constexpr unsigned int GPUCACell::inner_hit_id ( ) const
inline

Definition at line 131 of file GPUCACell.h.

131 { return theInnerHitId; }

◆ outer_hit_id()

constexpr unsigned int GPUCACell::outer_hit_id ( ) const
inline

Definition at line 132 of file GPUCACell.h.

References theOuterHitId.

132 { return theOuterHitId; }

◆ print_cell()

__device__ void GPUCACell::print_cell ( ) const
inline

Definition at line 134 of file GPUCACell.h.

References theLayerPairId_, and theOuterHitId.

134  {
135  printf("printing cell: on layerPair: %d, innerHitId: %d, outerHitId: %d \n",
137  theInnerHitId,
138  theOuterHitId);
139  }
theLayerPairId_
Definition: GPUCACell.h:54

Member Data Documentation

◆ bad

constexpr auto GPUCACell::bad = pixelTrack::Quality::bad
static

Definition at line 40 of file GPUCACell.h.

◆ cellTracks

__device__ CellTracksVector& GPUCACell::cellTracks

Definition at line 47 of file GPUCACell.h.

Referenced by __attribute__().

◆ distance_13_squared

float GPUCACell::distance_13_squared = radius_diff * radius_diff + (z1 - zo) * (z1 - zo)

Definition at line 179 of file GPUCACell.h.

◆ hh

__device__ CellTracksVector Hits const& GPUCACell::hh

Definition at line 47 of file GPUCACell.h.

Referenced by __attribute__(), and check_alignment().

◆ innerHitId

__device__ CellTracksVector Hits const int hindex_type GPUCACell::innerHitId

Definition at line 47 of file GPUCACell.h.

◆ invalidHitId

constexpr auto GPUCACell::invalidHitId = std::numeric_limits<caConstants::hindex_type>::max()
static

Definition at line 25 of file GPUCACell.h.

◆ layerPairId

__device__ CellTracksVector Hits const int GPUCACell::layerPairId

Definition at line 47 of file GPUCACell.h.

◆ maxCellsPerHit

constexpr auto GPUCACell::maxCellsPerHit = caConstants::maxCellsPerHit
static

Definition at line 24 of file GPUCACell.h.

Referenced by gpuPixelDoublets::__attribute__().

◆ outerHitId

__device__ CellTracksVector Hits const int hindex_type hindex_type GPUCACell::outerHitId
Initial value:
{
theInnerHitId = innerHitId

Definition at line 51 of file GPUCACell.h.

◆ pMin

float GPUCACell::pMin = ptmin * std::sqrt(distance_13_squared)

Definition at line 181 of file GPUCACell.h.

◆ ptmin

__device__ float float float float float const float GPUCACell::ptmin

Definition at line 177 of file GPUCACell.h.

Referenced by check_alignment().

◆ ri

__device__ float float GPUCACell::ri

Definition at line 177 of file GPUCACell.h.

Referenced by check_alignment().

◆ ro

__device__ float float float float GPUCACell::ro

Definition at line 177 of file GPUCACell.h.

Referenced by check_alignment().

◆ tan_12_13_half_mul_distance_13_squared

float GPUCACell::tan_12_13_half_mul_distance_13_squared = fabs(z1 * (ri - ro) + zi * (ro - r1) + zo * (r1 - ri))

Definition at line 184 of file GPUCACell.h.

◆ theFishboneId

GPUCACell::theFishboneId = invalidHitId

Definition at line 56 of file GPUCACell.h.

◆ theInnerR

GPUCACell::theInnerR = hh.rGlobal(innerHitId)

Definition at line 60 of file GPUCACell.h.

Referenced by __attribute__().

◆ theInnerZ

GPUCACell::theInnerZ = hh.zGlobal(innerHitId)

Definition at line 59 of file GPUCACell.h.

Referenced by __attribute__().

◆ theLayerPairId_

GPUCACell::theLayerPairId_ = layerPairId

Definition at line 54 of file GPUCACell.h.

Referenced by print_cell().

◆ theOuterHitId

GPUCACell::theOuterHitId = outerHitId

Definition at line 53 of file GPUCACell.h.

Referenced by __attribute__(), outer_hit_id(), and print_cell().

◆ theOuterNeighbors

GPUCACell::theOuterNeighbors = &cellNeighbors[0]

Definition at line 63 of file GPUCACell.h.

Referenced by __attribute__().

◆ theStatus_

GPUCACell::theStatus_ = 0

Definition at line 55 of file GPUCACell.h.

◆ thetaCut

__device__ float float float float float const float const float GPUCACell::thetaCut
Initial value:
{
float radius_diff = std::abs(r1 - ro)

Definition at line 177 of file GPUCACell.h.

◆ theTracks

GPUCACell::theTracks = &cellTracks[0]

Definition at line 64 of file GPUCACell.h.

Referenced by __attribute__().

◆ z1

__device__ float GPUCACell::z1

Definition at line 177 of file GPUCACell.h.

Referenced by check_alignment().

◆ zi

__device__ float float float GPUCACell::zi

Definition at line 177 of file GPUCACell.h.

Referenced by check_alignment().

◆ zo

__device__ float float float float float GPUCACell::zo

Definition at line 177 of file GPUCACell.h.

Referenced by check_alignment().