67 const auto topology = mTimeFrameGPU->getDeviceTrackingTopologyView();
70 for (
int iLayer{0}; iLayer < this->mTrkParams[iteration].NLayers; ++iLayer) {
71 if (loadFirstPassData) {
72 mTimeFrameGPU->createUsedClustersDevice(iLayer);
73 mTimeFrameGPU->loadClustersDevice(iLayer);
74 mTimeFrameGPU->loadClustersIndexTables(iLayer);
75 mTimeFrameGPU->loadROFrameClustersDevice(iLayer);
77 mTimeFrameGPU->recordEvent(iLayer);
80 for (
int linkId{0}; linkId < hostTopology.nLinks; ++linkId) {
81 mTimeFrameGPU->createTrackletsLUTDevice(loadFirstPassData, linkId);
86 mTimeFrameGPU->pushMemoryStack(iteration);
88 for (
int linkId{0}; linkId < hostTopology.nLinks; ++linkId) {
89 const auto link = hostTopology.getLink(linkId);
90 mTimeFrameGPU->waitEvent(linkId,
link.fromLayer);
91 mTimeFrameGPU->waitEvent(linkId,
link.toLayer);
92 countTrackletsInROFsHandler<NLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
93 mTimeFrameGPU->getDeviceROFMaskTableView(),
97 mTimeFrameGPU->getDeviceROFOverlapTableView(),
98 mTimeFrameGPU->getDeviceROFVertexLookupTableView(),
100 mTimeFrameGPU->getDeviceVertices(),
101 mTimeFrameGPU->getDeviceROFramesPV(),
102 mTimeFrameGPU->getDeviceArrayClusters(),
103 mTimeFrameGPU->getClusterSizes(),
104 mTimeFrameGPU->getDeviceROFrameClusters(),
105 (
const uint8_t**)mTimeFrameGPU->getDeviceArrayUsedClusters(),
106 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
107 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
108 mTimeFrameGPU->getDeviceTrackletsLUTs(),
110 this->mTrkParams[iteration].NSigmaCut,
112 mTimeFrameGPU->getLinkPhiCuts(),
113 this->mTrkParams[iteration].PVres,
114 mTimeFrameGPU->getMinRs(),
115 mTimeFrameGPU->getMaxRs(),
116 mTimeFrameGPU->getPositionResolutions(),
117 this->mTrkParams[iteration].LayerRadii,
118 mTimeFrameGPU->getLinkMSAngles(),
119 mTimeFrameGPU->getFrameworkAllocator(),
120 mTimeFrameGPU->getStreams());
121 mTimeFrameGPU->createTrackletsBuffers(linkId);
122 if (mTimeFrameGPU->getNTracklets()[linkId] == 0) {
123 mTimeFrameGPU->recordEvent(linkId);
126 computeTrackletsInROFsHandler<NLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
127 mTimeFrameGPU->getDeviceROFMaskTableView(),
131 mTimeFrameGPU->getDeviceROFOverlapTableView(),
132 mTimeFrameGPU->getDeviceROFVertexLookupTableView(),
134 mTimeFrameGPU->getDeviceVertices(),
135 mTimeFrameGPU->getDeviceROFramesPV(),
136 mTimeFrameGPU->getDeviceArrayClusters(),
137 mTimeFrameGPU->getClusterSizes(),
138 mTimeFrameGPU->getDeviceROFrameClusters(),
139 (
const uint8_t**)mTimeFrameGPU->getDeviceArrayUsedClusters(),
140 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
141 mTimeFrameGPU->getDeviceArrayTracklets(),
142 mTimeFrameGPU->getDeviceTracklets(),
143 mTimeFrameGPU->getNTracklets(),
144 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
145 mTimeFrameGPU->getDeviceTrackletsLUTs(),
147 this->mTrkParams[iteration].NSigmaCut,
149 mTimeFrameGPU->getLinkPhiCuts(),
150 this->mTrkParams[iteration].PVres,
151 mTimeFrameGPU->getMinRs(),
152 mTimeFrameGPU->getMaxRs(),
153 mTimeFrameGPU->getPositionResolutions(),
154 this->mTrkParams[iteration].LayerRadii,
155 mTimeFrameGPU->getLinkMSAngles(),
156 mTimeFrameGPU->getFrameworkAllocator(),
157 mTimeFrameGPU->getStreams());
158 mTimeFrameGPU->recordEvent(linkId);
165 const auto topology = mTimeFrameGPU->getDeviceTrackingTopologyView();
166 const auto hostTopology = mTimeFrameGPU->getTrackingTopologyView();
167 for (
int iLayer{0}; iLayer < this->mTrkParams[iteration].NLayers; ++iLayer) {
169 mTimeFrameGPU->loadUnsortedClustersDevice(iLayer);
170 mTimeFrameGPU->loadTrackingFrameInfoDevice(iLayer);
172 mTimeFrameGPU->recordEvent(iLayer);
175 for (
int cellTopologyId{hostTopology.nCells}; cellTopologyId--;) {
176 const auto cellTopology = hostTopology.getCell(cellTopologyId);
177 const auto first = hostTopology.getLink(cellTopology.firstLink);
178 const auto second = hostTopology.getLink(cellTopology.secondLink);
179 const int currentLayerTrackletsNum{
static_cast<int>(mTimeFrameGPU->getNTracklets()[cellTopology.firstLink])};
180 if (!currentLayerTrackletsNum || !mTimeFrameGPU->getNTracklets()[cellTopology.secondLink]) {
181 mTimeFrameGPU->getNCells()[cellTopologyId] = 0;
185 mTimeFrameGPU->createCellsLUTDevice(cellTopologyId);
186 mTimeFrameGPU->waitEvent(cellTopologyId, cellTopology.firstLink);
187 mTimeFrameGPU->waitEvent(cellTopologyId, cellTopology.secondLink);
188 mTimeFrameGPU->waitEvent(cellTopologyId,
first.fromLayer);
189 mTimeFrameGPU->waitEvent(cellTopologyId,
first.toLayer);
190 mTimeFrameGPU->waitEvent(cellTopologyId, second.toLayer);
191 countCellsHandler<NLayers>(mTimeFrameGPU->getDeviceArrayClusters(),
192 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
193 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
194 mTimeFrameGPU->getDeviceArrayTracklets(),
195 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
196 currentLayerTrackletsNum,
200 mTimeFrameGPU->getDeviceArrayCellsLUT(),
201 mTimeFrameGPU->getDeviceCellLUTs()[cellTopologyId],
203 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
204 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
205 this->mTrkParams[iteration].NSigmaCut,
206 this->mTrkParams[iteration].LayerxX0,
207 mTimeFrameGPU->getFrameworkAllocator(),
208 mTimeFrameGPU->getStreams());
209 mTimeFrameGPU->createCellsBuffers(cellTopologyId);
210 if (mTimeFrameGPU->getNCells()[cellTopologyId] == 0) {
211 mTimeFrameGPU->recordEvent(cellTopologyId);
214 computeCellsHandler<NLayers>(mTimeFrameGPU->getDeviceArrayClusters(),
215 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
216 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
217 mTimeFrameGPU->getDeviceArrayTracklets(),
218 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
219 currentLayerTrackletsNum,
222 mTimeFrameGPU->getDeviceCells()[cellTopologyId],
223 mTimeFrameGPU->getDeviceArrayCellsLUT(),
224 mTimeFrameGPU->getDeviceCellLUTs()[cellTopologyId],
226 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
227 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
228 this->mTrkParams[iteration].NSigmaCut,
229 this->mTrkParams[iteration].LayerxX0,
230 mTimeFrameGPU->getStreams());
231 mTimeFrameGPU->recordEvent(cellTopologyId);
233 mTimeFrameGPU->syncStreams(
false);
239 const auto hostTopology = mTimeFrameGPU->getTrackingTopologyView();
240 for (
int outerLayer{0}; outerLayer < NLayers; ++outerLayer) {
241 for (
int targetCellTopologyId{0}; targetCellTopologyId < hostTopology.nCells; ++targetCellTopologyId) {
242 const auto targetCellTopology = hostTopology.getCell(targetCellTopologyId);
243 if (targetCellTopology.hitLayerMask.last() != outerLayer) {
246 const int targetCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[targetCellTopologyId])};
247 if (!targetCellsNum) {
248 mTimeFrameGPU->getNNeighbours()[targetCellTopologyId] = 0;
249 mTimeFrameGPU->recordEvent(targetCellTopologyId);
252 mTimeFrameGPU->createNeighboursIndexTablesDevice(targetCellTopologyId);
253 mTimeFrameGPU->createNeighboursLUTDevice(targetCellTopologyId, targetCellsNum);
255 for (
int sourceCellTopologyId{0}; sourceCellTopologyId < hostTopology.nCells; ++sourceCellTopologyId) {
256 const auto sourceCellTopology = hostTopology.getCell(sourceCellTopologyId);
257 const int sourceCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[sourceCellTopologyId])};
258 if (!sourceCellsNum || sourceCellTopology.secondLink != targetCellTopology.firstLink) {
261 mTimeFrameGPU->waitEvent(targetCellTopologyId, sourceCellTopologyId);
262 countCellNeighboursHandler<NLayers>(mTimeFrameGPU->getDeviceArrayCells(),
263 mTimeFrameGPU->getDeviceNeighboursIndexTables(targetCellTopologyId),
264 mTimeFrameGPU->getDeviceArrayCellsLUT(),
265 sourceCellTopologyId,
266 targetCellTopologyId,
267 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
270 mTimeFrameGPU->getStream(targetCellTopologyId));
274 mTimeFrameGPU->getDeviceNeighboursLUT(targetCellTopologyId),
276 mTimeFrameGPU->getFrameworkAllocator(),
277 mTimeFrameGPU->getStream(targetCellTopologyId));
279 mTimeFrameGPU->createNeighboursDevice(targetCellTopologyId);
280 if (mTimeFrameGPU->getNNeighbours()[targetCellTopologyId] == 0) {
281 mTimeFrameGPU->recordEvent(targetCellTopologyId);
285 for (
int sourceCellTopologyId{0}; sourceCellTopologyId < hostTopology.nCells; ++sourceCellTopologyId) {
286 const auto sourceCellTopology = hostTopology.getCell(sourceCellTopologyId);
287 const int sourceCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[sourceCellTopologyId])};
288 if (!sourceCellsNum || sourceCellTopology.secondLink != targetCellTopology.firstLink) {
291 computeCellNeighboursHandler<NLayers>(mTimeFrameGPU->getDeviceArrayCells(),
292 mTimeFrameGPU->getDeviceNeighboursIndexTables(targetCellTopologyId),
293 mTimeFrameGPU->getDeviceArrayCellsLUT(),
294 mTimeFrameGPU->getDeviceNeighbours(targetCellTopologyId),
295 sourceCellTopologyId,
296 targetCellTopologyId,
297 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
300 mTimeFrameGPU->getStream(targetCellTopologyId));
302 mTimeFrameGPU->recordEvent(targetCellTopologyId);
305 mTimeFrameGPU->syncStreams(
false);
312 firstClusters.resize(this->mTrkParams[iteration].NLayers);
313 const auto hostTopology = mTimeFrameGPU->getTrackingTopologyView();
317 for (
int startLevel{this->mTrkParams[iteration].CellsPerRoad()}; startLevel >= this->mTrkParams[iteration].CellMinimumLevel(); --startLevel) {
319 for (
int startCellTopologyId{0}; startCellTopologyId < hostTopology.nCells; ++startCellTopologyId) {
320 const int startLayer = hostTopology.getCell(startCellTopologyId).hitLayerMask.last();
321 if (!(this->mTrkParams[iteration].StartLayerMask.has(startLayer)) || mTimeFrameGPU->getNCells()[startCellTopologyId] == 0) {
324 processNeighboursHandler<NLayers>(startLevel,
326 mTimeFrameGPU->getDeviceArrayCells(),
327 mTimeFrameGPU->getDeviceCells()[startCellTopologyId],
330 mTimeFrameGPU->getArrayNCells().data(),
331 (
const uint8_t**)mTimeFrameGPU->getDeviceArrayUsedClusters(),
332 mTimeFrameGPU->getDeviceArrayNeighbours(),
333 mTimeFrameGPU->getDeviceArrayNeighboursCellLUT(),
334 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
337 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
338 this->mTrkParams[iteration].MaxChi2NDF,
339 this->mTrkParams[iteration].MaxHoles,
340 this->mTrkParams[iteration].getMinSeedingClusters(),
341 this->mTrkParams[iteration].HoleLayerMask,
342 this->mTrkParams[iteration].getNonSeedingLayerMask(),
343 this->mTrkParams[iteration].LayerxX0,
344 mTimeFrameGPU->getDevicePropagator(),
345 this->mTrkParams[iteration].CorrType,
346 mTimeFrameGPU->getFrameworkAllocator());
349 if (trackSeeds.empty()) {
350 LOGP(
debug,
"No track seeds found, skipping track finding");
353 mTimeFrameGPU->loadTrackSeedsDevice(trackSeeds);
358 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
359 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
360 mTimeFrameGPU->getDeviceTrackSeedsLUT(),
361 this->mTrkParams[iteration].LayerRadii,
362 this->mTrkParams[iteration].MinPt,
363 this->mTrkParams[iteration].LayerxX0,
366 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
367 this->mTrkParams[iteration].MaxChi2NDF,
368 this->mTrkParams[iteration].ReseedIfShorter,
369 this->mTrkParams[iteration].RepeatRefitOut,
370 this->mTrkParams[iteration].ShiftRefToCluster,
371 mTimeFrameGPU->getDevicePropagator(),
372 this->mTrkParams[iteration].CorrType,
373 mTimeFrameGPU->getFrameworkAllocator());
374 mTimeFrameGPU->createTrackITSExtDevice(trackSeeds.size());
376 mTimeFrameGPU->createTrackExtensionScratchDevice(
constants::GPUThreadsTotal, this->mTrkParams[iteration].TrackFollowerMaxHypotheses);
379 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
380 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
381 mTimeFrameGPU->getDeviceIndexTableUtils(),
382 mTimeFrameGPU->getDeviceROFMaskTableView(),
383 mTimeFrameGPU->getDeviceROFOverlapTableView(),
384 mTimeFrameGPU->getDeviceArrayClusters(),
385 (
const unsigned char**)mTimeFrameGPU->getDeviceArrayUsedClusters(),
386 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
387 mTimeFrameGPU->getDeviceROFrameClusters(),
388 mTimeFrameGPU->getDeviceTrackITSExt(),
389 mTimeFrameGPU->getDeviceTrackIndices(),
390 mTimeFrameGPU->getDeviceTrackSeedsLUT(),
391 extendTracks ? mTimeFrameGPU->getDeviceActiveTrackExtensionHypotheses() :
nullptr,
392 extendTracks ? mTimeFrameGPU->getDeviceNextTrackExtensionHypotheses() :
nullptr,
393 this->mTrkParams[iteration].LayerRadii,
394 this->mTrkParams[iteration].MinPt,
395 this->mTrkParams[iteration].LayerxX0,
397 mTimeFrameGPU->getNTrackSeeds(),
399 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
400 this->mTrkParams[iteration].MaxChi2NDF,
401 this->mTrkParams[iteration].ReseedIfShorter,
402 this->mTrkParams[iteration].RepeatRefitOut,
403 this->mTrkParams[iteration].ShiftRefToCluster,
404 this->mTrkParams[iteration].NLayers,
405 this->mTrkParams[iteration].PhiBins,
406 this->mTrkParams[iteration].TrackFollowerMaxHypotheses,
409 this->mTrkParams[iteration].TrackFollowerNSigmaCutPhi,
410 this->mTrkParams[iteration].TrackFollowerNSigmaCutZ,
411 mTimeFrameGPU->getDevicePropagator(),
412 this->mTrkParams[iteration].CorrType,
413 mTimeFrameGPU->getFrameworkAllocator());
414 mTimeFrameGPU->downloadTrackITSExtDevice();
415 mTimeFrameGPU->downloadTrackIndicesDevice();
417 auto& tracks = mTimeFrameGPU->getTrackITSExt();
418 const auto& trackIndices = mTimeFrameGPU->getTrackIndices();
419 this->acceptTracks(iteration, tracks, trackIndices, firstClusters);
420 mTimeFrameGPU->loadUsedClustersDevice();
422 this->markTracks(iteration);
424 mTimeFrameGPU->popMemoryStack(iteration);
void computeTrackSeedHandler(TrackSeed< NLayers > *trackSeeds, const TrackingFrameInfo **foundTrackingFrameInfo, const Cluster **unsortedClusters, const IndexTableUtils< NLayers > *utils, const typename ROFMaskTable< NLayers >::View &rofMask, const typename ROFOverlapTable< NLayers >::View &rofOverlaps, const Cluster **clusters, const unsigned char **usedClusters, const int **clustersIndexTables, const int **ROFClusters, o2::its::TrackITSExt *tracks, int *trackIndices, const int *seedLUT, TrackExtensionHypothesis< NLayers > *activeHypotheses, TrackExtensionHypothesis< NLayers > *nextHypotheses, const std::vector< float > &layerRadiiHost, const std::vector< float > &minPtsHost, const std::vector< float > &layerxX0Host, const unsigned int nSeeds, const unsigned int nTracks, const float Bz, const float maxChi2ClusterAttachment, const float maxChi2NDF, const int reseedIfShorter, const bool repeatRefitOut, const bool shiftRefToCluster, const int nLayers, const int phiBins, const int maxHypotheses, const bool extendTop, const bool extendBot, const float nSigmaCutPhi, const float nSigmaCutZ, const o2::base::Propagator *propagator, const o2::base::PropagatorF::MatCorrType matCorrType, o2::its::ExternalAllocator *alloc)