From 02a797f7a9d2f6d380b534592c64024128318e2a Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Sat, 21 Nov 2026 12:52:37 +0100 Subject: [PATCH] GPU Clusterizer: synchronize the cluster transfer to the host before sorting the clusters In deterministic mode (or with debugLevel >= 4), the clusters are copied from the GPU to the host on the last stream, sorted on the host, and copied back to the GPU. The copy to the host was only waited for with synchronizeOutput, which RunTPCClusterizer gets as false, so the host sorted a partially transferred buffer, still holding the previous time frame's clusters, and uploaded the result: the clusters seen by the tracking, and the track counts, changed from run to run. --- GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx index 8ce90c740804a..54b694727986e 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx @@ -1582,7 +1582,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput) mInputsHost->mPclusterNativeAccess->setOffsetPtrs(); TransferMemoryResourceLinkToGPU(RecoStep::TPCClusterFinding, mInputsHost->mResourceClusterNativeAccess, 0); } - if (doGPU && synchronizeOutput) { + if (doGPU && (synchronizeOutput || sortClusters)) { // SortClusters works on the host copy of the clusters, which is transferred on this stream SynchronizeStream(mRec->NStreams() - 1); } if (doGPU && synchronizeCalibUpdate) {