@@ -31,7 +31,11 @@ class TimeFrameGPU : public TimeFrame<NLayers>
3131 using typename TimeFrame<NLayers>::ROFOverlapTableN;
3232 using typename TimeFrame<NLayers>::ROFVertexLookupTableN;
3333 using typename TimeFrame<NLayers>::ROFMaskTableN;
34+ using typename TimeFrame<NLayers>::TrackingTopologyN;
3435 using typename TimeFrame<NLayers>::TrackSeedN;
36+ static constexpr int MaxTransitions = TrackingTopologyN::MaxTransitions;
37+ static constexpr int MaxCells = TrackingTopologyN::MaxCells;
38+ static constexpr int MaxStreams = MaxCells > NLayers ? MaxCells : NLayers;
3539
3640 public:
3741 TimeFrameGPU () = default ;
@@ -42,30 +46,32 @@ class TimeFrameGPU : public TimeFrame<NLayers>
4246 void popMemoryStack (const int );
4347 void registerHostMemory (const int );
4448 void unregisterHostMemory (const int );
45- void initialise (const int , const TrackingParameters&, const int );
46- void loadIndexTableUtils (const int );
47- void loadTrackingFrameInfoDevice (const int , const int );
48- void createTrackingFrameInfoDeviceArray (const int );
49- void loadUnsortedClustersDevice (const int , const int );
50- void createUnsortedClustersDeviceArray (const int , const int = NLayers);
51- void loadClustersDevice (const int , const int );
52- void createClustersDeviceArray (const int , const int = NLayers);
53- void loadClustersIndexTables (const int , const int );
54- void createClustersIndexTablesArray (const int );
55- void createUsedClustersDevice (const int , const int );
56- void createUsedClustersDeviceArray (const int , const int = NLayers);
49+ void initialise (const TrackingParameters&, int maxLayers);
50+ void initialise (const TrackingParameters&, int maxLayers, int iteration);
51+ void loadIndexTableUtils ();
52+ void loadTrackingTopologies ();
53+ void loadTrackingFrameInfoDevice (const int );
54+ void createTrackingFrameInfoDeviceArray ();
55+ void loadUnsortedClustersDevice (const int );
56+ void createUnsortedClustersDeviceArray (const int = NLayers);
57+ void loadClustersDevice (const int );
58+ void createClustersDeviceArray (const int = NLayers);
59+ void loadClustersIndexTables (const int );
60+ void createClustersIndexTablesArray ();
61+ void createUsedClustersDevice (const int );
62+ void createUsedClustersDeviceArray (const int = NLayers);
5763 void loadUsedClustersDevice ();
58- void loadROFrameClustersDevice (const int , const int );
59- void createROFrameClustersDeviceArray (const int );
64+ void loadROFrameClustersDevice (const int );
65+ void createROFrameClustersDeviceArray ();
6066 void loadROFCutMask (const int );
61- void loadVertices (const int );
62- void loadROFOverlapTable (const int );
63- void loadROFVertexLookupTable (const int );
64- void updateROFVertexLookupTable (const int );
67+ void loadVertices ();
68+ void loadROFOverlapTable ();
69+ void loadROFVertexLookupTable ();
70+ void updateROFVertexLookupTable ();
6571
6672 // /
67- void createTrackletsLUTDevice (const int , const int );
68- void createTrackletsLUTDeviceArray (const int );
73+ void createTrackletsLUTDevice (bool , const int );
74+ void createTrackletsLUTDeviceArray ();
6975 void loadTrackletsDevice ();
7076 void loadTrackletsLUTDevice ();
7177 void loadCellsDevice ();
@@ -74,18 +80,18 @@ class TimeFrameGPU : public TimeFrame<NLayers>
7480 void loadTrackSeedsChi2Device ();
7581 void loadTrackSeedsDevice (bounded_vector<TrackSeedN>&);
7682 void createTrackletsBuffers (const int );
77- void createTrackletsBuffersArray (const int );
83+ void createTrackletsBuffersArray ();
7884 void createCellsBuffers (const int );
79- void createCellsBuffersArray (const int );
85+ void createCellsBuffersArray ();
8086 void createCellsDevice ();
8187 void createCellsLUTDevice (const int );
82- void createCellsLUTDeviceArray (const int );
88+ void createCellsLUTDeviceArray ();
8389 void createNeighboursIndexTablesDevice (const int );
8490 void createNeighboursDevice (const unsigned int layer);
8591 void createNeighboursLUTDevice (const int , const unsigned int );
8692 void createTrackITSExtDevice (const size_t );
8793 void downloadTrackITSExtDevice ();
88- void downloadCellsNeighboursDevice (std::vector<bounded_vector<std::pair< int , int > >>&, const int );
94+ void downloadCellsNeighboursDevice (std::vector<bounded_vector<CellNeighbour >>&, const int );
8995 void downloadNeighboursLUTDevice (bounded_vector<int >&, const int );
9096 void downloadCellsDevice ();
9197 void downloadCellsLUTDevice ();
@@ -109,6 +115,7 @@ class TimeFrameGPU : public TimeFrame<NLayers>
109115 const auto getDeviceROFOverlapTableView () { return mDeviceROFOverlapTableView ; }
110116 const auto getDeviceROFVertexLookupTableView () { return mDeviceROFVertexLookupTableView ; }
111117 const auto getDeviceROFMaskTableView () { return mDeviceROFMaskTableView ; }
118+ const auto getDeviceTrackingTopologyView () const { return mDeviceTrackingTopologyView ; }
112119 int * getDeviceROFramesClusters (const int layer) { return mROFramesClustersDevice [layer]; }
113120 auto & getTrackITSExt () { return mTrackITSExt ; }
114121 Vertex* getDeviceVertices () { return mPrimaryVerticesDevice ; }
@@ -120,10 +127,9 @@ class TimeFrameGPU : public TimeFrame<NLayers>
120127 TrackITSExt* getDeviceTrackITSExt () { return mTrackITSExtDevice ; }
121128 int * getDeviceNeighboursLUT (const int layer) { return mNeighboursLUTDevice [layer]; }
122129 gsl::span<int *> getDeviceNeighboursLUTs () { return mNeighboursLUTDevice ; }
123- gpuPair<int , int >* getDeviceNeighbourPairs (const int layer) { return mNeighbourPairsDevice [layer]; }
124- std::array<int *, NLayers - 2 >& getDeviceNeighboursAll () { return mNeighboursDevice ; }
125- int * getDeviceNeighbours (const int layer) { return mNeighboursDevice [layer]; }
126- int ** getDeviceNeighboursArray () { return mNeighboursDevice .data (); }
130+ CellNeighbour** getDeviceArrayNeighbours () { return mNeighboursDeviceArray ; }
131+ std::array<CellNeighbour*, MaxCells>& getDeviceNeighboursAll () { return mNeighboursDevice ; }
132+ CellNeighbour* getDeviceNeighbours (const int layer) { return mNeighboursDevice [layer]; }
127133 TrackingFrameInfo* getDeviceTrackingFrameInfo (const int );
128134 const TrackingFrameInfo** getDeviceArrayTrackingFrameInfo () const { return mTrackingFrameInfoDeviceArray ; }
129135 const Cluster** getDeviceArrayClusters () const { return mClustersDeviceArray ; }
@@ -147,10 +153,10 @@ class TimeFrameGPU : public TimeFrame<NLayers>
147153 void setDevicePropagator (const o2::base::PropagatorImpl<float >* p) final { this ->mPropagatorDevice = p; }
148154
149155 // Host-specific getters
150- gsl::span<int , NLayers - 1 > getNTracklets () { return mNTracklets ; }
151- gsl::span<int , NLayers - 2 > getNCells () { return mNCells ; }
156+ gsl::span<int > getNTracklets () { return { mNTracklets . data (), static_cast <gsl::span< int >::size_type>( this -> mTrackingTopologyView . nTransitions )} ; }
157+ gsl::span<int > getNCells () { return { mNCells . data (), static_cast <gsl::span< int >::size_type>( this -> mTrackingTopologyView . nCells )} ; }
152158 auto & getArrayNCells () { return mNCells ; }
153- gsl::span<int , NLayers - 3 > getNNeighbours () { return mNNeighbours ; }
159+ gsl::span<int > getNNeighbours () { return { mNNeighbours . data (), static_cast <gsl::span< int >::size_type>( this -> mTrackingTopologyView . nCells )} ; }
154160 auto & getArrayNNeighbours () { return mNNeighbours ; }
155161
156162 // Host-available device getters
@@ -169,16 +175,18 @@ class TimeFrameGPU : public TimeFrame<NLayers>
169175 void allocMem (void **, size_t , bool , int32_t = o2::gpu::GPUMemoryResource::MEMORY_GPU ); // Abstract owned and unowned memory allocations on default stream
170176
171177 // Host-available device buffer sizes
172- std::array<int , NLayers - 1 > mNTracklets ;
173- std::array<int , NLayers - 2 > mNCells ;
174- std::array<int , NLayers - 3 > mNNeighbours ;
178+ std::array<int , MaxTransitions > mNTracklets {} ;
179+ std::array<int , MaxCells > mNCells {} ;
180+ std::array<int , MaxCells > mNNeighbours {} ;
175181
176182 // Device pointers
177183 IndexTableUtilsN* mIndexTableUtilsDevice ;
178184 // device navigation views
179185 ROFOverlapTableN::View mDeviceROFOverlapTableView ;
180186 ROFVertexLookupTableN::View mDeviceROFVertexLookupTableView ;
181187 ROFMaskTableN::View mDeviceROFMaskTableView ;
188+ std::vector<typename TrackingTopologyN::View> mDeviceTrackerTopologyViews ;
189+ typename TrackingTopologyN::View mDeviceTrackingTopologyView ;
182190
183191 // Hybrid pref
184192 Vertex* mPrimaryVerticesDevice ;
@@ -193,30 +201,29 @@ class TimeFrameGPU : public TimeFrame<NLayers>
193201 const int ** mClustersIndexTablesDeviceArray ;
194202 uint8_t ** mUsedClustersDeviceArray ;
195203 const int ** mROFramesClustersDeviceArray ;
196- std::array<Tracklet*, NLayers - 1 > mTrackletsDevice ;
197- std::array<int *, NLayers - 1 > mTrackletsLUTDevice ;
198- std::array<int *, NLayers - 2 > mCellsLUTDevice ;
199- std::array<int *, NLayers - 3 > mNeighboursLUTDevice ;
204+ std::array<Tracklet*, MaxTransitions > mTrackletsDevice {} ;
205+ std::array<int *, MaxTransitions > mTrackletsLUTDevice {} ;
206+ std::array<int *, MaxCells > mCellsLUTDevice {} ;
207+ std::array<int *, MaxCells > mNeighboursLUTDevice {} ;
200208
201209 Tracklet** mTrackletsDeviceArray {nullptr };
202210 int ** mCellsLUTDeviceArray {nullptr };
203- int ** mNeighboursCellDeviceArray {nullptr };
204211 int ** mNeighboursCellLUTDeviceArray {nullptr };
205212 int ** mTrackletsLUTDeviceArray {nullptr };
206- std::array<CellSeed*, NLayers - 2 > mCellsDevice ;
213+ std::array<CellSeed*, MaxCells > mCellsDevice {} ;
207214 CellSeed** mCellsDeviceArray ;
208- std::array<int *, NLayers - 3 > mNeighboursIndexTablesDevice ;
215+ std::array<int *, MaxCells > mNeighboursIndexTablesDevice {} ;
209216 TrackSeedN* mTrackSeedsDevice {nullptr };
210217 int * mTrackSeedsLUTDevice {nullptr };
211218 unsigned int mNTracks {0 };
212- std::array<o2::track::TrackParCovF*, NLayers - 2 > mCellSeedsDevice ;
219+ std::array<o2::track::TrackParCovF*, MaxCells > mCellSeedsDevice {} ;
213220 o2::track::TrackParCovF** mCellSeedsDeviceArray ;
214- std::array<float *, NLayers - 2 > mCellSeedsChi2Device ;
221+ std::array<float *, MaxCells > mCellSeedsChi2Device {} ;
215222 float ** mCellSeedsChi2DeviceArray ;
216223
217224 TrackITSExt* mTrackITSExtDevice ;
218- std::array<gpuPair< int , int > *, NLayers - 2 > mNeighbourPairsDevice ;
219- std::array< int *, NLayers - 2 > mNeighboursDevice ;
225+ std::array<CellNeighbour *, MaxCells> mNeighboursDevice {} ;
226+ CellNeighbour** mNeighboursDeviceArray { nullptr } ;
220227 std::array<TrackingFrameInfo*, NLayers> mTrackingFrameInfoDevice ;
221228 const TrackingFrameInfo** mTrackingFrameInfoDeviceArray ;
222229
@@ -245,19 +252,19 @@ inline std::vector<unsigned int> TimeFrameGPU<NLayers>::getClusterSizes()
245252template <int NLayers>
246253inline size_t TimeFrameGPU<NLayers>::getNumberOfTracklets() const
247254{
248- return std::accumulate (mNTracklets .begin (), mNTracklets .end () , 0 );
255+ return std::accumulate (mNTracklets .begin (), mNTracklets .begin () + this -> mTrackingTopologyView . nTransitions , 0 );
249256}
250257
251258template <int NLayers>
252259inline size_t TimeFrameGPU<NLayers>::getNumberOfCells() const
253260{
254- return std::accumulate (mNCells .begin (), mNCells .end () , 0 );
261+ return std::accumulate (mNCells .begin (), mNCells .begin () + this -> mTrackingTopologyView . nCells , 0 );
255262}
256263
257264template <int NLayers>
258265inline size_t TimeFrameGPU<NLayers>::getNumberOfNeighbours() const
259266{
260- return std::accumulate (mNNeighbours .begin (), mNNeighbours .end () , 0 );
267+ return std::accumulate (mNNeighbours .begin (), mNNeighbours .begin () + this -> mTrackingTopologyView . nCells , 0 );
261268}
262269
263270} // namespace o2::its::gpu
0 commit comments