From 38b5f62f27109cd968ab341cfbd17b7b54f4dd64 Mon Sep 17 00:00:00 2001 From: Felix Weiglhofer Date: Fri, 21 Aug 2026 15:59:32 +0200 Subject: [PATCH] TPC Cluster Finder: Fix uninitialized counters Fix an issue in the TPC Cluster Finder, where an empty subtimeframe could lead to cluster counter not being initialized correctly. --- GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx index 8301c9eaa6792..8c6534d74b31d 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx @@ -1197,7 +1197,9 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput) GPUTPCClusterFinder& clusterer = processors()->tpcClusterer[iSector]; GPUTPCClusterFinder& clustererShadow = doGPU ? processorsShadow()->tpcClusterer[iSector] : clusterer; - if (clusterer.mPmemory->counters.nPositions == 0) { + const bool resetClusterCounters = fragment.index == 0; + // The reset must also run for an empty first fragment since later fragments can contain data. + if (clusterer.mPmemory->counters.nPositions == 0 && !resetClusterCounters) { return; } @@ -1205,7 +1207,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput) SynchronizeStream(lane); } - if (fragment.index == 0) { + if (resetClusterCounters) { deviceEvent* waitEvent = nullptr; if (transferRunning[lane] == 1) { waitEvent = &mEvents->stream[lane]; @@ -1214,6 +1216,10 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput) runKernel({GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {nullptr, waitEvent}}, clustererShadow.mPclusterInRow, GPUTPCGeometry::NROWS * sizeof(*clustererShadow.mPclusterInRow)); } + if (clusterer.mPmemory->counters.nPositions == 0) { + return; + } + const auto nRegularClusters = clusterer.mPmemory->counters.nClusters; if (nRegularClusters != 0) { if (GetProcessingSettings().nn.applyNNclusterizer) {