Skip to content

Commit d2bee7d

Browse files
committed
GPU TPC: Free sector tracking memory earlier
1 parent ce00c8b commit d2bee7d

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

GPU/GPUTracking/Global/GPUChainTrackingSectorTracker.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ int32_t GPUChainTracking::RunTPCTrackingSectors_internal()
224224
GPUInfo("Sector %u, Number of tracks: %d", iSector, *trk.NTracks());
225225
}
226226
DoDebugAndDump(RecoStep::TPCSectorTracking, GPUChainTrackingDebugFlags::TPCSectorTracks, trk, &GPUTPCTracker::DumpTrackHits, *mDebugFile);
227+
if (GetProcessingSettings().memoryAllocationStrategy == GPUMemoryResource::ALLOCATION_INDIVIDUAL && !trk.MemoryReuseAllowed()) {
228+
mRec->PopNonPersistentMemory(RecoStep::TPCSectorTracking, qStr2Tag("TPCSLTRK"), &trk);
229+
}
227230
});
228231
mRec->SetNActiveThreadsOuterLoop(1);
229232
if (error) {

GPU/GPUTracking/SectorTracker/GPUTPCTracker.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,15 @@ void* GPUTPCTracker::SetPointersCommon(void* mem)
8484
return mem;
8585
}
8686

87+
bool GPUTPCTracker::MemoryReuseAllowed()
88+
{
89+
return !mRec->GetProcessingSettings().keepDisplayMemory && ((mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCSectorTracking) || mRec->GetProcessingSettings().inKernelParallel == 1 || mRec->GetProcessingSettings().nHostThreads == 1);
90+
}
91+
8792
void GPUTPCTracker::RegisterMemoryAllocation()
8893
{
8994
AllocateAndInitializeLate();
90-
bool reuseCondition = !mRec->GetProcessingSettings().keepDisplayMemory && ((mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCSectorTracking) || mRec->GetProcessingSettings().inKernelParallel == 1 || mRec->GetProcessingSettings().nHostThreads == 1);
95+
bool reuseCondition = MemoryReuseAllowed();
9196
GPUMemoryReuse reLinks{reuseCondition, GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::TrackerDataLinks, (uint16_t)(mISector % mRec->GetProcessingSettings().nStreams)};
9297
mMemoryResLinks = mRec->RegisterMemoryAllocation(this, &GPUTPCTracker::SetPointersDataLinks, GPUMemoryResource::MEMORY_SCRATCH | GPUMemoryResource::MEMORY_STACK, "TPCSectorLinks", reLinks);
9398
mMemoryResSectorScratch = mRec->RegisterMemoryAllocation(this, &GPUTPCTracker::SetPointersDataScratch, GPUMemoryResource::MEMORY_SCRATCH | GPUMemoryResource::MEMORY_STACK | GPUMemoryResource::MEMORY_CUSTOM, "TPCSectorScratch");

GPU/GPUTracking/SectorTracker/GPUTPCTracker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class GPUTPCTracker : public GPUProcessor
103103
void* SetPointersTracklets(void* mem);
104104
void* SetPointersOutput(void* mem);
105105
void RegisterMemoryAllocation();
106+
bool MemoryReuseAllowed();
106107

107108
int16_t MemoryResLinks() const { return mMemoryResLinks; }
108109
int16_t MemoryResScratchHost() const { return mMemoryResScratchHost; }

0 commit comments

Comments
 (0)