Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions GPU/GPUTracking/Base/GPUConstantMem.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ GPUdi() GPUconstantref() const GPUConstantMem* GPUProcessor::GetConstantMem() co
#endif
}

GPUdi() GPUconstantref() GPUConstantMem* GPUProcessor::GetConstantMem()
{
#if defined(GPUCA_GPUCODE_DEVICE) && defined(GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM)
return &GPUCA_CONSMEM;
#else
return mConstantMem;
#endif
}

GPUdi() GPUconstantref() const GPUParam& GPUProcessor::Param() const
{
return GetConstantMem()->param;
Expand Down
3 changes: 2 additions & 1 deletion GPU/GPUTracking/Base/GPUProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class GPUProcessor
#endif

GPUd() GPUconstantref() const GPUConstantMem* GetConstantMem() const; // Body in GPUConstantMem.h to avoid circular headers
GPUd() GPUconstantref() GPUConstantMem* GetConstantMem(); // ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need a non-const version? In principle, this should be constant memory during kernels?

GPUd() GPUconstantref() const GPUParam& Param() const; // ...
GPUd() void raiseError(uint32_t code, uint32_t param1 = 0, uint32_t param2 = 0, uint32_t param3 = 0) const;
GPUd() bool IsDeviceProcessor() const { return mGPUProcessorType == PROCESSOR_TYPE_DEVICE; }
Expand Down Expand Up @@ -161,7 +162,7 @@ class GPUProcessor
GPUReconstruction* mRec;
ProcessorType mGPUProcessorType;
GPUProcessor* mLinkedProcessor;
GPUconstantref() const GPUConstantMem* mConstantMem;
GPUconstantref() GPUConstantMem* mConstantMem;

private:
bool mAllocateAndInitializeLate;
Expand Down
10 changes: 10 additions & 0 deletions GPU/GPUTracking/Base/GPUReconstruction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,16 @@ int32_t GPUReconstruction::Exit()
void GPUReconstruction::RegisterGPUDeviceProcessor(GPUProcessor* proc, GPUProcessor* slaveProcessor) { proc->InitGPUProcessor(this, GPUProcessor::PROCESSOR_TYPE_DEVICE, slaveProcessor); }
void GPUReconstruction::ConstructGPUProcessor(GPUProcessor* proc) { proc->mConstantMem = proc->mGPUProcessorType == GPUProcessor::PROCESSOR_TYPE_DEVICE ? mDeviceConstantMem : mHostConstantMem.get(); }

uint32_t GPUReconstruction::StreamForSector(uint32_t sector) const

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move everything that is not pure-GPU related to GPUChainTracking. GPUReconstruction should be generic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reusable memory in GPUTPCTracker::RegisterMemoryAllocation() relied on the specific way of assigning the sectors to the streams that we had before (round robin). I moved the function to have a "single source of truth" for both GPUTPCTracker and GPUTPCChainTrackingSectorTracker. I can move it back to GPUChainTracking and include the latter in GPUTPCTracker.

{
if (mNStreams % 2 == 0 && mNStreams > 1) {
uint32_t nStreamsHalf = mNStreams / 2;
return sector % nStreamsHalf + (2 * sector < NSECTORS ? 0 : nStreamsHalf);
} else {
return sector % mNStreams;
}
}

void GPUReconstruction::ComputeReuseMax(GPUProcessor* proc)
{
for (auto it = mMemoryReuse1to1.begin(); it != mMemoryReuse1to1.end(); it++) {
Expand Down
1 change: 1 addition & 0 deletions GPU/GPUTracking/Base/GPUReconstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class GPUReconstruction
void SetInputControl(void* ptr, size_t size);
GPUOutputControl& OutputControl() { return mOutputControl; }
uint32_t NStreams() const { return mNStreams; }
uint32_t StreamForSector(uint32_t sector) const;
const void* DeviceMemoryBase() const { return mDeviceMemoryBase; }
virtual const GPUDefParameters& getGPUParameters(bool doGPU) const = 0;

Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/Definitions/GPUSettingsList.template
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ AddOption(nHostThreads, int32_t, -1, "nThreads", 't', "Number of host threads to
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(nStreams, int8_t, 6, "", 0, "Number of GPU streams / command queues")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be wrong, but I belive the TPC clusterization can parallelize over 7 streams at the moment. I thought you wanted to add a nStreamsTPCSectorTracking option, to use only a subset of streams in the sector tracking?

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")
Expand Down
20 changes: 10 additions & 10 deletions GPU/GPUTracking/Definitions/Parameters/GPUParameters.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]",
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions GPU/GPUTracking/Global/GPUChainTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ 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 ExtrapolationTracking(uint32_t sectorLeft, uint32_t sectorRight, uint32_t stream);

int32_t PrepareProfile();
int32_t DoProfile();
Expand Down Expand Up @@ -295,8 +295,6 @@ class GPUChainTracking : public GPUChain

// Synchronization and Locks
eventStruct* mEvents = nullptr;
std::array<int8_t, NSECTORS> mExtrapolationTrackingDone;

std::vector<outputQueueEntry> mOutputQueue;

private:
Expand All @@ -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 I>
int32_t RunTRDTrackingInternal();
uint32_t StreamForSector(uint32_t sector) const;

// Debug
void DoDebugMergerNClDump(const GPUTPCGMMerger& merger);
Expand Down
56 changes: 22 additions & 34 deletions GPU/GPUTracking/Global/GPUChainTrackingSectorTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,11 @@

using namespace o2::gpu;

uint32_t GPUChainTracking::StreamForSector(uint32_t sector) const
int32_t GPUChainTracking::ExtrapolationTracking(uint32_t sectorLeft, uint32_t sectorRight, uint32_t stream)
{
return sector % mRec->NStreams();
}

int32_t GPUChainTracking::ExtrapolationTracking(uint32_t iSector, bool blocking)
{
const uint32_t stream = StreamForSector(iSector);
runKernel<GPUTPCExtrapolationTracking>({GetGridBlk(256, stream), {iSector}});
TransferMemoryResourceLinkToHost(RecoStep::TPCSectorTracking, processors()->tpcTrackers[iSector].MemoryResCommon(), stream);
if (blocking) {
SynchronizeStream(stream);
}
runKernel<GPUTPCExtrapolationTracking>({GetGridBlk(256, stream), {sectorLeft}}, sectorRight);
TransferMemoryResourceLinkToHost(RecoStep::TPCSectorTracking, processors()->tpcTrackers[sectorLeft].MemoryResCommon(), stream);
TransferMemoryResourceLinkToHost(RecoStep::TPCSectorTracking, processors()->tpcTrackers[sectorRight].MemoryResCommon(), stream);
return (0);
}

Expand Down Expand Up @@ -145,7 +137,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 = mRec->StreamForSector(iSector);

if (GetProcessingSettings().debugLevel >= 3) {
GPUInfo("Creating Sector Data (Sector %d)", iSector);
Expand Down Expand Up @@ -230,25 +222,16 @@ int32_t GPUChainTracking::RunTPCTrackingSectors_internal()

if (doGPU || GetProcessingSettings().debugLevel >= 1) {
if (param().rec.tpc.extrapolationTracking) {
std::vector<bool> 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;
}
}
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);
uint32_t nSectorsHalf = NSECTORS / 2;
for (uint32_t leftSector = 0; leftSector < nSectorsHalf; leftSector++) {
uint32_t rightSector = (leftSector + 1) % nSectorsHalf;
uint32_t stream = mRec->StreamForSector(leftSector);
StreamWaitForEvents(stream, &mEvents->sector[rightSector]);
ExtrapolationTracking(leftSector, rightSector, stream);

stream = mRec->StreamForSector(leftSector + nSectorsHalf);
StreamWaitForEvents(stream, &mEvents->sector[rightSector + nSectorsHalf]);
ExtrapolationTracking(leftSector + nSectorsHalf, rightSector + nSectorsHalf, stream);
}
}
if (doGPU) {
Expand All @@ -258,9 +241,14 @@ int32_t GPUChainTracking::RunTPCTrackingSectors_internal()
}
}
} 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;
if (leftSector >= nSectorsHalf) {
rightSector += nSectorsHalf;
}
ExtrapolationTracking(leftSector, rightSector, mRec->StreamForSector(leftSector));
}
});
mRec->SetNActiveThreadsOuterLoop(1);
Expand Down
94 changes: 20 additions & 74 deletions GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -118,84 +118,30 @@ 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() leftSector, int32_t iRightSector)
{
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() rightSector = leftSector.GetConstantMem()->tpcTrackers[iRightSector];
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 localTrackId = leftSector.ExtrapolationCandidatesRight()[i];
const int32_t direction = leftSector.ExtrapolationCandidatesRightDirection()[i];
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 localTrackId = rightSector.ExtrapolationCandidatesLeft()[i - leftToRightCandidatesPadded];
const int32_t direction = rightSector.ExtrapolationCandidatesLeftDirection()[i - leftToRightCandidatesPadded];
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);
}
}
}

Expand Down
Loading