1414
1515#if defined(GPUCA_SPECIALIZE_THRUST_SORTS) && !defined(GPUCA_GPUCODE_COMPILEKERNELS)
1616
17- namespace o2 ::gpu::internal
18- {
19- namespace // anonymous
20- {
21- struct MergeBorderTracks_compMax {
22- GPUd () bool operator ()(const GPUTPCGMBorderRange& a, const GPUTPCGMBorderRange& b)
23- {
24- return GPUCA_DETERMINISTIC_CODE ((a.fMax != b.fMax ) ? (a.fMax < b.fMax ) : (a.fId < b.fId ), a.fMax < b.fMax );
25- }
26- };
27- struct MergeBorderTracks_compMin {
28- GPUd () bool operator ()(const GPUTPCGMBorderRange& a, const GPUTPCGMBorderRange& b)
29- {
30- return GPUCA_DETERMINISTIC_CODE ((a.fMin != b.fMin ) ? (a.fMin < b.fMin ) : (a.fId < b.fId ), a.fMin < b.fMin );
31- }
32- };
33-
34- struct GPUTPCGMMergerSortTracks_comp {
35- const GPUTPCGMMergedTrack* const mCmp ;
36- GPUhd () GPUTPCGMMergerSortTracks_comp(GPUTPCGMMergedTrack* cmp) : mCmp (cmp) {}
37- GPUd () bool operator ()(const int32_t aa, const int32_t bb)
38- {
39- const GPUTPCGMMergedTrack& GPUrestrict () a = mCmp [aa];
40- const GPUTPCGMMergedTrack& GPUrestrict () b = mCmp [bb];
41- if (a.CCE () != b.CCE ()) {
42- return a.CCE () > b.CCE ();
43- }
44- if (a.Legs () != b.Legs ()) {
45- return a.Legs () > b.Legs ();
46- }
47- GPUCA_DETERMINISTIC_CODE ( // clang-format off
48- if (a.NClusters () != b.NClusters ()) {
49- return a.NClusters () > b.NClusters ();
50- } if (CAMath::Abs (a.GetParam ().GetQPt ()) != CAMath::Abs (b.GetParam ().GetQPt ())) {
51- return CAMath::Abs (a.GetParam ().GetQPt ()) > CAMath::Abs (b.GetParam ().GetQPt ());
52- } if (a.GetParam ().GetY () != b.GetParam ().GetY ()) {
53- return a.GetParam ().GetY () > b.GetParam ().GetY ();
54- }
55- return aa > bb;
56- , // !GPUCA_DETERMINISTIC_CODE
57- return a.NClusters () > b.NClusters ();
58- ) // clang-format on
59- }
60- };
61-
62- struct GPUTPCGMMergerSortTracksQPt_comp {
63- const GPUTPCGMMergedTrack* const mCmp ;
64- GPUhd () GPUTPCGMMergerSortTracksQPt_comp(GPUTPCGMMergedTrack* cmp) : mCmp (cmp) {}
65- GPUd () bool operator ()(const int32_t aa, const int32_t bb)
66- {
67- const GPUTPCGMMergedTrack& GPUrestrict () a = mCmp [aa];
68- const GPUTPCGMMergedTrack& GPUrestrict () b = mCmp [bb];
69- GPUCA_DETERMINISTIC_CODE ( // clang-format off
70- if (CAMath::Abs (a.GetParam ().GetQPt ()) != CAMath::Abs (b.GetParam ().GetQPt ())) {
71- return CAMath::Abs (a.GetParam ().GetQPt ()) > CAMath::Abs (b.GetParam ().GetQPt ());
72- } if (a.GetParam ().GetY () != b.GetParam ().GetY ()) {
73- return a.GetParam ().GetY () > b.GetParam ().GetY ();
74- }
75- return a.GetParam ().GetZ () > b.GetParam ().GetZ ();
76- , // !GPUCA_DETERMINISTIC_CODE
77- return CAMath::Abs (a.GetParam ().GetQPt ()) > CAMath::Abs (b.GetParam ().GetQPt ());
78- ) // clang-format on
79- }
80- };
81-
82- struct GPUTPCGMMergerMergeLoopers_comp {
83- GPUd () bool operator ()(const MergeLooperParam& a, const MergeLooperParam& b)
84- {
85- return CAMath::Abs (a.refz ) < CAMath::Abs (b.refz );
86- }
87- };
88-
89- struct GPUTPCGMO2OutputSort_comp {
90- GPUd () bool operator ()(const GPUTPCGMMerger::tmpSort& a, const GPUTPCGMMerger::tmpSort& b)
91- {
92- return (a.y > b.y );
93- }
94- };
95-
96- } // anonymous namespace
97- } // namespace o2::gpu::internal
98-
9917template <>
10018inline void GPUCA_M_CAT (GPUReconstruction, GPUCA_GPUTYPE)::runKernelBackendTimed<GPUTPCGMMergerMergeBorders, 3>(const krnlSetupTime& _xyz, GPUTPCGMBorderRange* const & range, int32_t const & N, int32_t const & cmpMax)
10119{
@@ -109,13 +27,13 @@ inline void GPUCA_M_CAT(GPUReconstruction, GPUCA_GPUTYPE)::runKernelBackendTimed
10927template <>
11028inline void GPUCA_M_CAT (GPUReconstruction, GPUCA_GPUTYPE)::runKernelBackendTimed<GPUTPCGMMergerSortTracks, 0>(const krnlSetupTime& _xyz)
11129{
112- GPUCommonAlgorithm::sortOnDevice (this , _xyz.x .stream , mProcessorsShadow ->tpcMerger .TrackOrderProcess (), processors ()->tpcMerger .NOutputTracks (), GPUTPCGMMergerSortTracks_comp (mProcessorsShadow ->tpcMerger .OutputTracks ()));
30+ GPUCommonAlgorithm::sortOnDevice (this , _xyz.x .stream , mProcessorsShadow ->tpcMerger .TrackOrderProcess (), processors ()->tpcMerger .NMergedTracks (), GPUTPCGMMergerSortTracks_comp (mProcessorsShadow ->tpcMerger .MergedTracks ()));
11331}
11432
11533template <>
11634inline void GPUCA_M_CAT (GPUReconstruction, GPUCA_GPUTYPE)::runKernelBackendTimed<GPUTPCGMMergerSortTracksQPt, 0>(const krnlSetupTime& _xyz)
11735{
118- GPUCommonAlgorithm::sortOnDevice (this , _xyz.x .stream , mProcessorsShadow ->tpcMerger .TrackSort (), processors ()->tpcMerger .NOutputTracks (), GPUTPCGMMergerSortTracksQPt_comp (mProcessorsShadow ->tpcMerger .OutputTracks ()));
36+ GPUCommonAlgorithm::sortOnDevice (this , _xyz.x .stream , mProcessorsShadow ->tpcMerger .TrackSort (), processors ()->tpcMerger .NMergedTracks (), GPUTPCGMMergerSortTracksQPt_comp (mProcessorsShadow ->tpcMerger .MergedTracks ()));
11937}
12038
12139template <>
0 commit comments