Project
Loading...
Searching...
No Matches
GPUTPCStartHitsSorter.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
16#include "GPUTPCTracker.h"
17
18#include "GPUTPCHit.h"
19#include "GPUCommonMath.h"
20#include "GPUDefMacros.h"
21
22using namespace o2::gpu;
23template <>
24GPUdii() void GPUTPCStartHitsSorter::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& s, processorType& GPUrestrict() tracker)
25{
26 // Sorts the Start Hits by Row Index
27 if (iThread == 0) {
28 const int32_t tmpNRows = GPUCA_ROW_COUNT - 6;
29 const int32_t nRows = iBlock == (nBlocks - 1) ? (tmpNRows - (tmpNRows / nBlocks) * (nBlocks - 1)) : (tmpNRows / nBlocks);
30 const int32_t nStartRow = (tmpNRows / nBlocks) * iBlock + 1;
31 int32_t startOffset2 = 0;
32 GPUCA_UNROLL(, U())
33 for (int32_t ir = 1; ir < GPUCA_ROW_COUNT - 5; ir++) {
34 if (ir < nStartRow) {
35 startOffset2 += tracker.mRowStartHitCountOffset[ir];
36 }
37 }
38 s.mStartOffset = startOffset2;
39 s.mNRows = nRows;
40 s.mStartRow = nStartRow;
41 }
42 GPUbarrier();
43
44 int32_t startOffset = s.mStartOffset;
45#ifdef __HIPCC__ // TODO: Fixme
46 for (int32_t ir = -1; ++ir < s.mNRows;) {
47#else
48 for (int32_t ir = 0; ir < s.mNRows; ir++) {
49#endif
50 GPUglobalref() GPUTPCHitId* const GPUrestrict() startHits = tracker.mTrackletStartHits;
51 GPUglobalref() GPUTPCHitId* const GPUrestrict() tmpStartHits = tracker.mTrackletTmpStartHits + (s.mStartRow + ir) * tracker.mNMaxRowStartHits;
52
53 const int32_t tmpLen = tracker.mRowStartHitCountOffset[ir + s.mStartRow]; // Length of hits in row stored by StartHitsFinder
54 for (int32_t j = iThread; j < tmpLen; j += nThreads) {
55 startHits[startOffset + j] = tmpStartHits[j];
56 }
57 startOffset += tmpLen;
58 }
59}
#define GPUsharedref()
#define GPUbarrier()
#define GPUrestrict()
#define GPUglobalref()
#define GPUCA_UNROLL(optCu, optHi)
#define GPUCA_ROW_COUNT
GPUdii() void GPUTPCStartHitsSorter
uint32_t j
Definition RawData.h:0
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
o2::InteractionRecord ir(0, 0)