Project
Loading...
Searching...
No Matches
GPUTPCGMMergerGPU.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#include "GPUTPCGMMergerGPU.h"
16#include "GPUCommonAlgorithm.h"
18
19using namespace o2::gpu;
20
21template <>
22GPUdii() void GPUTPCGMMergerTrackFit::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int32_t mode)
23{
24 const int32_t iEnd = mode == -1 ? merger.Memory()->nRetryRefit : merger.NOutputTracks();
25 GPUCA_TBB_KERNEL_LOOP(merger.GetRec(), int32_t, ii, iEnd, {
26 const int32_t i = mode == -1 ? merger.RetryRefitIds()[ii] : mode ? merger.TrackOrderProcess()[ii] : ii;
27 GPUTPCGMTrackParam::RefitTrack(merger.OutputTracks()[i], i, &merger, mode == -1);
28 });
29}
30
31template <>
32GPUdii() void GPUTPCGMMergerFollowLoopers::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
33{
34 GPUCA_TBB_KERNEL_LOOP(merger.GetRec(), uint32_t, i, merger.Memory()->nLoopData, {
35 GPUTPCGMTrackParam::RefitLoop(&merger, i);
36 });
37}
38
39template <>
40GPUdii() void GPUTPCGMMergerUnpackResetIds::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int32_t iSector)
41{
42 merger.UnpackResetIds(nBlocks, nThreads, iBlock, iThread, iSector);
43}
44
45template <>
46GPUdii() void GPUTPCGMMergerSectorRefit::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int32_t iSector)
47{
48 merger.RefitSectorTracks(nBlocks, nThreads, iBlock, iThread, iSector);
49}
50
51template <>
52GPUdii() void GPUTPCGMMergerUnpackGlobal::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int32_t iSector)
53{
54 merger.UnpackSectorGlobal(nBlocks, nThreads, iBlock, iThread, iSector);
55}
56
57template <>
58GPUdii() void GPUTPCGMMergerUnpackSaveNumber::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int32_t id)
59{
60 if (iThread == 0 && iBlock == 0) {
61 merger.UnpackSaveNumber(id);
62 }
63}
64
65template <>
66GPUdii() void GPUTPCGMMergerResolve::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
67{
68 merger.ResolveFindConnectedComponentsSetup(nBlocks, nThreads, iBlock, iThread);
69}
70
71template <>
72GPUdii() void GPUTPCGMMergerResolve::Thread<1>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
73{
74 merger.ResolveFindConnectedComponentsHookLinks(nBlocks, nThreads, iBlock, iThread);
75}
76
77template <>
78GPUdii() void GPUTPCGMMergerResolve::Thread<2>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
79{
80 merger.ResolveFindConnectedComponentsHookNeighbors(nBlocks, nThreads, iBlock, iThread);
81}
82
83template <>
84GPUdii() void GPUTPCGMMergerResolve::Thread<3>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
85{
86 merger.ResolveFindConnectedComponentsMultiJump(nBlocks, nThreads, iBlock, iThread);
87}
88
89template <>
90GPUdii() void GPUTPCGMMergerResolve::Thread<4>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int8_t useOrigTrackParam, int8_t mergeAll)
91{
92 merger.ResolveMergeSectors(smem, nBlocks, nThreads, iBlock, iThread, useOrigTrackParam, mergeAll);
93}
94
95template <>
96GPUdii() void GPUTPCGMMergerClearLinks::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int8_t output)
97{
98 merger.ClearTrackLinks(nBlocks, nThreads, iBlock, iThread, output);
99}
100
101template <>
102GPUdii() void GPUTPCGMMergerMergeWithinPrepare::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
103{
104 merger.MergeWithinSectorsPrepare(nBlocks, nThreads, iBlock, iThread);
105}
106
107template <>
108GPUdii() void GPUTPCGMMergerMergeSectorsPrepare::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int32_t border0, int32_t border1, int8_t useOrigTrackParam)
109{
110 merger.MergeSectorsPrepare(nBlocks, nThreads, iBlock, iThread, border0, border1, useOrigTrackParam);
111}
112
113template <int32_t I, typename... Args>
114GPUdii() void GPUTPCGMMergerMergeBorders::Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, Args... args)
115{
116 merger.MergeBorderTracks<I>(nBlocks, nThreads, iBlock, iThread, args...);
117}
118#if !defined(GPUCA_GPUCODE) || defined(GPUCA_GPUCODE_DEVICE) // FIXME: DR: WORKAROUND to avoid CUDA bug creating host symbols for device code.
119template GPUdni() void GPUTPCGMMergerMergeBorders::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int32_t iSector, int8_t withinSector, int8_t mergeMode);
120template GPUdni() void GPUTPCGMMergerMergeBorders::Thread<2>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int32_t iSector, int8_t withinSector, int8_t mergeMode);
121template GPUdni() void GPUTPCGMMergerMergeBorders::Thread<3>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, gputpcgmmergertypes::GPUTPCGMBorderRange* range, int32_t N, int32_t cmpMax);
122#endif
123template <>
124GPUdii() void GPUTPCGMMergerMergeBorders::Thread<1>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger, int32_t iSector, int8_t withinSector, int8_t mergeMode)
125{
126 merger.MergeBorderTracks<1>(2, nThreads, iBlock & 1, iThread, iBlock / 2, withinSector, mergeMode);
127}
128
129template <>
130GPUdii() void GPUTPCGMMergerMergeCE::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
131{
132 merger.MergeCE(nBlocks, nThreads, iBlock, iThread);
133}
134
135template <>
136GPUdii() void GPUTPCGMMergerLinkExtrapolatedTracks::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
137{
138 merger.LinkExtrapolatedTracks(nBlocks, nThreads, iBlock, iThread);
139}
140
141template <>
142GPUdii() void GPUTPCGMMergerCollect::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
143{
144 merger.CollectMergedTracks(nBlocks, nThreads, iBlock, iThread);
145}
146
147template <>
148GPUdii() void GPUTPCGMMergerSortTracks::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
149{
150 merger.SortTracks(nBlocks, nThreads, iBlock, iThread);
151}
152
153template <>
154GPUdii() void GPUTPCGMMergerSortTracksQPt::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
155{
156 merger.SortTracksQPt(nBlocks, nThreads, iBlock, iThread);
157}
158
159template <>
160GPUdii() void GPUTPCGMMergerSortTracksPrepare::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
161{
162 merger.SortTracksPrepare(nBlocks, nThreads, iBlock, iThread);
163}
164
165template <>
166GPUdii() void GPUTPCGMMergerPrepareClusters::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
167{
168 merger.PrepareClustersForFit0(nBlocks, nThreads, iBlock, iThread);
169}
170
171template <>
172GPUdii() void GPUTPCGMMergerPrepareClusters::Thread<1>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
173{
174 merger.PrepareClustersForFit1(nBlocks, nThreads, iBlock, iThread);
175}
176
177template <>
178GPUdii() void GPUTPCGMMergerPrepareClusters::Thread<2>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
179{
180 merger.PrepareClustersForFit2(nBlocks, nThreads, iBlock, iThread);
181}
182
183template <>
184GPUdii() void GPUTPCGMMergerFinalize::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
185{
186 merger.Finalize0(nBlocks, nThreads, iBlock, iThread);
187}
188
189template <>
190GPUdii() void GPUTPCGMMergerFinalize::Thread<1>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
191{
192 merger.Finalize1(nBlocks, nThreads, iBlock, iThread);
193}
194
195template <>
196GPUdii() void GPUTPCGMMergerFinalize::Thread<2>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
197{
198 merger.Finalize2(nBlocks, nThreads, iBlock, iThread);
199}
200
201template <>
202GPUdii() void GPUTPCGMMergerMergeLoopers::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
203{
204 merger.MergeLoopersInit(nBlocks, nThreads, iBlock, iThread);
205}
206
207template <>
208GPUdii() void GPUTPCGMMergerMergeLoopers::Thread<1>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
209{
210 merger.MergeLoopersSort(nBlocks, nThreads, iBlock, iThread);
211}
212
213template <>
214GPUdii() void GPUTPCGMMergerMergeLoopers::Thread<2>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
215{
216 merger.MergeLoopersMain(nBlocks, nThreads, iBlock, iThread);
217}
int32_t i
#define GPUsharedref()
#define GPUdni()
#define GPUrestrict()
#define GPUCA_TBB_KERNEL_LOOP(rec, vartype, varname, iEnd, code)
GPUdii() void GPUTPCGMMergerTrackFit
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
GLenum mode
Definition glcorearb.h:266
GLenum GLint * range
Definition glcorearb.h:1899
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)