Skip to content

Commit 94dffff

Browse files
committed
ITS: GPU: fix perPrimaryVertexProcessing
With using the GPU stack allocator, we cannot in the perPrimaryVertexProcessing push to the stack in initialiseTimeFrame since it is only called once while computeLayerTracklets to findRoads is called once per vertex. In findRoads we tried to clear a tag from a previous iteration while the stack is empty leading to a fatal. This fixes that and avoid creating the tracklet LUT buffer on each pass.
1 parent 74675ef commit 94dffff

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackerTraitsGPU.cxx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ void TrackerTraitsGPU<NLayers>::initialiseTimeFrame(const int iteration)
5252
if (this->mTrkParams[iteration].PassFlags[IterationStep::FirstPass] || this->mTrkParams[iteration].PassFlags[IterationStep::UseUPCMask]) {
5353
mTimeFrameGPU->loadROFCutMask(iteration);
5454
}
55-
// push every create artefact on the stack
56-
mTimeFrameGPU->pushMemoryStack(iteration);
5755
}
5856

5957
template <int NLayers>
@@ -68,8 +66,9 @@ void TrackerTraitsGPU<NLayers>::computeLayerTracklets(const int iteration, int i
6866
{
6967
const auto topology = mTimeFrameGPU->getDeviceTrackingTopologyView();
7068
const auto hostTopology = mTimeFrameGPU->getTrackingTopologyView();
69+
const bool loadFirstPassData = this->mTrkParams[iteration].PassFlags[IterationStep::FirstPass] && iVertex <= 0; // load data only on first pass and first vertex
7170
for (int iLayer{0}; iLayer < this->mTrkParams[iteration].NLayers; ++iLayer) {
72-
if (this->mTrkParams[iteration].PassFlags[IterationStep::FirstPass]) {
71+
if (loadFirstPassData) {
7372
mTimeFrameGPU->createUsedClustersDevice(iLayer);
7473
mTimeFrameGPU->loadClustersDevice(iLayer);
7574
mTimeFrameGPU->loadClustersIndexTables(iLayer);
@@ -78,9 +77,16 @@ void TrackerTraitsGPU<NLayers>::computeLayerTracklets(const int iteration, int i
7877
mTimeFrameGPU->recordEvent(iLayer);
7978
}
8079

80+
for (int linkId{0}; linkId < hostTopology.nLinks; ++linkId) {
81+
mTimeFrameGPU->createTrackletsLUTDevice(loadFirstPassData, linkId); // on first pass allocates, then only clears memory
82+
}
83+
84+
// Stack allocations created from trackleting through road finding are scoped to one tracker pass.
85+
// With per-primary-vertex processing, the chain is called once per vertex while initialisation is only done once.
86+
mTimeFrameGPU->pushMemoryStack(iteration);
87+
8188
for (int linkId{0}; linkId < hostTopology.nLinks; ++linkId) {
8289
const auto link = hostTopology.getLink(linkId);
83-
mTimeFrameGPU->createTrackletsLUTDevice(this->mTrkParams[iteration].PassFlags[IterationStep::FirstPass], linkId);
8490
mTimeFrameGPU->waitEvent(linkId, link.fromLayer);
8591
mTimeFrameGPU->waitEvent(linkId, link.toLayer);
8692
countTrackletsInROFsHandler<NLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),

0 commit comments

Comments
 (0)