Repository navigation
GPU TPC: Run extrapolation tracking only on selected tracks - #16210
OliverRietmann wants to merge 4 commits into
Conversation
davidrohr
left a comment
There was a problem hiding this comment.
Some general comments, didn't check the kernel in detail, I assume with deterministic reconstruction, it reproduces the previous output exactly?
| #endif | ||
|
|
||
| GPUd() GPUconstantref() const GPUConstantMem* GetConstantMem() const; // Body in GPUConstantMem.h to avoid circular headers | ||
| GPUd() GPUconstantref() GPUConstantMem* GetConstantMem(); // ... |
There was a problem hiding this comment.
Why do you need a non-const version? In principle, this should be constant memory during kernels?
| 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 |
There was a problem hiding this comment.
Could we move everything that is not pure-GPU related to GPUChainTracking. GPUReconstruction should be generic.
There was a problem hiding this comment.
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.
| 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") |
There was a problem hiding this comment.
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?
| 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() int32_t* ExtrapolationCandidatesLeftDirection() const { return mExtrapolationCandidatesLeftDirection; } |
There was a problem hiding this comment.
int8_t should be enough. In principle, you should be able to store the direction together with the candidateID by using the highest bit. nTracks should never exceed 24 bit anyway.
I think you can just use GPUMemcpy directly to copy only part of a buffer? |
I still don't understand what do you need the write access for? You should only write to the arrays, but not to the constant memory itself. like the merger and DataCompression kernels do it. Then your kernel already receives ConstantMem and not only the current sector GPUTPCTracker. |
| { | ||
| AllocateAndInitializeLate(); | ||
| bool reuseCondition = MemoryReuseAllowed(); | ||
| GPUMemoryReuse reLinks{reuseCondition, GPUMemoryReuse::REUSE_1TO1, GPUMemoryReuse::TrackerDataLinks, (uint16_t)(mISector % mRec->GetProcessingSettings().nStreams)}; |
There was a problem hiding this comment.
Ah, you refer to this? This seems a bug indeed! I'd do the following:
- Move StreamForSector back to GPUChainTracking.
- Include GPUChainTracking.h to GPUTPCTracker.cxx #ifndef GPUCAGPUCODE
- Add an optional option to StreamForSector overriding the nstreams, and use the new parameter for tpcsectortracking when called from GPUTPCTracker.cxx
Changes: For every TPC sector, during GPUTPCTrackletSelector, we write a list of left and right exiting tracks. Then GPUTPCExtrapolationTracking only runs on those tracks. Newly, we do this per pair of sectors, or per edge that they share, respectively. This changes how the sectors have to wait for their neighboring sectors to finish GPUTPCTrackletSelector. While not strictly necessary, we have changed the number of streams and how we assign them to the sectors. Finally, the GPUParameters.csv was updated to fit the new extrapolation tracking.
Remarks:
iSector.GetConstantMem()->tpcTrackers[iSectorNeighbor]. This is was actively prohibited before and should thus be looked at.GPUChainTracking::ExtrapolationTracking. The two copies are racing, but in a way taht doesn't corrupt the final data (on copy copies a subset of the other). Maybe we can find a better solution for this.