Project
Loading...
Searching...
No Matches
GPUTPCTrackingData.h
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#ifndef GPUTPCSECTORDATA_H
16#define GPUTPCSECTORDATA_H
17
18#include "GPUTPCDef.h"
19#include "GPUTPCRow.h"
20#include "GPUCommonMath.h"
21#include "GPUParam.h"
22#include "GPUProcessor.h"
23
24namespace o2::gpu
25{
26struct GPUTPCClusterData;
27class GPUTPCHit;
28
30{
31 public:
32 GPUTPCTrackingData() = default;
33
34#ifndef GPUCA_GPUCODE_DEVICE
36 void InitializeRows(const GPUParam& p);
37 void SetMaxData();
38 void SetClusterData(int32_t nClusters, int32_t clusterIdOffset);
39 void* SetPointersScratch(void* mem, bool idsOnGPU);
40 void* SetPointersLinks(void* mem);
41 void* SetPointersWeights(void* mem);
42 void* SetPointersClusterIds(void* mem, bool idsOnGPU);
43 void* SetPointersRows(void* mem);
44#endif
45
46 GPUd() int32_t InitFromClusterData(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUconstantref() const GPUConstantMem* mem, int32_t iSector, float* tmpMinMax);
47
51 GPUhd() int32_t NumberOfHits() const { return mNumberOfHits; }
52 GPUhd() int32_t NumberOfHitsPlusAlign() const { return mNumberOfHitsPlusAlign; }
53 GPUhd() int32_t ClusterIdOffset() const { return mClusterIdOffset; }
54
62
63 GPUhdi() GPUglobalref() const cahit2* HitData(const GPUTPCRow& row) const { return &mHitData[row.mHitNumberOffset]; }
64 GPUhdi() GPUglobalref() cahit2* HitData(const GPUTPCRow& row) { return &mHitData[row.mHitNumberOffset]; }
65 GPUhd() GPUglobalref() const cahit2* HitData() const { return (mHitData); }
66 GPUdi() GPUglobalref() const calink* HitLinkUpData(const GPUTPCRow& row) const { return &mLinkUpData[row.mHitNumberOffset]; }
67 GPUdi() GPUglobalref() calink* HitLinkUpData(const GPUTPCRow& row) { return &mLinkUpData[row.mHitNumberOffset]; }
68 GPUdi() GPUglobalref() const calink* HitLinkDownData(const GPUTPCRow& row) const { return &mLinkDownData[row.mHitNumberOffset]; }
69 GPUdi() GPUglobalref() const calink* FirstHitInBin(const GPUTPCRow& row) const { return &mFirstHitInBin[row.mFirstHitInBinOffset]; }
70
72 GPUd() void SetHitLinkDownData(const GPUTPCRow& row, const calink& hitIndex, const calink& value);
73
77 GPUd() cahit HitDataY(const GPUTPCRow& row, const uint32_t& hitIndex) const;
78 GPUd() cahit HitDataZ(const GPUTPCRow& row, const uint32_t& hitIndex) const;
79 GPUd() cahit2 HitData(const GPUTPCRow& row, const uint32_t& hitIndex) const;
80
87 GPUd() calink FirstHitInBin(const GPUTPCRow& row, calink binIndex) const;
88
92 GPUd() void MaximizeHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight);
93 GPUd() void SetHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight);
94
98 GPUd() int32_t HitWeight(const GPUTPCRow& row, uint32_t hitIndex) const;
99
103 GPUhd() int32_t ClusterDataIndex(const GPUTPCRow& row, uint32_t hitIndex) const;
104 GPUd() GPUglobalref() const int32_t* ClusterDataIndex() const { return mClusterDataIndex; }
105 GPUd() GPUglobalref() int32_t* ClusterDataIndex() { return mClusterDataIndex; }
106
110 GPUhdi() GPUglobalref() const GPUTPCRow& Row(int32_t rowIndex) const { return mRows[rowIndex]; }
111 GPUhdi() GPUglobalref() GPUTPCRow* Rows() const { return mRows; }
112
113 GPUhdi() GPUglobalref() GPUAtomic(uint32_t) * HitWeights() { return (mHitWeights); }
114
115 private:
116#ifndef GPUCA_GPUCODE
117 GPUTPCTrackingData& operator=(const GPUTPCTrackingData&) = delete; // ROOT 5 tries to use this if it is not private
118 GPUTPCTrackingData(const GPUTPCTrackingData&) = delete; //
119#endif
120 GPUd() void CreateGrid(GPUconstantref() const GPUConstantMem* mem, GPUTPCRow* GPUrestrict() row, float yMin, float yMax, float zMin, float zMax);
121 GPUd() void SetRowGridEmpty(GPUTPCRow& GPUrestrict() row);
122 GPUd() static void GetMaxNBins(GPUconstantref() const GPUConstantMem* mem, GPUTPCRow* GPUrestrict() row, int32_t& maxY, int32_t& maxZ);
123 GPUd() uint32_t GetGridSize(uint32_t nHits, uint32_t nRows);
124
127
128 int32_t mNumberOfHits = 0; // the number of hits in this sector
129 int32_t mNumberOfHitsPlusAlign = 0;
130 int32_t mClusterIdOffset = 0;
131
132 GPUglobalref() GPUTPCRow* mRows = nullptr; // The row objects needed for most accessor functions
133
134 GPUglobalref() calink* mLinkUpData = nullptr; // hit index in the row above which is linked to the given (global) hit index
135 GPUglobalref() calink* mLinkDownData = nullptr; // hit index in the row below which is linked to the given (global) hit index
136 GPUglobalref() cahit2* mHitData = nullptr; // packed y,z coordinate of the given (global) hit index
137 GPUglobalref() int32_t* mClusterDataIndex = nullptr; // see ClusterDataIndex()
138
139 /*
140 * The size of the array is row.Grid.N + row.Grid.Ny + 3. The row.Grid.Ny + 3 is an optimization
141 * to remove the need for bounds checking. The last values are the same as the entry at [N - 1].
142 */
143 GPUglobalref() calink* mFirstHitInBin; // see FirstHitInBin
144 GPUglobalref() GPUAtomic(uint32_t) * mHitWeights; // the weight of the longest tracklet crossed the cluster
145};
146
147GPUdi() calink GPUTPCTrackingData::HitLinkUpData(const GPUTPCRow& row, const calink& hitIndex) const { return mLinkUpData[row.mHitNumberOffset + hitIndex]; }
148
149GPUdi() calink GPUTPCTrackingData::HitLinkDownData(const GPUTPCRow& row, const calink& hitIndex) const { return mLinkDownData[row.mHitNumberOffset + hitIndex]; }
150
151GPUdi() void GPUTPCTrackingData::SetHitLinkUpData(const GPUTPCRow& row, const calink& hitIndex, const calink& value)
152{
153 mLinkUpData[row.mHitNumberOffset + hitIndex] = value;
154}
155
156GPUdi() void GPUTPCTrackingData::SetHitLinkDownData(const GPUTPCRow& row, const calink& hitIndex, const calink& value)
157{
158 mLinkDownData[row.mHitNumberOffset + hitIndex] = value;
159}
160
161GPUdi() cahit GPUTPCTrackingData::HitDataY(const GPUTPCRow& row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex].x; }
162
163GPUdi() cahit GPUTPCTrackingData::HitDataZ(const GPUTPCRow& row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex].y; }
164
165GPUdi() cahit2 GPUTPCTrackingData::HitData(const GPUTPCRow& row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex]; }
166
167GPUdi() calink GPUTPCTrackingData::FirstHitInBin(const GPUTPCRow& row, calink binIndex) const { return mFirstHitInBin[row.mFirstHitInBinOffset + binIndex]; }
168
169GPUhdi() int32_t GPUTPCTrackingData::ClusterDataIndex(const GPUTPCRow& row, uint32_t hitIndex) const { return mClusterDataIndex[row.mHitNumberOffset + hitIndex]; }
170
171GPUdi() void GPUTPCTrackingData::MaximizeHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight)
172{
173 CAMath::AtomicMax(&mHitWeights[row.mHitNumberOffset + hitIndex], weight);
174}
175
176GPUdi() void GPUTPCTrackingData::SetHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight)
177{
178 mHitWeights[row.mHitNumberOffset + hitIndex] = weight;
179}
180
181GPUdi() int32_t GPUTPCTrackingData::HitWeight(const GPUTPCRow& row, uint32_t hitIndex) const { return mHitWeights[row.mHitNumberOffset + hitIndex]; }
182} // namespace o2::gpu
183
184#endif // GPUTPCSECTORDATA_H
#define GPUAtomic(type)
int nClusters
GPUhd() int32_t NumberOfHits() const
GPUdi() GPUglobalref() calink *HitLinkUpData(const GPUTPCRow &row)
GPUd() void SetHitLinkUpData(const GPUTPCRow &row
GPUhd() int32_t ClusterIdOffset() const
const calink &hitIndex const
int32_t int32_t int32_t iThread
GPUdi() GPUglobalref() const calink *FirstHitInBin(const GPUTPCRow &row) const
int32_t int32_t int32_t int32_t iSector
GPUd() GPUglobalref() int32_t *ClusterDataIndex()
int32_t int32_t int32_t GPUconstantref() const GPUConstantMem *mem
GPUd() int32_t InitFromClusterData(int32_t nBlocks
GPUhd() GPUglobalref() const cahit2 *HitData() const
GPUhdi() GPUglobalref() const GPUTPCRow &Row(int32_t rowIndex) const
GPUhdi() GPUglobalref() GPUAtomic(uint32_t) *HitWeights()
void SetClusterData(int32_t nClusters, int32_t clusterIdOffset)
void InitializeRows(const GPUParam &p)
GPUhdi() GPUglobalref() cahit2 *HitData(const GPUTPCRow &row)
void * SetPointersScratch(void *mem, bool idsOnGPU)
GPUdi() GPUglobalref() const calink *HitLinkUpData(const GPUTPCRow &row) const
const calink const calink & value
int32_t int32_t int32_t int32_t float * tmpMinMax
GPUhd() int32_t NumberOfHitsPlusAlign() const
GPUdi() GPUglobalref() const calink *HitLinkDownData(const GPUTPCRow &row) const
void * SetPointersClusterIds(void *mem, bool idsOnGPU)
GPUhdi() GPUglobalref() GPUTPCRow *Rows() const
GLfloat GLfloat GLfloat GLfloat GLfloat maxY
Definition glcorearb.h:2910
GLuint GLuint GLfloat weight
Definition glcorearb.h:5477
GLsizei const GLfloat * value
Definition glcorearb.h:819
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat maxZ
Definition glcorearb.h:2910
GPUdi() o2
Definition TrackTRD.h:38
uint32_t cahit
Definition GPUTPCDef.h:31
uint32_t calink
Definition GPUTPCDef.h:30
std::vector< int > row