diff --git a/GPU/GPUTracking/Base/GPUReconstruction.cxx b/GPU/GPUTracking/Base/GPUReconstruction.cxx index 904db3c9c0065..b884c8ca73155 100644 --- a/GPU/GPUTracking/Base/GPUReconstruction.cxx +++ b/GPU/GPUTracking/Base/GPUReconstruction.cxx @@ -337,6 +337,11 @@ int32_t GPUReconstruction::InitPhaseBeforeDevice() mNStreams = std::max(GetProcessingSettings().nStreams, 3); } + if ((int32_t)GetProcessingSettings().nStreamsTPCSectorTracking > GetProcessingSettings().nStreams || GetProcessingSettings().nStreamsTPCSectorTracking < 1) { + GPUError("Invalid value for nStreamsTPCSectorTracking: %d (must not exceed nStreams: %d)", GetProcessingSettings().nStreamsTPCSectorTracking, (int32_t)GetProcessingSettings().nStreams); + mProcessingSettings->nStreamsTPCSectorTracking = std::max(GetProcessingSettings().nStreams, 1); + } + if (GetProcessingSettings().nTPCClustererLanes == -1) { mProcessingSettings->nTPCClustererLanes = (GetRecoStepsGPU() & RecoStep::TPCClusterFinding) ? 3 : std::max(1, std::min(GPUTPCGeometry::NSECTORS, GetProcessingSettings().inKernelParallel ? (mMaxHostThreads >= 4 ? std::min(mMaxHostThreads / 2, mMaxHostThreads >= 32 ? GPUTPCGeometry::NSECTORS : 4) : 1) : mMaxHostThreads)); } diff --git a/GPU/GPUTracking/CMakeLists.txt b/GPU/GPUTracking/CMakeLists.txt index 6993bbae056e1..72575f089c36a 100644 --- a/GPU/GPUTracking/CMakeLists.txt +++ b/GPU/GPUTracking/CMakeLists.txt @@ -161,6 +161,7 @@ set(HDRS_INSTALL SectorTracker/GPUTPCBaseTrackParam.h SectorTracker/GPUTPCClusterData.h SectorTracker/GPUTPCDef.h + SectorTracker/GPUTPCExtrapolationCandidate.h SectorTracker/GPUTPCHit.h SectorTracker/GPUTPCHitId.h SectorTracker/GPUTPCMCInfo.h diff --git a/GPU/GPUTracking/Definitions/GPUSettingsList.template b/GPU/GPUTracking/Definitions/GPUSettingsList.template index 9c744433877fb..6fce3247cf70a 100644 --- a/GPU/GPUTracking/Definitions/GPUSettingsList.template +++ b/GPU/GPUTracking/Definitions/GPUSettingsList.template @@ -394,6 +394,7 @@ AddOption(ompThreads, int32_t, -1, "", 0, "Deprecated synonym for nHostThreads") AddOption(inKernelParallel, uint8_t, 2, "", 0, "Parallelize with multi-threading inside kernels on the host instead of over TPC sectors: 0 disable, 1 full and exclusive in-kernel parallelization, 2 for nested parallelization over TPC sectors (nTPCClustererLanes thread-groups) and inside kernels") AddOption(autoAdjustHostThreads, bool, true, "", 0, "Auto-adjust number of OMP threads, decreasing the number for small input data") AddOption(nStreams, int8_t, 8, "", 0, "Number of GPU streams / command queues") +AddOption(nStreamsTPCSectorTracking, int8_t, 6, "", 0, "Number of GPU streams / command queues for TPC sector tracking, gets clamped by nStreams") AddOption(nTPCClustererLanes, int8_t, -1, "", 0, "Number of TPC clusterers that can run in parallel (-1 = autoset)") AddOption(overrideClusterizerFragmentLen, int32_t, -1, "", 0, "Force the cluster max fragment len to a certain value (-1 = autodetect)") AddOption(delayedOutput, bool, true, "", 0, "Delay output to be parallel to track fit") diff --git a/GPU/GPUTracking/Definitions/Parameters/GPUParameters.csv b/GPU/GPUTracking/Definitions/Parameters/GPUParameters.csv index 87336277eadbd..38a556a68a12c 100644 --- a/GPU/GPUTracking/Definitions/Parameters/GPUParameters.csv +++ b/GPU/GPUTracking/Definitions/Parameters/GPUParameters.csv @@ -5,12 +5,12 @@ WARP_SIZE,0,,64,64,32,32,32,32,32,32,32,32,32,32,32,64,32,64,32 THREAD_COUNT_DEFAULT,256,,256,256,,,,,,512,512,,512,256,512,512,512,,256 ,,,,,,,,,,,,,,,,,,, LB:,,,,,,,,,,,,,,,,,,, -GPUTPCCreateTrackingData,256,,"[256, 7]","[192, 2]",,,,,,"[224, 7]",256,"[128, 14]",416,,"[64, 21]",,384,"[320, 2]",64 -GPUTPCTrackletConstructor,256,,"[768, 8]","[512, 10]","[256, 2]","[256, 1]","[256, 2]","[1024, 2]","[512, 4]",1024,"[256, 2]",1024,"[1024, 1]",,"[768, 2]",,768,512,"[128, 32]" -GPUTPCTrackletSelector,256,,"[384, 5]","[192, 10]","[256, 3]","[256, 1]","[256, 3]","[512, 4]","[256, 3]","[288, 3]","[192, 3]","[544, 1]","[32, 2]",,"[384, 3]",,992,"[256, 6]", -GPUTPCNeighboursFinder,256,,"[192, 8]","[960, 8]",256,256,256,512,256,864,"[640, 1]","[512, 2]","[736, 1]",,"[480, 3]",,992,"[704, 1]", -GPUTPCNeighboursCleaner,256,,"[128, 5]","[384, 9]",256,256,256,256,256,544,512,"[192, 9]","[512, 1]",,"[384, 5]",,672,"[640, 1]", -GPUTPCExtrapolationTracking,256,,"[256, 7]","[256, 2]",,,,,,"[352, 4]","[192, 2]","[896, 1]","[352, 1]",,"[1024, 1]",,896,1024, +GPUTPCCreateTrackingData,256,,"[256, 7]","[192, 2]",,,,,,"[224, 7]",256,"[128, 14]","[128, 6]",,"[64, 21]",,384,"[256, 2]",64 +GPUTPCTrackletConstructor,256,,"[768, 8]","[512, 10]","[256, 2]","[256, 1]","[256, 2]","[1024, 2]","[512, 4]",1024,"[256, 2]",1024,"[1024, 1]",,"[768, 2]",,768,"[512, 1]","[128, 32]" +GPUTPCTrackletSelector,256,,"[384, 5]","[192, 10]","[256, 3]","[256, 1]","[256, 3]","[512, 4]","[256, 3]","[288, 3]","[192, 3]","[544, 1]",352,,"[384, 3]",,992,"[64, 16]", +GPUTPCNeighboursFinder,256,,"[192, 8]","[960, 8]",256,256,256,512,256,864,"[640, 1]","[512, 2]","[896, 1]",,"[480, 3]",,992,"[896, 1]", +GPUTPCNeighboursCleaner,256,,"[128, 5]","[384, 9]",256,256,256,256,256,544,512,"[192, 9]","[256, 2]",,"[384, 5]",,672,"[512, 3]", +GPUTPCExtrapolationTracking,256,,"[128, 1]","[128, 1]",,,,,,"[64, 1]","[64, 1]","[64, 1]","[544, 2]",,"[128, 1]",,"[64, 1]","[128, 1]", GPUTRDTrackerKernels_gpuVersion,512,,,,,,,,,512,,512,512,,512,,,512, GPUTPCCreateOccupancyMap_fill,256,,,,,,,,,256,,256,256,,256,,,256, GPUTPCCreateOccupancyMap_fold,256,,,,,,,,,256,,256,256,,256,,,256, @@ -64,8 +64,8 @@ GPUTPCGMMergerMergeLoopers_step1,256,,,,,,,,,256,,256,256,,256,,256,256, GPUTPCGMMergerMergeLoopers_step2,256,,,,,,,,,256,,256,256,,256,,256,256, GPUTPCGMO2Output_prepare,256,,,,,,,,,256,,256,256,,256,,256,256, GPUTPCGMO2Output_output,256,,,,,,,,,256,,256,256,,256,,256,256, -GPUTPCStartHitsFinder,256,,"[1024, 2]","[1024, 7]",256,256,256,256,256,"[224, 1]",512,"[416, 4]",928,,"[320, 5]",,608,"[448, 3]", -GPUTPCStartHitsSorter,256,,"[1024, 5]","[512, 7]",256,256,256,256,256,"[320, 2]","[512, 1]","[864, 1]","[96, 2]",,"[192, 5]",,608,"[448, 1]", +GPUTPCStartHitsFinder,256,,"[1024, 2]","[1024, 7]",256,256,256,256,256,"[224, 1]",512,"[256, 1]","[224, 5]",,"[896, 2]",,"[928, 1]","[256, 5]", +GPUTPCStartHitsSorter,256,,"[1024, 5]","[512, 7]",256,256,256,256,256,"[320, 2]","[512, 1]",640,"[1024, 1]",,"[320, 6]",,928,448, GPUTPCCFCheckPadBaseline,576,,"[576, 2]","[576, 2]",,,,,,"[576, 3]",,"[576, 1]","[576, 1]",,"[576, 2]",,"[576, 2]",576, GPUTPCCFHIPTailConnector,256,,256,256,,,,,,"[224, 2]",,"[320, 5]","[704, 1]",,"[128, 7]",,,"[448, 4]", GPUTPCCFHIPClusterizer,256,,256,256,,,,,,"[288, 5]",,"[480, 3]","[448, 3]",,352,,,"[512, 3]", @@ -111,8 +111,8 @@ AMD_EUS_PER_CU,0,0,4,4,,,,,,,,,,,4,,0,4, SORT_STARTHITS,1,0,,,,,,,,1,,1,1,,1,,1,1, TPC_MERGER_REBUILD_CONSTRAINED_ROW_MEMORY,0,0,,,,,,,,,,,,,,,,, NEIGHBOURS_FINDER_MAX_NNEIGHUP,6,0,10,4,,,,,,4,4,4,4,,5,,2,5, -NEIGHBOURS_FINDER_UNROLL_GLOBAL,4,0,4,2,,,,,,2,,8,8,,4,,2,2, -NEIGHBOURS_FINDER_UNROLL_SHARED,1,0,0,0,,,,,,1,,1,0,,1,,1,1, +NEIGHBOURS_FINDER_UNROLL_GLOBAL,4,0,4,2,,,,,,2,,8,2,,2,,8,4, +NEIGHBOURS_FINDER_UNROLL_SHARED,1,0,0,0,,,,,,1,,0,1,,0,,1,0, TRACKLET_SELECTOR_HITS_REG_SIZE,12,0,9,27,,,,,,20,20,20,20,,20,,2,20, ALTERNATE_BORDER_SORT,1,0,1,1,,,,,,1,1,1,1,,1,,1,1, SORT_BEFORE_FIT,1,0,1,1,,,,,,1,1,1,1,,1,,1,1, diff --git a/GPU/GPUTracking/Global/GPUChainTracking.h b/GPU/GPUTracking/Global/GPUChainTracking.h index 87723cdddd088..bc27d4d478dc4 100644 --- a/GPU/GPUTracking/Global/GPUChainTracking.h +++ b/GPU/GPUTracking/Global/GPUChainTracking.h @@ -95,6 +95,7 @@ class GPUChainTracking : public GPUChain int32_t DoQueuedUpdates(int32_t stream, bool updateSlave = true); // Forces doing queue calib updates, don't call when you are not sure you are allowed to do so! bool QARanForTF() const { return mFractionalQAEnabled; } static void ApplySyncSettings(GPUSettingsProcessing& proc, GPUSettingsRec& rec, gpudatatypes::RecoStepField& steps, bool syncMode, bool asyncMode, int32_t dEdxMode = -2); + static uint32_t StreamForSector(uint32_t sector, const GPUSettingsProcessing& proc); // Structures for input and output data GPUTrackingInOutPointers& mIOPtrs; @@ -220,6 +221,7 @@ class GPUChainTracking : public GPUChain struct eventStruct // Must consist only of void* ptr that will hold the GPU event ptrs! { deviceEvent sector[NSECTORS]; + deviceEvent extrapolationTrackingDone[NSECTORS]; deviceEvent stream[constants::GPU_MAX_STREAMS]; deviceEvent init; deviceEvent single; @@ -234,8 +236,6 @@ class GPUChainTracking : public GPUChain GPUChainTracking(GPUReconstruction* rec, uint32_t maxTPCHits = constants::GPU_MEM_MAX_TPC_CLUSTERS, uint32_t maxTRDTracklets = constants::GPU_MEM_MAX_TRD_TRACKLETS); - int32_t ExtrapolationTracking(uint32_t iSector, bool blocking); - int32_t PrepareProfile(); int32_t DoProfile(); void PrintMemoryRelations(); @@ -295,8 +295,6 @@ class GPUChainTracking : public GPUChain // Synchronization and Locks eventStruct* mEvents = nullptr; - std::array mExtrapolationTrackingDone; - std::vector mOutputQueue; private: @@ -321,7 +319,6 @@ class GPUChainTracking : public GPUChain void SortClusters(bool buildNativeGPU, bool propagateMCLabels, o2::tpc::ClusterNativeAccess* clusterAccess, o2::tpc::ClusterNative* clusters); template int32_t RunTRDTrackingInternal(); - uint32_t StreamForSector(uint32_t sector) const; // Debug void DoDebugMergerNClDump(const GPUTPCGMMerger& merger); diff --git a/GPU/GPUTracking/Global/GPUChainTrackingSectorTracker.cxx b/GPU/GPUTracking/Global/GPUChainTrackingSectorTracker.cxx index 1f472b380346a..3365ead8da6ea 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingSectorTracker.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingSectorTracker.cxx @@ -35,20 +35,15 @@ using namespace o2::gpu; -uint32_t GPUChainTracking::StreamForSector(uint32_t sector) const +uint32_t GPUChainTracking::StreamForSector(uint32_t sector, const GPUSettingsProcessing& proc) { - return sector % mRec->NStreams(); -} - -int32_t GPUChainTracking::ExtrapolationTracking(uint32_t iSector, bool blocking) -{ - const uint32_t stream = StreamForSector(iSector); - runKernel({GetGridBlk(256, stream), {iSector}}); - TransferMemoryResourceLinkToHost(RecoStep::TPCSectorTracking, processors()->tpcTrackers[iSector].MemoryResCommon(), stream); - if (blocking) { - SynchronizeStream(stream); + uint32_t nStreams = proc.nStreamsTPCSectorTracking; + if (nStreams % 2 == 0 && nStreams > 1) { + uint32_t nStreamsHalf = nStreams / 2; + return sector % nStreamsHalf + (2 * sector < NSECTORS ? 0 : nStreamsHalf); + } else { + return sector % nStreams; } - return (0); } int32_t GPUChainTracking::RunTPCTrackingSectors() @@ -145,7 +140,7 @@ int32_t GPUChainTracking::RunTPCTrackingSectors_internal() mRec->runParallelOuterLoop(doGPU, NSECTORS, [&](uint32_t iSector) { GPUTPCTracker& trk = processors()->tpcTrackers[iSector]; GPUTPCTracker& trkShadow = doGPU ? processorsShadow()->tpcTrackers[iSector] : trk; - int32_t useStream = StreamForSector(iSector); + int32_t useStream = StreamForSector(iSector, GetProcessingSettings()); if (GetProcessingSettings().debugLevel >= 3) { GPUInfo("Creating Sector Data (Sector %d)", iSector); @@ -230,39 +225,42 @@ int32_t GPUChainTracking::RunTPCTrackingSectors_internal() if (doGPU || GetProcessingSettings().debugLevel >= 1) { if (param().rec.tpc.extrapolationTracking) { - std::vector blocking(NSECTORS * mRec->NStreams()); - for (uint32_t iSector = 0; iSector < NSECTORS; iSector++) { - for (uint32_t iStream = 0; iStream < mRec->NStreams(); iStream++) { - blocking[iSector * mRec->NStreams() + iStream] = StreamForSector(iSector) == iStream; - } + uint32_t nSectorsHalf = NSECTORS / 2; + for (uint32_t leftSector = 0; leftSector < NSECTORS; leftSector++) { + uint32_t rightSector = (leftSector + 1) % nSectorsHalf + (leftSector < nSectorsHalf ? 0 : nSectorsHalf); + int32_t stream = StreamForSector(leftSector, GetProcessingSettings()); + StreamWaitForEvents(stream, &mEvents->sector[rightSector]); + runKernel({GetGridBlk(256, stream)}, leftSector, rightSector); + RecordMarker(&mEvents->extrapolationTrackingDone[leftSector], stream); } - for (uint32_t iSector = 0; iSector < NSECTORS; iSector++) { - uint32_t tmpSector = GPUTPCExtrapolationTracking::ExtrapolationTrackingSectorOrder(iSector); - uint32_t sectorLeft, sectorRight; - GPUTPCExtrapolationTracking::ExtrapolationTrackingSectorLeftRight(tmpSector, sectorLeft, sectorRight); - if (doGPU && !blocking[tmpSector * mRec->NStreams() + StreamForSector(sectorLeft)]) { - StreamWaitForEvents(StreamForSector(tmpSector), &mEvents->sector[sectorLeft]); - blocking[tmpSector * mRec->NStreams() + StreamForSector(sectorLeft)] = true; - } - if (doGPU && !blocking[tmpSector * mRec->NStreams() + StreamForSector(sectorRight)]) { - StreamWaitForEvents(StreamForSector(tmpSector), &mEvents->sector[sectorRight]); - blocking[tmpSector * mRec->NStreams() + StreamForSector(sectorRight)] = true; - } - ExtrapolationTracking(tmpSector, false); + for (uint32_t rightSector = 0; rightSector < NSECTORS; rightSector++) { + uint32_t leftSector = (rightSector + nSectorsHalf - 1) % nSectorsHalf + (rightSector < nSectorsHalf ? 0 : nSectorsHalf); + int32_t stream = StreamForSector(rightSector, GetProcessingSettings()); + TransferMemoryResourceLinkToHost(RecoStep::TPCSectorTracking, processors()->tpcTrackers[rightSector].MemoryResCommon(), stream, nullptr, &mEvents->extrapolationTrackingDone[leftSector]); } } if (doGPU) { ReleaseEvent(mEvents->init); for (uint32_t iSector = 0; iSector < NSECTORS; iSector++) { ReleaseEvent(mEvents->sector[iSector]); + ReleaseEvent(mEvents->extrapolationTrackingDone[iSector]); } } } else { - mRec->runParallelOuterLoop(doGPU, NSECTORS, [&](uint32_t iSector) { + mRec->runParallelOuterLoop(doGPU, NSECTORS, [&](uint32_t leftSector) { if (param().rec.tpc.extrapolationTracking) { - ExtrapolationTracking(iSector, true); + uint32_t nSectorsHalf = NSECTORS / 2; + uint32_t rightSector = (leftSector + 1) % nSectorsHalf + (leftSector < nSectorsHalf ? 0 : nSectorsHalf); + int32_t stream = StreamForSector(leftSector, GetProcessingSettings()); + runKernel({GetGridBlk(256, stream)}, leftSector, rightSector); } }); + if (param().rec.tpc.extrapolationTracking && mRec->IsGPU()) { + mRec->runParallelOuterLoop(doGPU, NSECTORS, [&](uint32_t sector) { + int32_t stream = StreamForSector(sector, GetProcessingSettings()); + TransferMemoryResourceLinkToHost(RecoStep::TPCSectorTracking, processors()->tpcTrackers[sector].MemoryResCommon(), stream); + }); + } mRec->SetNActiveThreadsOuterLoop(1); } diff --git a/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationCandidate.h b/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationCandidate.h new file mode 100644 index 0000000000000..a7d8942e2f11b --- /dev/null +++ b/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationCandidate.h @@ -0,0 +1,40 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file GPUTPCExtrapolationCandidate.h +/// \author Oliver Rietmann + +#ifndef GPUTPCEXTRAPOLATIONCANDIDATE_H +#define GPUTPCEXTRAPOLATIONCANDIDATE_H + +#include "GPUCommonDef.h" + +namespace o2::gpu +{ +class GPUTPCExtrapolationCandidate +{ + public: + GPUhd() static int32_t Pack(int32_t localTrackId, int32_t direction) + { + return (direction == -1) ? (int32_t)((uint32_t)localTrackId | 0x80000000u) : localTrackId; + } + GPUhd() static int32_t GetLocalTrackId(int32_t packed) + { + return (int32_t)((uint32_t)packed & 0x7FFFFFFFu); + } + GPUhd() static int32_t GetDirection(int32_t packed) + { + return ((uint32_t)packed & 0x80000000u) ? -1 : 1; + } +}; +} // namespace o2::gpu + +#endif \ No newline at end of file diff --git a/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.cxx b/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.cxx index 784b60baec3d6..7612039d19f88 100644 --- a/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.cxx +++ b/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.cxx @@ -17,6 +17,7 @@ #include "GPUTPCTrackletConstructor.h" #include "GPUTPCTrackLinearisation.h" #include "GPUTPCTracker.h" +#include "GPUTPCExtrapolationCandidate.h" #include "GPUCommonMath.h" #include "GPUParam.inc" @@ -118,84 +119,33 @@ GPUd() int32_t GPUTPCExtrapolationTracking::PerformExtrapolationTrackingRun(GPUT return (nHits >= tracker.Param().rec.tpc.extrapolationTrackingMinHits); } -GPUd() void GPUTPCExtrapolationTracking::PerformExtrapolationTracking(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, const GPUTPCTracker& tracker, GPUsharedref() GPUSharedMemory& smem, GPUTPCTracker& GPUrestrict() sectorTarget, bool right) -{ - for (int32_t i = iBlock * nThreads + iThread; i < tracker.CommonMemory()->nLocalTracks; i += nThreads * nBlocks) { - { - const int32_t tmpHit = tracker.Tracks()[i].FirstHitID(); - if (tracker.TrackHits()[tmpHit].RowIndex() >= tracker.Param().rec.tpc.extrapolationTrackingMinRows && tracker.TrackHits()[tmpHit].RowIndex() < tracker.Param().rec.tpc.extrapolationTrackingRowRange) { - int32_t rowIndex = tracker.TrackHits()[tmpHit].RowIndex(); - const GPUTPCRow& GPUrestrict() row = tracker.Row(rowIndex); - float Y = (float)tracker.Data().HitDataY(row, tracker.TrackHits()[tmpHit].HitIndex()) * row.HstepY() + row.Grid().YMin(); - if (!right && Y < -row.MaxY() * tracker.Param().rec.tpc.extrapolationTrackingYRangeLower) { - // GPUInfo("Track %d, lower row %d, left border (%f of %f)", i, mTrackHits[tmpHit].RowIndex(), Y, -row.MaxY()); - PerformExtrapolationTrackingRun(sectorTarget, smem, tracker, i, rowIndex, -tracker.Param().dAlpha, -1); - } - if (right && Y > row.MaxY() * tracker.Param().rec.tpc.extrapolationTrackingYRangeLower) { - // GPUInfo("Track %d, lower row %d, right border (%f of %f)", i, mTrackHits[tmpHit].RowIndex(), Y, row.MaxY()); - PerformExtrapolationTrackingRun(sectorTarget, smem, tracker, i, rowIndex, tracker.Param().dAlpha, -1); - } - } - } - - { - const int32_t tmpHit = tracker.Tracks()[i].FirstHitID() + tracker.Tracks()[i].NHits() - 1; - if (tracker.TrackHits()[tmpHit].RowIndex() < GPUTPCGeometry::NROWS - tracker.Param().rec.tpc.extrapolationTrackingMinRows && tracker.TrackHits()[tmpHit].RowIndex() >= GPUTPCGeometry::NROWS - tracker.Param().rec.tpc.extrapolationTrackingRowRange) { - int32_t rowIndex = tracker.TrackHits()[tmpHit].RowIndex(); - const GPUTPCRow& GPUrestrict() row = tracker.Row(rowIndex); - float Y = (float)tracker.Data().HitDataY(row, tracker.TrackHits()[tmpHit].HitIndex()) * row.HstepY() + row.Grid().YMin(); - if (!right && Y < -row.MaxY() * tracker.Param().rec.tpc.extrapolationTrackingYRangeUpper) { - // GPUInfo("Track %d, upper row %d, left border (%f of %f)", i, mTrackHits[tmpHit].RowIndex(), Y, -row.MaxY()); - PerformExtrapolationTrackingRun(sectorTarget, smem, tracker, i, rowIndex, -tracker.Param().dAlpha, 1); - } - if (right && Y > row.MaxY() * tracker.Param().rec.tpc.extrapolationTrackingYRangeUpper) { - // GPUInfo("Track %d, upper row %d, right border (%f of %f)", i, mTrackHits[tmpHit].RowIndex(), Y, row.MaxY()); - PerformExtrapolationTrackingRun(sectorTarget, smem, tracker, i, rowIndex, tracker.Param().dAlpha, 1); - } - } - } - } -} - template <> -GPUdii() void GPUTPCExtrapolationTracking::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() tracker) +GPUdii() void GPUTPCExtrapolationTracking::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() processors, int32_t iSectorLeft, int32_t iSectorRight) { - GPUCA_SHARED_CACHE(&smem.mRows[0], tracker.TrackingDataRows(), GPUTPCGeometry::NROWS * sizeof(GPUTPCRow)); - GPUbarrier(); - - if (tracker.NHitsTotal() == 0) { - return; - } - const uint32_t iSector = tracker.ISector(); - uint32_t sectorLeft = (iSector + (GPUTPCGeometry::NSECTORS / 2 - 1)) % (GPUTPCGeometry::NSECTORS / 2); - uint32_t sectorRight = (iSector + 1) % (GPUTPCGeometry::NSECTORS / 2); - if (iSector >= (int32_t)GPUTPCGeometry::NSECTORS / 2) { - sectorLeft += GPUTPCGeometry::NSECTORS / 2; - sectorRight += GPUTPCGeometry::NSECTORS / 2; - } - PerformExtrapolationTracking(nBlocks, nThreads, iBlock, iThread, tracker.GetConstantMem()->tpcTrackers[sectorLeft], smem, tracker, true); - PerformExtrapolationTracking(nBlocks, nThreads, iBlock, iThread, tracker.GetConstantMem()->tpcTrackers[sectorRight], smem, tracker, false); -} + GPUTPCTracker& GPUrestrict() leftSector = processors.tpcTrackers[iSectorLeft]; + GPUTPCTracker& GPUrestrict() rightSector = processors.tpcTrackers[iSectorRight]; + uint32_t leftToRightCandidates = *leftSector.NExtrapolationCandidatesRight(); + uint32_t leftToRightCandidatesPadded = ((leftToRightCandidates + nThreads - 1) / nThreads) * nThreads; -GPUd() int32_t GPUTPCExtrapolationTracking::ExtrapolationTrackingSectorOrder(int32_t iSector) -{ - iSector++; - if (iSector == GPUTPCGeometry::NSECTORS / 2) { - iSector = 0; - } - if (iSector == GPUTPCGeometry::NSECTORS) { - iSector = GPUTPCGeometry::NSECTORS / 2; - } - return iSector; -} + GPUCA_SHARED_CACHE(&smem.mRows[0], ((iBlock * nThreads) < (int32_t)leftToRightCandidatesPadded ? rightSector : leftSector).TrackingDataRows(), GPUTPCGeometry::NROWS * sizeof(GPUTPCRow)); + GPUbarrier(); -GPUd() void GPUTPCExtrapolationTracking::ExtrapolationTrackingSectorLeftRight(uint32_t iSector, uint32_t& left, uint32_t& right) -{ - left = (iSector + (GPUTPCGeometry::NSECTORS / 2 - 1)) % (GPUTPCGeometry::NSECTORS / 2); - right = (iSector + 1) % (GPUTPCGeometry::NSECTORS / 2); - if (iSector >= (int32_t)GPUTPCGeometry::NSECTORS / 2) { - left += GPUTPCGeometry::NSECTORS / 2; - right += GPUTPCGeometry::NSECTORS / 2; + for (uint32_t i = iBlock * nThreads + iThread; i < leftToRightCandidatesPadded + *rightSector.NExtrapolationCandidatesLeft(); i += nThreads * nBlocks) { + if (i < leftToRightCandidates && rightSector.NHitsTotal() != 0) { + // Extrapolate from left sector to right sector + const int32_t extrapolationCandidate = leftSector.ExtrapolationCandidatesRight()[i]; + const int32_t localTrackId = GPUTPCExtrapolationCandidate::GetLocalTrackId(extrapolationCandidate); + const int32_t direction = GPUTPCExtrapolationCandidate::GetDirection(extrapolationCandidate); + int32_t rowIndex = leftSector.TrackHits()[leftSector.Tracks()[localTrackId].FirstHitID() + (direction == 1 ? leftSector.Tracks()[localTrackId].NHits() - 1 : 0)].RowIndex(); + PerformExtrapolationTrackingRun(rightSector, smem, leftSector, localTrackId, rowIndex, leftSector.Param().dAlpha, direction); + } else if (i >= leftToRightCandidatesPadded && leftSector.NHitsTotal() != 0) { + // Extrapolate from right sector to left sector + const int32_t extrapolationCandidate = rightSector.ExtrapolationCandidatesLeft()[i - leftToRightCandidatesPadded]; + const int32_t localTrackId = GPUTPCExtrapolationCandidate::GetLocalTrackId(extrapolationCandidate); + const int32_t direction = GPUTPCExtrapolationCandidate::GetDirection(extrapolationCandidate); + int32_t rowIndex = rightSector.TrackHits()[rightSector.Tracks()[localTrackId].FirstHitID() + (direction == 1 ? rightSector.Tracks()[localTrackId].NHits() - 1 : 0)].RowIndex(); + PerformExtrapolationTrackingRun(leftSector, smem, rightSector, localTrackId, rowIndex, -rightSector.Param().dAlpha, direction); + } } } diff --git a/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.h b/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.h index d7b012653c75f..10417378b9f16 100644 --- a/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.h +++ b/GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.h @@ -29,21 +29,17 @@ class GPUTPCExtrapolationTracking : public GPUKernelTemplate GPUCA_SHARED_STORAGE(GPUTPCRow mRows[GPUTPCGeometry::NROWS]); }; - typedef GPUconstantref() GPUTPCTracker processorType; + typedef GPUconstantref() GPUConstantMem processorType; GPUhdi() constexpr static gpudatatypes::RecoStep GetRecoStep() { return gpudatatypes::RecoStep::TPCSectorTracking; } GPUhdi() static processorType* Processor(GPUConstantMem& processors) { - return processors.tpcTrackers; + return &processors; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker); - - GPUd() static int32_t ExtrapolationTrackingSectorOrder(int32_t iSector); - GPUd() static void ExtrapolationTrackingSectorLeftRight(uint32_t iSector, uint32_t& left, uint32_t& right); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors, int32_t iSectorLeft, int32_t iSectorRight); private: GPUd() static int32_t PerformExtrapolationTrackingRun(GPUTPCTracker& tracker, GPUsharedref() GPUSharedMemory& smem, const GPUTPCTracker& sectorSource, int32_t iTrack, int32_t rowIndex, float angle, int32_t direction); - GPUd() static void PerformExtrapolationTracking(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, const GPUTPCTracker& tracker, GPUsharedref() GPUSharedMemory& smem, GPUTPCTracker& sectorTarget, bool right); }; class GPUTPCExtrapolationTrackingCopyNumbers : public GPUKernelTemplate diff --git a/GPU/GPUTracking/SectorTracker/GPUTPCSectorDebugSortKernels.cxx b/GPU/GPUTracking/SectorTracker/GPUTPCSectorDebugSortKernels.cxx index afd90184b60ca..f3c09dac43689 100644 --- a/GPU/GPUTracking/SectorTracker/GPUTPCSectorDebugSortKernels.cxx +++ b/GPU/GPUTracking/SectorTracker/GPUTPCSectorDebugSortKernels.cxx @@ -20,6 +20,7 @@ #include "GPUCommonMath.h" #include "GPUCommonAlgorithm.h" #include "GPUTPCSectorDebugSortKernels.h" +#include "GPUTPCExtrapolationCandidate.h" using namespace o2::gpu; @@ -107,4 +108,20 @@ GPUdii() void GPUTPCSectorDebugSortKernels::ThreadnLocalTracks, sorter); GPUCommonAlgorithm::sortDeviceDynamic(tracker.Tracks() + tracker.CommonMemory()->nLocalTracks, tracker.Tracks() + *tracker.NTracks(), sorter); + + for (int32_t r = 0; r < tracker.CommonMemory()->nLocalTracks; r++) { + tracker.DebugSortedIndex()[tracker.Tracks()[r].LocalTrackId()] = r; + } + for (uint32_t i = 0; i < *tracker.NExtrapolationCandidatesRight(); ++i) { + const int32_t extrapolationCandidate = tracker.ExtrapolationCandidatesRight()[i]; + const int32_t r = tracker.DebugSortedIndex()[GPUTPCExtrapolationCandidate::GetLocalTrackId(extrapolationCandidate)]; + const int32_t direction = GPUTPCExtrapolationCandidate::GetDirection(extrapolationCandidate); + tracker.ExtrapolationCandidatesRight()[i] = GPUTPCExtrapolationCandidate::Pack(r, direction); + } + for (uint32_t i = 0; i < *tracker.NExtrapolationCandidatesLeft(); ++i) { + const int32_t extrapolationCandidate = tracker.ExtrapolationCandidatesLeft()[i]; + const int32_t r = tracker.DebugSortedIndex()[GPUTPCExtrapolationCandidate::GetLocalTrackId(extrapolationCandidate)]; + const int32_t direction = GPUTPCExtrapolationCandidate::GetDirection(extrapolationCandidate); + tracker.ExtrapolationCandidatesLeft()[i] = GPUTPCExtrapolationCandidate::Pack(r, direction); + } } diff --git a/GPU/GPUTracking/SectorTracker/GPUTPCTracker.cxx b/GPU/GPUTracking/SectorTracker/GPUTPCTracker.cxx index 5d61a595a83e5..a2bf6a04fa3bb 100644 --- a/GPU/GPUTracking/SectorTracker/GPUTPCTracker.cxx +++ b/GPU/GPUTracking/SectorTracker/GPUTPCTracker.cxx @@ -29,6 +29,7 @@ #include #include +#include "GPUChainTracking.h" #include "GPUReconstruction.h" #include "GPUMemorySizeScalers.h" #endif @@ -90,12 +91,12 @@ void GPUTPCTracker::RegisterMemoryAllocation() { AllocateAndInitializeLate(); bool reuseCondition = MemoryReuseAllowed(); - GPUMemoryReuse reLinks{reuseCondition, GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::TrackerDataLinks, (uint16_t)(mISector % mRec->GetProcessingSettings().nStreams)}; + GPUMemoryReuse reLinks{reuseCondition, GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::TrackerDataLinks, (uint16_t)GPUChainTracking::StreamForSector(mISector, mRec->GetProcessingSettings())}; mMemoryResLinks = mRec->RegisterMemoryAllocation(this, &GPUTPCTracker::SetPointersDataLinks, GPUMemoryResource::MEMORY_SCRATCH | GPUMemoryResource::MEMORY_STACK, "TPCSectorLinks", reLinks); mMemoryResSectorScratch = mRec->RegisterMemoryAllocation(this, &GPUTPCTracker::SetPointersDataScratch, GPUMemoryResource::MEMORY_SCRATCH | GPUMemoryResource::MEMORY_STACK | GPUMemoryResource::MEMORY_CUSTOM, "TPCSectorScratch"); - GPUMemoryReuse reWeights{reuseCondition, GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::TrackerDataWeights, (uint16_t)(mISector % mRec->GetProcessingSettings().nStreams)}; + GPUMemoryReuse reWeights{reuseCondition, GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::TrackerDataWeights, (uint16_t)GPUChainTracking::StreamForSector(mISector, mRec->GetProcessingSettings())}; mRec->RegisterMemoryAllocation(this, &GPUTPCTracker::SetPointersDataWeights, GPUMemoryResource::MEMORY_SCRATCH | GPUMemoryResource::MEMORY_STACK, "TPCSectorWeights", reWeights); - GPUMemoryReuse reScratch{reuseCondition, GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::TrackerScratch, (uint16_t)(mISector % mRec->GetProcessingSettings().nStreams)}; + GPUMemoryReuse reScratch{reuseCondition, GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::TrackerScratch, (uint16_t)GPUChainTracking::StreamForSector(mISector, mRec->GetProcessingSettings())}; mRec->RegisterMemoryAllocation(this, &GPUTPCTracker::SetPointersScratch, GPUMemoryResource::MEMORY_SCRATCH | GPUMemoryResource::MEMORY_STACK, "TPCTrackerScratch", reScratch); mRec->RegisterMemoryAllocation(this, &GPUTPCTracker::SetPointersScratchHost, GPUMemoryResource::MEMORY_SCRATCH_HOST, "TPCTrackerHost"); mMemoryResCommon = mRec->RegisterMemoryAllocation(this, &GPUTPCTracker::SetPointersCommon, GPUMemoryResource::MEMORY_PERMANENT, "TPCTrackerCommon"); @@ -120,6 +121,11 @@ GPUhd() void* GPUTPCTracker::SetPointersOutput(void* mem) { computePointerWithAlignment(mem, mTracks, mNMaxTracks); computePointerWithAlignment(mem, mTrackHits, mNMaxTrackHits); + if (mRec->GetProcessingSettings().deterministicGPUReconstruction) { + computePointerWithAlignment(mem, mDebugSortedIndex, mNMaxTracks); + } + computePointerWithAlignment(mem, mExtrapolationCandidatesLeft, 2 * mNMaxTracks); + computePointerWithAlignment(mem, mExtrapolationCandidatesRight, 2 * mNMaxTracks); return mem; } diff --git a/GPU/GPUTracking/SectorTracker/GPUTPCTracker.h b/GPU/GPUTracking/SectorTracker/GPUTPCTracker.h index aaf1bff882522..e5129193084b7 100644 --- a/GPU/GPUTracking/SectorTracker/GPUTPCTracker.h +++ b/GPU/GPUTracking/SectorTracker/GPUTPCTracker.h @@ -60,13 +60,15 @@ class GPUTPCTracker : public GPUProcessor #endif struct commonMemoryStruct { - GPUAtomic(uint32_t) nStartHits = 0; // number of start hits - GPUAtomic(uint32_t) nTracklets = 0; // number of tracklets - GPUAtomic(uint32_t) nRowHits = 0; // number of tracklet hits - GPUAtomic(uint32_t) nTracks = 0; // number of reconstructed tracks - int32_t nLocalTracks = 0; // number of reconstructed tracks before extrapolation tracking - GPUAtomic(uint32_t) nTrackHits = 0; // number of track hits - int32_t nLocalTrackHits = 0; // see above + GPUAtomic(uint32_t) nStartHits = 0; // number of start hits + GPUAtomic(uint32_t) nTracklets = 0; // number of tracklets + GPUAtomic(uint32_t) nRowHits = 0; // number of tracklet hits + GPUAtomic(uint32_t) nTracks = 0; // number of reconstructed tracks + int32_t nLocalTracks = 0; // number of reconstructed tracks before extrapolation tracking + GPUAtomic(uint32_t) nTrackHits = 0; // number of track hits + int32_t nLocalTrackHits = 0; // see above + GPUAtomic(uint32_t) nExtrapolationCandidatesLeft = 0; // number of extrapolation candidates for left sector + GPUAtomic(uint32_t) nExtrapolationCandidatesRight = 0; // number of extrapolation candidates for right sector }; GPUhdi() const GPUTPCRow& Row(const GPUTPCHitId& HitId) const { return mData.Row(HitId.RowIndex()); } @@ -191,6 +193,12 @@ class GPUTPCTracker : public GPUProcessor GPUhd() GPUglobalref() GPUTPCTrack* Tracks() const { return mTracks; } GPUhd() GPUglobalref() GPUAtomic(uint32_t) * NTrackHits() const { return &mCommonMem->nTrackHits; } GPUhd() GPUglobalref() GPUTPCHitId* TrackHits() const { return mTrackHits; } + GPUhd() GPUglobalref() int32_t* DebugSortedIndex() const { return mDebugSortedIndex; } + + GPUhd() GPUglobalref() GPUAtomic(uint32_t) * NExtrapolationCandidatesLeft() const { return &mCommonMem->nExtrapolationCandidatesLeft; } + GPUhd() GPUglobalref() GPUAtomic(uint32_t) * NExtrapolationCandidatesRight() const { return &mCommonMem->nExtrapolationCandidatesRight; } + GPUhd() GPUglobalref() int32_t* ExtrapolationCandidatesLeft() const { return mExtrapolationCandidatesLeft; } + GPUhd() GPUglobalref() int32_t* ExtrapolationCandidatesRight() const { return mExtrapolationCandidatesRight; } GPUhd() GPUglobalref() GPUTPCRow* TrackingDataRows() const { return (mData.Rows()); } GPUhd() GPUglobalref() int32_t* RowStartHitCountOffset() const { return (mRowStartHitCountOffset); } @@ -236,12 +244,15 @@ class GPUTPCTracker : public GPUProcessor GPUglobalref() char* mGPUTrackletTemp = nullptr; // Temp Memory for GPU Tracklet Constructor // event - GPUglobalref() commonMemoryStruct* mCommonMem = nullptr; // common event memory - GPUglobalref() GPUTPCHitId* mTrackletStartHits = nullptr; // start hits for the tracklets - GPUglobalref() GPUTPCTracklet* mTracklets = nullptr; // tracklets - GPUglobalref() calink* mTrackletRowHits = nullptr; // Hits for each Tracklet in each row - GPUglobalref() GPUTPCTrack* mTracks = nullptr; // reconstructed tracks - GPUglobalref() GPUTPCHitId* mTrackHits = nullptr; // array of track hit numbers + GPUglobalref() commonMemoryStruct* mCommonMem = nullptr; // common event memory + GPUglobalref() GPUTPCHitId* mTrackletStartHits = nullptr; // start hits for the tracklets + GPUglobalref() GPUTPCTracklet* mTracklets = nullptr; // tracklets + GPUglobalref() calink* mTrackletRowHits = nullptr; // Hits for each Tracklet in each row + GPUglobalref() GPUTPCTrack* mTracks = nullptr; // reconstructed tracks + GPUglobalref() GPUTPCHitId* mTrackHits = nullptr; // array of track hit numbers + GPUglobalref() int32_t* mDebugSortedIndex = nullptr; // array of the original indices before debugSort + GPUglobalref() int32_t* mExtrapolationCandidatesLeft = nullptr; // array of extrapolation candidates for left sector + GPUglobalref() int32_t* mExtrapolationCandidatesRight = nullptr; // array of extrapolation candidates for right sector static int32_t StarthitSortComparison(const void* a, const void* b); }; diff --git a/GPU/GPUTracking/SectorTracker/GPUTPCTrackletSelector.cxx b/GPU/GPUTracking/SectorTracker/GPUTPCTrackletSelector.cxx index ae78c36682d84..963f930a48977 100644 --- a/GPU/GPUTracking/SectorTracker/GPUTPCTrackletSelector.cxx +++ b/GPU/GPUTracking/SectorTracker/GPUTPCTrackletSelector.cxx @@ -17,12 +17,59 @@ #include "GPUTPCTracker.h" #include "GPUTPCTrackParam.h" #include "GPUTPCTracklet.h" +#include "GPUTPCExtrapolationCandidate.h" #include "GPUCommonMath.h" using namespace o2::gpu; static_assert(GPUTPCGeometry::NROWS >= GPUCA_PAR_TRACKLET_SELECTOR_HITS_REG_SIZE); +namespace +{ + +GPUdi() void MemorizeExtrapolationCandidate(GPUTPCTracker& GPUrestrict() tracker, int32_t localTrackId) +{ + { + const int32_t tmpHit = tracker.Tracks()[localTrackId].FirstHitID(); + if (tracker.TrackHits()[tmpHit].RowIndex() >= tracker.Param().rec.tpc.extrapolationTrackingMinRows && tracker.TrackHits()[tmpHit].RowIndex() < tracker.Param().rec.tpc.extrapolationTrackingRowRange) { + int32_t rowIndex = tracker.TrackHits()[tmpHit].RowIndex(); + const GPUTPCRow& GPUrestrict() row = tracker.Row(rowIndex); + float Y = (float)tracker.Data().HitDataY(row, tracker.TrackHits()[tmpHit].HitIndex()) * row.HstepY() + row.Grid().YMin(); + if (Y < -row.MaxY() * tracker.Param().rec.tpc.extrapolationTrackingYRangeLower) { + // GPUInfo("Sector %d, Track %d, lower row %d, left border (%f of %f)", tracker.ISector(), localTrackId, rowIndex, Y, -row.MaxY()); + const uint32_t pos = CAMath::AtomicAdd(tracker.NExtrapolationCandidatesLeft(), 1u); + tracker.ExtrapolationCandidatesLeft()[pos] = GPUTPCExtrapolationCandidate::Pack(localTrackId, -1); + } + if (Y > row.MaxY() * tracker.Param().rec.tpc.extrapolationTrackingYRangeLower) { + // GPUInfo("Sector %d, Track %d, lower row %d, right border (%f of %f)", tracker.ISector(), localTrackId, rowIndex, Y, row.MaxY()); + const uint32_t pos = CAMath::AtomicAdd(tracker.NExtrapolationCandidatesRight(), 1u); + tracker.ExtrapolationCandidatesRight()[pos] = GPUTPCExtrapolationCandidate::Pack(localTrackId, -1); + } + } + } + + { + const int32_t tmpHit = tracker.Tracks()[localTrackId].FirstHitID() + tracker.Tracks()[localTrackId].NHits() - 1; + if (tracker.TrackHits()[tmpHit].RowIndex() < GPUTPCGeometry::NROWS - tracker.Param().rec.tpc.extrapolationTrackingMinRows && tracker.TrackHits()[tmpHit].RowIndex() >= GPUTPCGeometry::NROWS - tracker.Param().rec.tpc.extrapolationTrackingRowRange) { + int32_t rowIndex = tracker.TrackHits()[tmpHit].RowIndex(); + const GPUTPCRow& GPUrestrict() row = tracker.Row(rowIndex); + float Y = (float)tracker.Data().HitDataY(row, tracker.TrackHits()[tmpHit].HitIndex()) * row.HstepY() + row.Grid().YMin(); + if (Y < -row.MaxY() * tracker.Param().rec.tpc.extrapolationTrackingYRangeUpper) { + // GPUInfo("Sector %d, Track %d, upper row %d, left border (%f of %f)", tracker.ISector(), localTrackId, rowIndex, Y, -row.MaxY()); + const uint32_t pos = CAMath::AtomicAdd(tracker.NExtrapolationCandidatesLeft(), 1u); + tracker.ExtrapolationCandidatesLeft()[pos] = GPUTPCExtrapolationCandidate::Pack(localTrackId, 1); + } + if (Y > row.MaxY() * tracker.Param().rec.tpc.extrapolationTrackingYRangeUpper) { + // GPUInfo("Sector %d, Track %d, upper row %d, right border (%f of %f)", tracker.ISector(), localTrackId, rowIndex, Y, row.MaxY()); + const uint32_t pos = CAMath::AtomicAdd(tracker.NExtrapolationCandidatesRight(), 1u); + tracker.ExtrapolationCandidatesRight()[pos] = GPUTPCExtrapolationCandidate::Pack(localTrackId, 1); + } + } + } +} + +} // namespace + template <> GPUdii() void GPUTPCTrackletSelector::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& s, processorType& GPUrestrict() tracker) { @@ -120,6 +167,7 @@ GPUdii() void GPUTPCTrackletSelector::Thread<0>(int32_t nBlocks, int32_t nThread tracker.TrackHits()[nFirstTrackHit + nHits - 1 - jh] = trackHits[jh - GPUCA_PAR_TRACKLET_SELECTOR_HITS_REG_SIZE]; } } + ::MemorizeExtrapolationCandidate(tracker, itrout); } nHits = 0; gap = 0; diff --git a/GPU/GPUTracking/kernels.cmake b/GPU/GPUTracking/kernels.cmake index 0e95c09a3ef78..fdc1fd3956578 100644 --- a/GPU/GPUTracking/kernels.cmake +++ b/GPU/GPUTracking/kernels.cmake @@ -39,7 +39,7 @@ o2_gpu_add_kernel("GPUTPCTrackletSelector" "= TPC o2_gpu_add_kernel("GPUMemClean16" "GPUGeneralKernels" NO void* ptr uint64_t size) o2_gpu_add_kernel("GPUitoa" "GPUGeneralKernels" NO int32_t* ptr uint64_t size) o2_gpu_add_kernel("GPUTPCExtrapolationTrackingCopyNumbers" "GPUTPCExtrapolationTracking TPCTRACKER" NO int32_t n) -o2_gpu_add_kernel("GPUTPCExtrapolationTracking" "= TPCTRACKER TPCTRACKLETCONS" LB) +o2_gpu_add_kernel("GPUTPCExtrapolationTracking" "= TPCTRACKER TPCTRACKLETCONS" LB int32_t iSectorLeft int32_t iSectorRight) o2_gpu_add_kernel("GPUTPCCreateTrackingData" "= TPCTRACKER TPCSECTORDATA" LB) o2_gpu_add_kernel("GPUTPCSectorDebugSortKernels, hitData" "= TPCTRACKER") o2_gpu_add_kernel("GPUTPCSectorDebugSortKernels, startHits" "= TPCTRACKER")