diff --git a/GPU/GPUTracking/Base/GPUMemoryResource.h b/GPU/GPUTracking/Base/GPUMemoryResource.h index 79960af9bc188..9f1e824488c4d 100644 --- a/GPU/GPUTracking/Base/GPUMemoryResource.h +++ b/GPU/GPUTracking/Base/GPUMemoryResource.h @@ -31,6 +31,7 @@ struct GPUMemoryReuse { }; enum Group : uint16_t { ClustererScratch, + ClustererScratchClusters, NNClusterer, ClustererZS, TrackerScratch, diff --git a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx index 1aa9690453b87..8ce90c740804a 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx @@ -1367,6 +1367,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput) if (doGPU && propagateMCLabels) { TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mScratchId, lane); + TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mScratchClustersId, lane); SynchronizeStream(lane); runKernel({GetGrid(clusterer.mPmemory->counters.nClusters, lane, GPUReconstruction::krnlDeviceType::CPU), {iSector}}, 1); // Computes MC labels } @@ -1382,7 +1383,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput) SynchronizeStream(lane); } if (doGPU && propagateMCLabels) { - TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mScratchId, lane); + TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mScratchClustersId, lane); SynchronizeStream(lane); runKernel({GetGrid(GPUTPCGeometry::NROWS, lane, GPUReconstruction::krnlDeviceType::CPU), {iSector}}, 1); // Computes MC labels } diff --git a/GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.cxx b/GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.cxx index c0c869d0dcc9b..80415dc043bf8 100644 --- a/GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.cxx +++ b/GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.cxx @@ -96,10 +96,14 @@ void* GPUTPCClusterFinder::SetPointersScratch(void* mem) computePointerWithAlignment(mem, mPisPeak, mNMaxDigitsFragment); computePointerWithAlignment(mem, mPchargeMap, TPCMapMemoryLayout::items(mRec->GetProcessingSettings().overrideClusterizerFragmentLen)); computePointerWithAlignment(mem, mPpeakMap, TPCMapMemoryLayout::items(mRec->GetProcessingSettings().overrideClusterizerFragmentLen)); - computePointerWithAlignment(mem, mPclusterByRow, GPUTPCGeometry::NROWS * mNMaxClusterPerRow); if ((mRec->GetRecoStepsGPU() & gpudatatypes::RecoStep::TPCClusterFinding)) { computePointerWithAlignment(mem, mPscanBuf, mBufSize * mNBufs); } + return mem; +} +void* GPUTPCClusterFinder::SetPointersScratchClusters(void* mem) +{ + computePointerWithAlignment(mem, mPclusterByRow, GPUTPCGeometry::NROWS * mNMaxClusterPerRow); // TODO: Use memory scalers for MaxHIPTails. // NOTE: Always allocate since Param() is not available during size computation. computePointerWithAlignment(mem, mPhipTailsByRow, GPUTPCGeometry::NROWS * GPUTPCCFHIPClusterizer::MaxHIPTailsPerRow); @@ -117,6 +121,7 @@ void GPUTPCClusterFinder::RegisterMemoryAllocation() scratchType |= GPUMemoryResource::MEMORY_HOST | GPUMemoryResource::MEMORY_GPU; } mScratchId = mRec->RegisterMemoryAllocation(this, &GPUTPCClusterFinder::SetPointersScratch, scratchType, "TPCClustererScratch", GPUMemoryReuse{GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::ClustererScratch, (uint16_t)(mISector % mRec->GetProcessingSettings().nTPCClustererLanes)}); + mScratchClustersId = mRec->RegisterMemoryAllocation(this, &GPUTPCClusterFinder::SetPointersScratchClusters, scratchType, "TPCClustererScratchClusters", GPUMemoryReuse{GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::ClustererScratchClusters, (uint16_t)(mISector % mRec->GetProcessingSettings().nTPCClustererLanes)}); mMemoryId = mRec->RegisterMemoryAllocation(this, &GPUTPCClusterFinder::SetPointersMemory, GPUMemoryResource::MEMORY_PERMANENT, "TPCClustererMemory"); mRec->RegisterMemoryAllocation(this, &GPUTPCClusterFinder::SetPointersOutput, GPUMemoryResource::MEMORY_OUTPUT | GPUMemoryResource::MEMORY_STACK, "TPCClustererOutput"); diff --git a/GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.h b/GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.h index 513bb750abf9b..6922678d83a7d 100644 --- a/GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.h +++ b/GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.h @@ -85,6 +85,7 @@ class GPUTPCClusterFinder : public GPUProcessor void* SetPointersInput(void* mem); void* SetPointersOutput(void* mem); void* SetPointersScratch(void* mem); + void* SetPointersScratchClusters(void* mem); void* SetPointersMemory(void* mem); void* SetPointersZS(void* mem); void* SetPointersZSOffset(void* mem); @@ -140,6 +141,7 @@ class GPUTPCClusterFinder : public GPUProcessor int16_t mMemoryId = -1; int16_t mScratchId = -1; + int16_t mScratchClustersId = -1; int16_t mZSId = -1; int16_t mZSOffsetId = -1; int16_t mOutputId = -1;