Skip to content

Commit 38b5f62

Browse files
committed
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.
1 parent f045ccf commit 38b5f62

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,15 +1197,17 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
11971197
GPUTPCClusterFinder& clusterer = processors()->tpcClusterer[iSector];
11981198
GPUTPCClusterFinder& clustererShadow = doGPU ? processorsShadow()->tpcClusterer[iSector] : clusterer;
11991199

1200-
if (clusterer.mPmemory->counters.nPositions == 0) {
1200+
const bool resetClusterCounters = fragment.index == 0;
1201+
// The reset must also run for an empty first fragment since later fragments can contain data.
1202+
if (clusterer.mPmemory->counters.nPositions == 0 && !resetClusterCounters) {
12011203
return;
12021204
}
12031205

12041206
if (doGPU) {
12051207
SynchronizeStream(lane);
12061208
}
12071209

1208-
if (fragment.index == 0) {
1210+
if (resetClusterCounters) {
12091211
deviceEvent* waitEvent = nullptr;
12101212
if (transferRunning[lane] == 1) {
12111213
waitEvent = &mEvents->stream[lane];
@@ -1214,6 +1216,10 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
12141216
runKernel<GPUMemClean16>({GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {nullptr, waitEvent}}, clustererShadow.mPclusterInRow, GPUTPCGeometry::NROWS * sizeof(*clustererShadow.mPclusterInRow));
12151217
}
12161218

1219+
if (clusterer.mPmemory->counters.nPositions == 0) {
1220+
return;
1221+
}
1222+
12171223
const auto nRegularClusters = clusterer.mPmemory->counters.nClusters;
12181224
if (nRegularClusters != 0) {
12191225
if (GetProcessingSettings().nn.applyNNclusterizer) {

0 commit comments

Comments
 (0)