Skip to content

Commit 33cc986

Browse files
committed
GPU TPC clusterizer: wait for the gather of the previous sector before clearing the maps
A lane reuses its scratch memory for its next sector. At the first fragment the charge and peak maps were cleared without waiting for the gather of the previous sector, which runs on another stream, and the maps can overlap that sector's clusterByRow: on pbpb30 the peak map of sector 3 ends at row 0 of sector 0. When the gather starts late, row 0 of the previous sector is gathered as zeros: on a 20 kHz Pb-Pb time frame on Metal, the first run in a process found 0.42 % fewer sector tracks. The existing wait on the gather sat on the clusterInRow clear, after the map clears. Move it to the first map clear at fragment 0.
1 parent 5dffc90 commit 33cc986

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,12 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
10381038

10391039
using ChargeMapType = decltype(*clustererShadow.mPchargeMap);
10401040
using PeakMapType = decltype(*clustererShadow.mPpeakMap);
1041-
runKernel<GPUMemClean16>({GetGridAutoStep(lane, RecoStep::TPCClusterFinding)}, clustererShadow.mPchargeMap, TPCMapMemoryLayout<ChargeMapType>::items(GetProcessingSettings().overrideClusterizerFragmentLen) * sizeof(ChargeMapType));
1041+
deviceEvent* waitEvent = nullptr;
1042+
if (frag.index == 0 && transferRunning[lane] == 1) { // The gather of the previous sector of this lane may still read the scratch memory the maps are cleared in
1043+
waitEvent = &mEvents->stream[lane];
1044+
transferRunning[lane] = 2;
1045+
}
1046+
runKernel<GPUMemClean16>({GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {nullptr, waitEvent}}, clustererShadow.mPchargeMap, TPCMapMemoryLayout<ChargeMapType>::items(GetProcessingSettings().overrideClusterizerFragmentLen) * sizeof(ChargeMapType));
10421047
runKernel<GPUMemClean16>({GetGridAutoStep(lane, RecoStep::TPCClusterFinding)}, clustererShadow.mPpeakMap, TPCMapMemoryLayout<PeakMapType>::items(GetProcessingSettings().overrideClusterizerFragmentLen) * sizeof(PeakMapType));
10431048
if (frag.index == 0) {
10441049
runKernel<GPUMemClean16>({GetGridAutoStep(lane, RecoStep::TPCClusterFinding)}, clustererShadow.mPpadIsNoisy, TPC_CLUSTERER_STRIDED_PAD_COUNT * sizeof(*clustererShadow.mPpadIsNoisy));
@@ -1211,12 +1216,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
12111216
}
12121217

12131218
if (resetClusterCounters) {
1214-
deviceEvent* waitEvent = nullptr;
1215-
if (transferRunning[lane] == 1) {
1216-
waitEvent = &mEvents->stream[lane];
1217-
transferRunning[lane] = 2;
1218-
}
1219-
runKernel<GPUMemClean16>({GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {nullptr, waitEvent}}, clustererShadow.mPclusterInRow, GPUTPCGeometry::NROWS * sizeof(*clustererShadow.mPclusterInRow));
1219+
runKernel<GPUMemClean16>({GetGridAutoStep(lane, RecoStep::TPCClusterFinding)}, clustererShadow.mPclusterInRow, GPUTPCGeometry::NROWS * sizeof(*clustererShadow.mPclusterInRow));
12201220
}
12211221

12221222
if (clusterer.mPmemory->counters.nPositions == 0) {

0 commit comments

Comments
 (0)