Skip to content

Commit 356b066

Browse files
committed
GPU: Some cleanup, and fixes when running only part of processing on GPU
1 parent 6334950 commit 356b066

File tree

5 files changed

+45
-46
lines changed

5 files changed

+45
-46
lines changed

GPU/GPUTracking/Global/GPUChainTracking.cxx

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -921,33 +921,6 @@ int32_t GPUChainTracking::FinalizePipelinedProcessing()
921921
return RunChainFinalize();
922922
}
923923

924-
int32_t GPUChainTracking::HelperReadEvent(int32_t iSlice, int32_t threadId, GPUReconstructionHelpers::helperParam* par) { return ReadEvent(iSlice, threadId); }
925-
926-
int32_t GPUChainTracking::HelperOutput(int32_t iSlice, int32_t threadId, GPUReconstructionHelpers::helperParam* par)
927-
{
928-
if (param().rec.tpc.globalTracking) {
929-
uint32_t tmpSlice = GPUTPCGlobalTracking::GlobalTrackingSliceOrder(iSlice);
930-
uint32_t sliceLeft, sliceRight;
931-
GPUTPCGlobalTracking::GlobalTrackingSliceLeftRight(tmpSlice, sliceLeft, sliceRight);
932-
933-
while (mSliceSelectorReady < (int32_t)tmpSlice || mSliceSelectorReady < (int32_t)sliceLeft || mSliceSelectorReady < (int32_t)sliceRight) {
934-
if (par->reset) {
935-
return 1;
936-
}
937-
}
938-
GlobalTracking(tmpSlice, 0);
939-
WriteOutput(tmpSlice, 0);
940-
} else {
941-
while (mSliceSelectorReady < iSlice) {
942-
if (par->reset) {
943-
return 1;
944-
}
945-
}
946-
WriteOutput(iSlice, threadId);
947-
}
948-
return 0;
949-
}
950-
951924
int32_t GPUChainTracking::CheckErrorCodes(bool cpuOnly, bool forceShowErrors, std::vector<std::array<uint32_t, 4>>* fillErrors)
952925
{
953926
int32_t retVal = 0;

GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ std::pair<uint32_t, uint32_t> GPUChainTracking::RunTPCClusterizer_transferZS(int
457457

458458
int32_t GPUChainTracking::RunTPCClusterizer_prepare(bool restorePointers)
459459
{
460+
bool doGPU = mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding;
460461
if (restorePointers) {
461462
for (uint32_t iSlice = 0; iSlice < NSLICES; iSlice++) {
462463
processors()->tpcClusterer[iSlice].mPzsOffsets = mCFContext->ptrSave[iSlice].zsOffsetHost;
@@ -512,7 +513,7 @@ int32_t GPUChainTracking::RunTPCClusterizer_prepare(bool restorePointers)
512513
uint32_t threshold = 40000000;
513514
uint32_t nDigitsScaled = nDigitsBase > threshold ? nDigitsBase : std::min((threshold + nDigitsBase) / 2, 2 * nDigitsBase);
514515
processors()->tpcClusterer[iSlice].SetNMaxDigits(processors()->tpcClusterer[iSlice].mPmemory->counters.nDigits, mCFContext->nPagesFragmentMax, nDigitsScaled, mCFContext->nDigitsEndpointMax[iSlice]);
515-
if (mRec->IsGPU()) {
516+
if (doGPU) {
516517
processorsShadow()->tpcClusterer[iSlice].SetNMaxDigits(processors()->tpcClusterer[iSlice].mPmemory->counters.nDigits, mCFContext->nPagesFragmentMax, nDigitsScaled, mCFContext->nDigitsEndpointMax[iSlice]);
517518
}
518519
if (mPipelineNotifyCtx && GetProcessingSettings().doublePipelineClusterizer) {
@@ -578,7 +579,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
578579
if (RunTPCClusterizer_prepare(mPipelineNotifyCtx && GetProcessingSettings().doublePipelineClusterizer)) {
579580
return 1;
580581
}
581-
if (GetProcessingSettings().ompAutoNThreads && !mRec->IsGPU()) {
582+
if (GetProcessingSettings().ompAutoNThreads && !doGPU) {
582583
mRec->SetNOMPThreads(mRec->MemoryScalers()->nTPCdigits / 20000);
583584
}
584585

GPU/GPUTracking/Global/GPUChainTrackingSliceTracker.cxx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,3 +532,30 @@ void GPUChainTracking::WriteOutput(int32_t iSlice, int32_t threadId)
532532
GPUInfo("Finished WriteOutput for slice %d on thread %d\n", iSlice, threadId);
533533
}
534534
}
535+
536+
int32_t GPUChainTracking::HelperReadEvent(int32_t iSlice, int32_t threadId, GPUReconstructionHelpers::helperParam* par) { return ReadEvent(iSlice, threadId); }
537+
538+
int32_t GPUChainTracking::HelperOutput(int32_t iSlice, int32_t threadId, GPUReconstructionHelpers::helperParam* par)
539+
{
540+
if (param().rec.tpc.globalTracking) {
541+
uint32_t tmpSlice = GPUTPCGlobalTracking::GlobalTrackingSliceOrder(iSlice);
542+
uint32_t sliceLeft, sliceRight;
543+
GPUTPCGlobalTracking::GlobalTrackingSliceLeftRight(tmpSlice, sliceLeft, sliceRight);
544+
545+
while (mSliceSelectorReady < (int32_t)tmpSlice || mSliceSelectorReady < (int32_t)sliceLeft || mSliceSelectorReady < (int32_t)sliceRight) {
546+
if (par->reset) {
547+
return 1;
548+
}
549+
}
550+
GlobalTracking(tmpSlice, 0);
551+
WriteOutput(tmpSlice, 0);
552+
} else {
553+
while (mSliceSelectorReady < iSlice) {
554+
if (par->reset) {
555+
return 1;
556+
}
557+
}
558+
WriteOutput(iSlice, threadId);
559+
}
560+
return 0;
561+
}

GPU/GPUTracking/SliceTracker/GPUTPCSliceData.cxx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -265,22 +265,20 @@ GPUdii() int32_t GPUTPCSliceData::InitFromClusterData(int32_t nBlocks, int32_t n
265265
for (uint32_t i = iThread; i < NumberOfClusters; i += nThreads) {
266266
UpdateMinMaxYZ(yMin, yMax, zMin, zMax, YZData[RowOffset + i].x, YZData[RowOffset + i].y);
267267
}
268+
} else if (mem->param.par.earlyTpcTransform) { // Early transform case with ClusterNative present
269+
for (uint32_t i = iThread; i < NumberOfClusters; i += nThreads) {
270+
float2 tmp;
271+
tmp.x = mClusterData[RowOffset + i].y;
272+
tmp.y = mClusterData[RowOffset + i].z;
273+
UpdateMinMaxYZ(yMin, yMax, zMin, zMax, tmp.x, tmp.y);
274+
YZData[RowOffset + i] = tmp;
275+
}
268276
} else {
269-
if (mem->param.par.earlyTpcTransform) { // Early transform case with ClusterNative present
270-
for (uint32_t i = iThread; i < NumberOfClusters; i += nThreads) {
271-
float2 tmp;
272-
tmp.x = mClusterData[RowOffset + i].y;
273-
tmp.y = mClusterData[RowOffset + i].z;
274-
UpdateMinMaxYZ(yMin, yMax, zMin, zMax, tmp.x, tmp.y);
275-
YZData[RowOffset + i] = tmp;
276-
}
277-
} else {
278-
for (uint32_t i = iThread; i < NumberOfClusters; i += nThreads) {
279-
float x, y, z;
280-
GPUTPCConvertImpl::convert(*mem, iSlice, rowIndex, mem->ioPtrs.clustersNative->clusters[iSlice][rowIndex][i].getPad(), mem->ioPtrs.clustersNative->clusters[iSlice][rowIndex][i].getTime(), x, y, z);
281-
UpdateMinMaxYZ(yMin, yMax, zMin, zMax, y, z);
282-
YZData[RowOffset + i] = CAMath::MakeFloat2(y, z);
283-
}
277+
for (uint32_t i = iThread; i < NumberOfClusters; i += nThreads) {
278+
float x, y, z;
279+
GPUTPCConvertImpl::convert(*mem, iSlice, rowIndex, mem->ioPtrs.clustersNative->clusters[iSlice][rowIndex][i].getPad(), mem->ioPtrs.clustersNative->clusters[iSlice][rowIndex][i].getTime(), x, y, z);
280+
UpdateMinMaxYZ(yMin, yMax, zMin, zMax, y, z);
281+
YZData[RowOffset + i] = CAMath::MakeFloat2(y, z);
284282
}
285283
}
286284

GPU/GPUTracking/SliceTracker/GPUTPCTracker.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void* GPUTPCTracker::SetPointersScratch(void* mem)
8181
if (mRec->GetProcessingSettings().memoryAllocationStrategy != GPUMemoryResource::ALLOCATION_INDIVIDUAL) {
8282
mem = SetPointersTracklets(mem);
8383
}
84-
if (mRec->IsGPU()) {
84+
if (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCSliceTracking) {
8585
computePointerWithAlignment(mem, mTrackletTmpStartHits, GPUCA_ROW_COUNT * mNMaxRowStartHits);
8686
computePointerWithAlignment(mem, mRowStartHitCountOffset, GPUCA_ROW_COUNT);
8787
}
@@ -164,7 +164,7 @@ void GPUTPCTracker::SetMaxData(const GPUTrackingInOutPointers& io)
164164
mNMaxTracks = mRec->MemoryScalers()->NTPCSectorTracks(mData.NumberOfHits());
165165
mNMaxTrackHits = mRec->MemoryScalers()->NTPCSectorTrackHits(mData.NumberOfHits(), mRec->GetProcessingSettings().tpcInputWithClusterRejection);
166166
#ifdef GPUCA_SORT_STARTHITS_GPU
167-
if (mRec->IsGPU()) {
167+
if (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCSliceTracking) {
168168
if (mNMaxStartHits > mNMaxRowStartHits * GPUCA_ROW_COUNT) {
169169
mNMaxStartHits = mNMaxRowStartHits * GPUCA_ROW_COUNT;
170170
}

0 commit comments

Comments
 (0)