Skip to content

Commit 4cd5e70

Browse files
committed
GPU TPC: Fix deterministic mode for TPC cluster compression / decompression / looper merging afterburner
1 parent 4580149 commit 4cd5e70

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAKernelsSpecialize.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ struct GPUTPCGMMergerSortTracksQPt_comp {
8282
struct GPUTPCGMMergerMergeLoopers_comp {
8383
GPUd() bool operator()(const MergeLooperParam& a, const MergeLooperParam& b)
8484
{
85-
return CAMath::Abs(a.refz) < CAMath::Abs(b.refz);
85+
return GPUCA_DETERMINISTIC_CODE(CAMath::Abs(a.refz) != CAMath::Abs(b.refz) ? CAMath::Abs(a.refz) < CAMath::Abs(b.refz) : a.id < b.id, CAMath::Abs(a.refz) < CAMath::Abs(b.refz));
8686
}
8787
};
8888

8989
struct GPUTPCGMO2OutputSort_comp {
9090
GPUd() bool operator()(const GPUTPCGMMerger::tmpSort& a, const GPUTPCGMMerger::tmpSort& b)
9191
{
92-
return (a.y > b.y);
92+
return GPUCA_DETERMINISTIC_CODE(a.y != b.y ? a.y > b.y : a.x > b.x, a.y > b.y);
9393
}
9494
};
9595

GPU/GPUTracking/Merger/GPUTPCGMMerger.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ GPUd() void GPUTPCGMMerger::MergeLoopersSort(int32_t nBlocks, int32_t nThreads,
19481948
if (iThread || iBlock) {
19491949
return;
19501950
}
1951-
auto comp = [](const MergeLooperParam& a, const MergeLooperParam& b) { return CAMath::Abs(a.refz) < CAMath::Abs(b.refz); };
1951+
auto comp = [](const MergeLooperParam& a, const MergeLooperParam& b) { return GPUCA_DETERMINISTIC_CODE(CAMath::Abs(a.refz) != CAMath::Abs(b.refz) ? CAMath::Abs(a.refz) < CAMath::Abs(b.refz) : a.id < b.id, CAMath::Abs(a.refz) < CAMath::Abs(b.refz)); };
19521952
GPUCommonAlgorithm::sortDeviceDynamic(mLooperCandidates, mLooperCandidates + mMemory->nLooperMatchCandidates, comp);
19531953
#endif
19541954
}

GPU/GPUTracking/Merger/GPUTPCGMO2Output.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ GPUdii() void GPUTPCGMO2Output::Thread<GPUTPCGMO2Output::sort>(int32_t nBlocks,
8888
return;
8989
}
9090
GPUTPCGMMerger::tmpSort* GPUrestrict() trackSort = merger.TrackSortO2();
91-
auto comp = [](const auto& a, const auto& b) { return (a.y > b.y); };
91+
auto comp = [](const auto& a, const auto& b) { return GPUCA_DETERMINISTIC_CODE(a.y != b.y ? a.y > b.y : a.x > b.x, a.y > b.y); };
9292
GPUCommonAlgorithm::sortDeviceDynamic(trackSort, trackSort + merger.Memory()->nO2Tracks, comp);
9393
#endif
9494
}

0 commit comments

Comments
 (0)