2424namespace o2 ::its::gpu
2525{
2626
27- template <int nLayers = 7 >
28- class TimeFrameGPU final : public TimeFrame<nLayers >
27+ template <int NLayers = 7 >
28+ class TimeFrameGPU final : public TimeFrame<NLayers >
2929{
30- using typename TimeFrame<nLayers>::CellSeedN;
31- using typename TimeFrame<nLayers>::IndexTableUtilsN;
30+ using typename TimeFrame<NLayers>::CellSeedN;
31+ using typename TimeFrame<NLayers>::IndexTableUtilsN;
32+ using typename TimeFrame<NLayers>::ROFOverlapTableN;
33+ using typename TimeFrame<NLayers>::ROFVertexLookupTableN;
34+ using typename TimeFrame<NLayers>::ROFTimeSliceTableN;
3235
3336 public:
3437 TimeFrameGPU () = default ;
@@ -44,18 +47,21 @@ class TimeFrameGPU final : public TimeFrame<nLayers>
4447 void loadTrackingFrameInfoDevice (const int , const int );
4548 void createTrackingFrameInfoDeviceArray (const int );
4649 void loadUnsortedClustersDevice (const int , const int );
47- void createUnsortedClustersDeviceArray (const int , const int = nLayers );
50+ void createUnsortedClustersDeviceArray (const int , const int = NLayers );
4851 void loadClustersDevice (const int , const int );
49- void createClustersDeviceArray (const int , const int = nLayers );
52+ void createClustersDeviceArray (const int , const int = NLayers );
5053 void loadClustersIndexTables (const int , const int );
5154 void createClustersIndexTablesArray (const int );
5255 void createUsedClustersDevice (const int , const int );
53- void createUsedClustersDeviceArray (const int , const int = nLayers );
56+ void createUsedClustersDeviceArray (const int , const int = NLayers );
5457 void loadUsedClustersDevice ();
5558 void loadROFrameClustersDevice (const int , const int );
5659 void createROFrameClustersDeviceArray (const int );
57- void loadMultiplicityCutMask (const int );
5860 void loadVertices (const int );
61+ void loadROFOverlapTable ();
62+ void loadROFTimeSliceTable ();
63+ void loadROFVertexLookupTable ();
64+ void updateROFVertexLookupTable (const int );
5965
6066 // /
6167 void createTrackletsLUTDevice (const int , const int );
@@ -98,7 +104,7 @@ class TimeFrameGPU final : public TimeFrame<nLayers>
98104 void syncStreams (const bool = true );
99105 void waitEvent (const int , const int );
100106 void recordEvent (const int );
101- void recordEvents (const int = 0 , const int = nLayers );
107+ void recordEvents (const int = 0 , const int = NLayers );
102108
103109 // / cleanup
104110 virtual void wipe () final ;
@@ -108,6 +114,9 @@ class TimeFrameGPU final : public TimeFrame<nLayers>
108114 virtual const char * getName () const noexcept { return " GPU" ; }
109115 int getNClustersInRofSpan (const int , const int , const int ) const ;
110116 IndexTableUtilsN* getDeviceIndexTableUtils () { return mIndexTableUtilsDevice ; }
117+ const auto getDeviceROFOverlapTableView () { return mDeviceROFOverlapTableView ; }
118+ const auto getDeviceROFVertexLookupTableView () { return mDeviceROFVertexLookupTableView ; }
119+ const auto getDeviceROFTimeSliceTableView () { return mDeviceROFTimeSliceTableView ; }
111120 int * getDeviceROFramesClusters (const int layer) { return mROFramesClustersDevice [layer]; }
112121 auto & getTrackITSExt () { return mTrackITSExt ; }
113122 Vertex* getDeviceVertices () { return mPrimaryVerticesDevice ; }
@@ -116,12 +125,12 @@ class TimeFrameGPU final : public TimeFrame<nLayers>
116125 const o2::base::Propagator* getChainPropagator ();
117126
118127 // Hybrid
119- Road<nLayers - 2 >* getDeviceRoads () { return mRoadsDevice ; }
128+ Road<NLayers - 2 >* getDeviceRoads () { return mRoadsDevice ; }
120129 TrackITSExt* getDeviceTrackITSExt () { return mTrackITSExtDevice ; }
121130 int * getDeviceNeighboursLUT (const int layer) { return mNeighboursLUTDevice [layer]; }
122131 gsl::span<int *> getDeviceNeighboursLUTs () { return mNeighboursLUTDevice ; }
123132 gpuPair<int , int >* getDeviceNeighbourPairs (const int layer) { return mNeighbourPairsDevice [layer]; }
124- std::array<int *, nLayers - 2 >& getDeviceNeighboursAll () { return mNeighboursDevice ; }
133+ std::array<int *, NLayers - 2 >& getDeviceNeighboursAll () { return mNeighboursDevice ; }
125134 int * getDeviceNeighbours (const int layer) { return mNeighboursDevice [layer]; }
126135 int ** getDeviceNeighboursArray () { return mNeighboursDevice .data (); }
127136 TrackingFrameInfo* getDeviceTrackingFrameInfo (const int );
@@ -159,10 +168,10 @@ class TimeFrameGPU final : public TimeFrame<nLayers>
159168 void setDevicePropagator (const o2::base::PropagatorImpl<float >* p) final { this ->mPropagatorDevice = p; }
160169
161170 // Host-specific getters
162- gsl::span<int , nLayers - 1 > getNTracklets () { return mNTracklets ; }
163- gsl::span<int , nLayers - 2 > getNCells () { return mNCells ; }
171+ gsl::span<int , NLayers - 1 > getNTracklets () { return mNTracklets ; }
172+ gsl::span<int , NLayers - 2 > getNCells () { return mNCells ; }
164173 auto & getArrayNCells () { return mNCells ; }
165- gsl::span<int , nLayers - 3 > getNNeighbours () { return mNNeighbours ; }
174+ gsl::span<int , NLayers - 3 > getNNeighbours () { return mNNeighbours ; }
166175 auto & getArrayNNeighbours () { return mNNeighbours ; }
167176
168177 // Host-available device getters
@@ -182,51 +191,55 @@ class TimeFrameGPU final : public TimeFrame<nLayers>
182191 TimeFrameGPUParameters mGpuParams ;
183192
184193 // Host-available device buffer sizes
185- std::array<int , nLayers - 1 > mNTracklets ;
186- std::array<int , nLayers - 2 > mNCells ;
187- std::array<int , nLayers - 3 > mNNeighbours ;
194+ std::array<int , NLayers - 1 > mNTracklets ;
195+ std::array<int , NLayers - 2 > mNCells ;
196+ std::array<int , NLayers - 3 > mNNeighbours ;
188197
189198 // Device pointers
190199 IndexTableUtilsN* mIndexTableUtilsDevice ;
200+ // device navigation views
201+ ROFOverlapTableN::View mDeviceROFOverlapTableView ;
202+ ROFTimeSliceTableN::View mDeviceROFTimeSliceTableView ;
203+ ROFVertexLookupTableN::View mDeviceROFVertexLookupTableView ;
191204
192205 // Hybrid pref
193206 uint8_t * mMultMaskDevice ;
194207 Vertex* mPrimaryVerticesDevice ;
195208 int * mROFramesPVDevice ;
196- std::array<Cluster*, nLayers > mClustersDevice ;
197- std::array<Cluster*, nLayers > mUnsortedClustersDevice ;
198- std::array<int *, nLayers > mClustersIndexTablesDevice ;
199- std::array<unsigned char *, nLayers > mUsedClustersDevice ;
200- std::array<int *, nLayers > mROFramesClustersDevice ;
209+ std::array<Cluster*, NLayers > mClustersDevice ;
210+ std::array<Cluster*, NLayers > mUnsortedClustersDevice ;
211+ std::array<int *, NLayers > mClustersIndexTablesDevice ;
212+ std::array<unsigned char *, NLayers > mUsedClustersDevice ;
213+ std::array<int *, NLayers > mROFramesClustersDevice ;
201214 const Cluster** mClustersDeviceArray ;
202215 const Cluster** mUnsortedClustersDeviceArray ;
203216 const int ** mClustersIndexTablesDeviceArray ;
204217 uint8_t ** mUsedClustersDeviceArray ;
205218 const int ** mROFramesClustersDeviceArray ;
206- std::array<Tracklet*, nLayers - 1 > mTrackletsDevice ;
207- std::array<int *, nLayers - 1 > mTrackletsLUTDevice ;
208- std::array<int *, nLayers - 2 > mCellsLUTDevice ;
209- std::array<int *, nLayers - 3 > mNeighboursLUTDevice ;
219+ std::array<Tracklet*, NLayers - 1 > mTrackletsDevice ;
220+ std::array<int *, NLayers - 1 > mTrackletsLUTDevice ;
221+ std::array<int *, NLayers - 2 > mCellsLUTDevice ;
222+ std::array<int *, NLayers - 3 > mNeighboursLUTDevice ;
210223
211224 Tracklet** mTrackletsDeviceArray {nullptr };
212225 int ** mCellsLUTDeviceArray {nullptr };
213226 int ** mNeighboursCellDeviceArray {nullptr };
214227 int ** mNeighboursCellLUTDeviceArray {nullptr };
215228 int ** mTrackletsLUTDeviceArray {nullptr };
216- std::array<CellSeedN*, nLayers - 2 > mCellsDevice ;
229+ std::array<CellSeedN*, NLayers - 2 > mCellsDevice ;
217230 CellSeedN** mCellsDeviceArray ;
218- std::array<int *, nLayers - 3 > mNeighboursIndexTablesDevice ;
231+ std::array<int *, NLayers - 3 > mNeighboursIndexTablesDevice ;
219232 CellSeedN* mTrackSeedsDevice {nullptr };
220- std::array<o2::track::TrackParCovF*, nLayers - 2 > mCellSeedsDevice ;
233+ std::array<o2::track::TrackParCovF*, NLayers - 2 > mCellSeedsDevice ;
221234 o2::track::TrackParCovF** mCellSeedsDeviceArray ;
222- std::array<float *, nLayers - 2 > mCellSeedsChi2Device ;
235+ std::array<float *, NLayers - 2 > mCellSeedsChi2Device ;
223236 float ** mCellSeedsChi2DeviceArray ;
224237
225- Road<nLayers - 2 >* mRoadsDevice ;
238+ Road<NLayers - 2 >* mRoadsDevice ;
226239 TrackITSExt* mTrackITSExtDevice ;
227- std::array<gpuPair<int , int >*, nLayers - 2 > mNeighbourPairsDevice ;
228- std::array<int *, nLayers - 2 > mNeighboursDevice ;
229- std::array<TrackingFrameInfo*, nLayers > mTrackingFrameInfoDevice ;
240+ std::array<gpuPair<int , int >*, NLayers - 2 > mNeighbourPairsDevice ;
241+ std::array<int *, NLayers - 2 > mNeighboursDevice ;
242+ std::array<TrackingFrameInfo*, NLayers > mTrackingFrameInfoDevice ;
230243 const TrackingFrameInfo** mTrackingFrameInfoDeviceArray ;
231244
232245 // / Vertexer
@@ -243,46 +256,46 @@ class TimeFrameGPU final : public TimeFrame<nLayers>
243256
244257 // State
245258 Streams mGpuStreams ;
246- std::bitset<nLayers + 1 > mPinnedUnsortedClusters {0 };
247- std::bitset<nLayers + 1 > mPinnedClusters {0 };
248- std::bitset<nLayers + 1 > mPinnedClustersIndexTables {0 };
249- std::bitset<nLayers + 1 > mPinnedUsedClusters {0 };
250- std::bitset<nLayers + 1 > mPinnedROFramesClusters {0 };
251- std::bitset<nLayers + 1 > mPinnedTrackingFrameInfo {0 };
259+ std::bitset<NLayers + 1 > mPinnedUnsortedClusters {0 };
260+ std::bitset<NLayers + 1 > mPinnedClusters {0 };
261+ std::bitset<NLayers + 1 > mPinnedClustersIndexTables {0 };
262+ std::bitset<NLayers + 1 > mPinnedUsedClusters {0 };
263+ std::bitset<NLayers + 1 > mPinnedROFramesClusters {0 };
264+ std::bitset<NLayers + 1 > mPinnedTrackingFrameInfo {0 };
252265
253266 // Temporary buffer for storing output tracks from GPU tracking
254267 bounded_vector<TrackITSExt> mTrackITSExt ;
255268};
256269
257- template <int nLayers >
258- inline int TimeFrameGPU<nLayers >::getNClustersInRofSpan(const int rofIdstart, const int rofSpanSize, const int layerId) const
270+ template <int NLayers >
271+ inline int TimeFrameGPU<NLayers >::getNClustersInRofSpan(const int rofIdstart, const int rofSpanSize, const int layerId) const
259272{
260273 return static_cast <int >(this ->mROFramesClusters [layerId][(rofIdstart + rofSpanSize) < this ->mROFramesClusters .size () ? rofIdstart + rofSpanSize : this ->mROFramesClusters .size () - 1 ] - this ->mROFramesClusters [layerId][rofIdstart]);
261274}
262275
263- template <int nLayers >
264- inline std::vector<unsigned int > TimeFrameGPU<nLayers >::getClusterSizes()
276+ template <int NLayers >
277+ inline std::vector<unsigned int > TimeFrameGPU<NLayers >::getClusterSizes()
265278{
266279 std::vector<unsigned int > sizes (this ->mUnsortedClusters .size ());
267280 std::transform (this ->mUnsortedClusters .begin (), this ->mUnsortedClusters .end (), sizes.begin (),
268281 [](const auto & v) { return static_cast <unsigned int >(v.size ()); });
269282 return sizes;
270283}
271284
272- template <int nLayers >
273- inline int TimeFrameGPU<nLayers >::getNumberOfTracklets() const
285+ template <int NLayers >
286+ inline int TimeFrameGPU<NLayers >::getNumberOfTracklets() const
274287{
275288 return std::accumulate (mNTracklets .begin (), mNTracklets .end (), 0 );
276289}
277290
278- template <int nLayers >
279- inline int TimeFrameGPU<nLayers >::getNumberOfCells() const
291+ template <int NLayers >
292+ inline int TimeFrameGPU<NLayers >::getNumberOfCells() const
280293{
281294 return std::accumulate (mNCells .begin (), mNCells .end (), 0 );
282295}
283296
284- template <int nLayers >
285- inline int TimeFrameGPU<nLayers >::getNumberOfNeighbours() const
297+ template <int NLayers >
298+ inline int TimeFrameGPU<NLayers >::getNumberOfNeighbours() const
286299{
287300 return std::accumulate (mNNeighbours .begin (), mNNeighbours .end (), 0 );
288301}
0 commit comments