2121#include " ITStracking/Configuration.h"
2222#include " ITStracking/TrackExtensionHypothesis.h"
2323#include " ITStrackingGPU/Utils.h"
24+ #include " ITStracking/ClusterLines.h"
25+ #include " ITStracking/LineProjection.h"
2426
2527namespace o2 ::its::gpu
2628{
@@ -54,10 +56,14 @@ class TimeFrameGPU : public TimeFrame<NLayers>
5456 void createTrackingFrameInfoDeviceArray (const int = NLayers);
5557 void loadUnsortedClustersDevice (const int );
5658 void createUnsortedClustersDeviceArray (const int = NLayers);
57- void loadClustersDevice (const int );
5859 void createClustersDeviceArray (const int = NLayers);
5960 void loadClustersIndexTables (const int );
6061 void createClustersIndexTablesArray (const int = NLayers);
62+ void createClustersDevice (const int );
63+ void createClustersIndexTables (const int );
64+ void createClusterRadiiDevice ();
65+ void uploadClusterRadii ();
66+ void sortClustersDevice (const int layer, const TrackingParameters& trkParam);
6167 void createUsedClustersDevice (const int );
6268 void createUsedClustersDeviceArray (const int = NLayers);
6369 void loadUsedClustersDevice ();
@@ -87,6 +93,20 @@ class TimeFrameGPU : public TimeFrame<NLayers>
8793 void createTrackExtensionScratchDevice (const int nThreads, const int maxHypotheses);
8894 void downloadTrackITSExtDevice ();
8995
96+ // Seeding-vertexer
97+ void createClusterOwnersDeviceArray ();
98+ void createClusterOwnersDevice ();
99+ void resetClusterOwnersDevice ();
100+ void createClusterSortScratchDevice (const int layer);
101+
102+ void createLinesDevice (const int nCells);
103+ void createDiamondDevice (const Vertex& diamond);
104+ unsigned int downloadLinesDevice ();
105+ unsigned int getNLines ();
106+ const auto & getHostLines () const { return mLinesHost ; }
107+ const auto & getHostLineRof () const { return mLineRofHost ; }
108+ const auto & getHostLineClusters () const { return mLineClustersHost ; }
109+
90110 // / synchronization
91111 auto & getStream (const size_t stream) { return mGpuStreams [stream]; }
92112 auto & getStreams () { return mGpuStreams ; }
@@ -111,6 +131,17 @@ class TimeFrameGPU : public TimeFrame<NLayers>
111131 auto & getTrackITSExt () { return mTrackITSExt ; }
112132 auto & getTrackIndices () { return mTrackIndices ; }
113133 Vertex* getDeviceVertices () { return mPrimaryVerticesDevice ; }
134+ int * getDeviceROFramesClusters (const int layer) { return mROFramesClustersDevice [layer]; }
135+ int * getDeviceClusterSortKeys (const int layer) { return mClusterSortKeysDevice [layer]; }
136+ int * getDeviceClusterSortPerm (const int layer) { return mClusterSortPermDevice [layer]; }
137+ Cluster* getDeviceUnsortedClusters (const int layer) { return mUnsortedClustersDevice [layer]; }
138+ Cluster* getDeviceClusters (const int layer) { return mClustersDevice [layer]; }
139+ int * getDeviceClustersIndexTable (const int layer) { return mClustersIndexTablesDevice [layer]; }
140+ const float * getDeviceMinRs () const { return mClusterMinRDevice ; }
141+ const float * getDeviceMaxRs () const { return mClusterMaxRDevice ; }
142+ int * getDeviceROFramesPV () { return mROFramesPVDevice ; }
143+ unsigned char * getDeviceUsedClusters (const int );
144+ const o2::base::Propagator* getChainPropagator ();
114145
115146 // Hybrid
116147 TrackITSExt* getDeviceTrackITSExt () { return mTrackITSExtDevice ; }
@@ -119,6 +150,39 @@ class TimeFrameGPU : public TimeFrame<NLayers>
119150 TrackExtensionHypothesis<NLayers>* getDeviceNextTrackExtensionHypotheses () { return mNextTrackExtensionHypothesesDevice ; }
120151 int * getDeviceNeighboursLUT (const int layer) { return mNeighboursLUTDevice [layer]; }
121152 CellNeighbour** getDeviceArrayNeighbours () { return mNeighboursDeviceArray ; }
153+ unsigned long long ** getDeviceArrayClusterOwners () { return mClusterOwnersDeviceArray ; }
154+ o2::its::Line* getDeviceLines () { return mLinesDevice ; }
155+ int * getDeviceLineSlots () { return mLineSlotsDevice ; }
156+ int * getDeviceLineRof () { return mLineRofDevice ; }
157+ int * getDeviceLineClusters () { return mLineClustersDevice ; }
158+ float * getDeviceLineChi2 () { return mLineChi2Device ; }
159+ float * getDeviceLinePt () { return mLinePtDevice ; }
160+ float * getDeviceLineZs () { return mLineZsDevice ; }
161+ o2::its::TimeEstBC* getDeviceLineTimes () { return mLineTimesDevice ; }
162+ int * getDeviceLineSortedIdx () { return mLinesSortedIdx ; }
163+ LineProjSoA getLineProjSoA () { return {mLineZsDevice , mLineTimesDevice , mLinesSortedIdx , mLineRofDevice }; }
164+ LineProjSoA getLineProjSortedSoA () { return {mLineZsSortedDevice , mLineTimesSortedDevice , mLinesSortedIdx , mLineRofSortedDevice }; }
165+ int * getDeviceRofLineOffsets () { return mRofLineOffsetsDevice ; }
166+ int * getDeviceLineDensity () { return mLineDensityDevice ; }
167+ gpu::LineWindow* getDeviceLineWin () { return mLineWinDevice ; }
168+ uint8_t * getDeviceLineIsPeak () { return mLineIsPeakDevice ; }
169+ int * getDeviceLineDensityFine () { return mLineDensityFineDevice ; }
170+ gpu::LineWindow* getDeviceLineWinFine () { return mLineWinFineDevice ; }
171+ uint8_t * getDeviceLineIsPeakFine () { return mLineIsPeakFineDevice ; }
172+ int * getDevicePeakScan () { return mPeakScanDevice ; }
173+ int * getDevicePeakLineIdx () { return mPeakLineIdxDevice ; }
174+ int * getDevicePeakOffsets () { return mPeakOffsetsDevice ; }
175+ const int * getDeviceNPeaks () { return mPeakOffsetsDevice + this ->getNrof (1 ); }
176+ VertexCand* getDeviceVertexCands () { return mVertexCandsDevice ; }
177+ int downloadVertexCandsDevice ();
178+ void downloadPeakMembershipInputs (); // MC-only: peak indices, z-windows and the sorted time/idx columns
179+ const auto & getHostVertexCands () const { return mVertexCandsHost ; }
180+ const auto & getHostPeakOffsets () const { return mPeakOffsetsHost ; }
181+ const auto & getHostPeakMembership () const { return mPeakMembershipHost ; }
182+ std::vector<o2::MCCompLabel>& getLineLabelFlat () { return mLineLabelFlatHost ; }
183+ const std::vector<o2::MCCompLabel>& getLineLabelFlat () const { return mLineLabelFlatHost ; }
184+ Vertex* getDeviceDiamond () { return mDiamondDevice ; }
185+ std::array<CellNeighbour*, MaxCells>& getDeviceNeighboursAll () { return mNeighboursDevice ; }
122186 CellNeighbour* getDeviceNeighbours (const int layer) { return mNeighboursDevice [layer]; }
123187 const TrackingFrameInfo** getDeviceArrayTrackingFrameInfo () const { return mTrackingFrameInfoDeviceArray ; }
124188 const Cluster** getDeviceArrayClusters () const { return mClustersDeviceArray ; }
@@ -156,6 +220,10 @@ class TimeFrameGPU : public TimeFrame<NLayers>
156220 size_t getNumberOfCells () const final ;
157221 size_t getNumberOfNeighbours () const final ;
158222
223+ protected:
224+ void prepareClusters (const TrackingParameters& trkParam, const int maxLayers) override ;
225+ void allocateClusterSortStorage (const TrackingParameters& trkParam, const int maxLayers) override ;
226+
159227 private:
160228 enum class SlotInit {
161229 Raw, // /< whatever the allocator handed back
@@ -215,6 +283,11 @@ class TimeFrameGPU : public TimeFrame<NLayers>
215283 const int ** mClustersIndexTablesDeviceArray {nullptr };
216284 uint8_t ** mUsedClustersDeviceArray {nullptr };
217285 const int ** mROFramesClustersDeviceArray {nullptr };
286+ int * mROFramesPVDevice ;
287+ std::array<int *, NLayers> mClusterSortKeysDevice {};
288+ std::array<int *, NLayers> mClusterSortPermDevice {};
289+ float * mClusterMinRDevice {nullptr };
290+ float * mClusterMaxRDevice {nullptr };
218291 std::array<Tracklet*, MaxLinks> mTrackletsDevice {};
219292 std::array<int *, MaxLinks> mTrackletsLUTDevice {};
220293 std::array<int *, MaxCells> mCellsLUTDevice {};
@@ -239,6 +312,40 @@ class TimeFrameGPU : public TimeFrame<NLayers>
239312 CellNeighbour** mNeighboursDeviceArray {nullptr };
240313 std::array<TrackingFrameInfo*, NLayers> mTrackingFrameInfoDevice {};
241314 const TrackingFrameInfo** mTrackingFrameInfoDeviceArray {nullptr };
315+ std::array<unsigned long long *, 3 > mClusterOwnersDevice {};
316+ unsigned long long ** mClusterOwnersDeviceArray {nullptr };
317+ int * mLineSlotsDevice {nullptr };
318+ o2::its::Line* mLinesDevice {nullptr };
319+ int * mLineRofDevice {nullptr };
320+ int * mLineClustersDevice {nullptr };
321+ float * mLineChi2Device {nullptr };
322+ float * mLinePtDevice {nullptr };
323+ float * mLineZsDevice {nullptr };
324+ o2::its::TimeEstBC* mLineTimesDevice {nullptr };
325+ float * mLineZsSortedDevice {nullptr };
326+ o2::its::TimeEstBC* mLineTimesSortedDevice {nullptr };
327+ int * mLinesSortedIdx {nullptr };
328+ int * mLineRofSortedDevice {nullptr }; // per (sorted) line's ROF
329+ int * mRofLineOffsetsDevice {nullptr }; // CSR offsets into the (rof,z)-sorted lines, size nRofs+1
330+ int * mLineDensityDevice {nullptr }; // per (sorted) line: count of time-compatible neighbours in its z-window
331+ gpu::LineWindow* mLineWinDevice {nullptr }; // per (sorted) line: [lo,hi) bounds of its z-window (sorted coords)
332+ uint8_t * mLineIsPeakDevice {nullptr }; // per (sorted) line: 1 if it is a local density peak (vertex candidate)
333+ int * mLineDensityFineDevice {nullptr };
334+ gpu::LineWindow* mLineWinFineDevice {nullptr };
335+ uint8_t * mLineIsPeakFineDevice {nullptr };
336+ int * mPeakScanDevice {nullptr }; // per (sorted) line: number of peaks strictly before it
337+ int * mPeakLineIdxDevice {nullptr }; // per peak slot: the sorted line index it came from
338+ int * mPeakOffsetsDevice {nullptr }; // CSR offsets into the compacted peaks
339+ VertexCand* mVertexCandsDevice {nullptr };
340+ int mNLinesCapacity {0 }; // = nCells the line buffers were sized for
341+ std::vector<o2::its::Line> mLinesHost ;
342+ std::vector<int > mLineRofHost ;
343+ std::vector<int > mLineClustersHost ;
344+ std::vector<VertexCand> mVertexCandsHost ;
345+ std::vector<int > mPeakOffsetsHost ;
346+ PeakMembershipHost mPeakMembershipHost ;
347+ std::vector<o2::MCCompLabel> mLineLabelFlatHost ;
348+ Vertex* mDiamondDevice {nullptr };
242349
243350 // State
244351 Streams mGpuStreams ;
0 commit comments