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() : mNumberOfHits(0), mNumberOfHitsPlusAlign(0), mClusterIdOffset(0), mGPUTextureBase(nullptr), mRows(nullptr), mLinkUpData(nullptr), mLinkDownData(nullptr), mClusterData(nullptr) {}
33
34#ifndef GPUCA_GPUCODE_DEVICE
36 void InitializeRows(const GPUParam& p);
37 void SetMaxData();
38 void SetClusterData(const GPUTPCClusterData* data, 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 GPUhdi() void SetGPUTextureBase(GPUglobalref() const void* val) { mGPUTextureBase = val; }
116 GPUhdi() char* GPUTextureBase() const { return ((char*)mGPUTextureBase); }
117 GPUhdi() char* GPUTextureBaseConst() const { return ((char*)mGPUTextureBase); }
118
119 GPUhdi() GPUglobalref() const GPUTPCClusterData* ClusterData() const { return mClusterData; }
120
121 private:
122#ifndef GPUCA_GPUCODE
123 GPUTPCTrackingData& operator=(const GPUTPCTrackingData&) = delete; // ROOT 5 tries to use this if it is not private
124 GPUTPCTrackingData(const GPUTPCTrackingData&) = delete; //
125#endif
126 GPUd() void CreateGrid(GPUconstantref() const GPUConstantMem* mem, GPUTPCRow* GPUrestrict() row, float yMin, float yMax, float zMin, float zMax);
127 GPUd() void SetRowGridEmpty(GPUTPCRow& GPUrestrict() row);
128 GPUd() static void GetMaxNBins(GPUconstantref() const GPUConstantMem* mem, GPUTPCRow* GPUrestrict() row, int32_t& maxY, int32_t& maxZ);
129 GPUd() uint32_t GetGridSize(uint32_t nHits, uint32_t nRows);
130
133
134 int32_t mNumberOfHits; // the number of hits in this sector
135 int32_t mNumberOfHitsPlusAlign;
136 int32_t mClusterIdOffset;
137
138 GPUglobalref() const void* mGPUTextureBase; // pointer to start of GPU texture
139
140 GPUglobalref() GPUTPCRow* mRows; // The row objects needed for most accessor functions
141
142 GPUglobalref() calink* mLinkUpData; // hit index in the row above which is linked to the given (global) hit index
143 GPUglobalref() calink* mLinkDownData; // hit index in the row below which is linked to the given (global) hit index
144 GPUglobalref() cahit2* mHitData; // packed y,z coordinate of the given (global) hit index
145 GPUglobalref() int32_t* mClusterDataIndex; // see ClusterDataIndex()
146
147 /*
148 * The size of the array is row.Grid.N + row.Grid.Ny + 3. The row.Grid.Ny + 3 is an optimization
149 * to remove the need for bounds checking. The last values are the same as the entry at [N - 1].
150 */
151 GPUglobalref() calink* mFirstHitInBin; // see FirstHitInBin
152 GPUglobalref() GPUAtomic(uint32_t) * mHitWeights; // the weight of the longest tracklet crossed the cluster
153 GPUglobalref() const GPUTPCClusterData* mClusterData;
154};
155
156GPUdi() calink GPUTPCTrackingData::HitLinkUpData(const GPUTPCRow& row, const calink& hitIndex) const { return mLinkUpData[row.mHitNumberOffset + hitIndex]; }
157
158GPUdi() calink GPUTPCTrackingData::HitLinkDownData(const GPUTPCRow& row, const calink& hitIndex) const { return mLinkDownData[row.mHitNumberOffset + hitIndex]; }
159
160GPUdi() void GPUTPCTrackingData::SetHitLinkUpData(const GPUTPCRow& row, const calink& hitIndex, const calink& value)
161{
162 mLinkUpData[row.mHitNumberOffset + hitIndex] = value;
163}
164
165GPUdi() void GPUTPCTrackingData::SetHitLinkDownData(const GPUTPCRow& row, const calink& hitIndex, const calink& value)
166{
167 mLinkDownData[row.mHitNumberOffset + hitIndex] = value;
168}
169
170GPUdi() cahit GPUTPCTrackingData::HitDataY(const GPUTPCRow& row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex].x; }
171
172GPUdi() cahit GPUTPCTrackingData::HitDataZ(const GPUTPCRow& row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex].y; }
173
174GPUdi() cahit2 GPUTPCTrackingData::HitData(const GPUTPCRow& row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex]; }
175
176GPUdi() calink GPUTPCTrackingData::FirstHitInBin(const GPUTPCRow& row, calink binIndex) const { return mFirstHitInBin[row.mFirstHitInBinOffset + binIndex]; }
177
178GPUhdi() int32_t GPUTPCTrackingData::ClusterDataIndex(const GPUTPCRow& row, uint32_t hitIndex) const { return mClusterDataIndex[row.mHitNumberOffset + hitIndex]; }
179
180GPUdi() void GPUTPCTrackingData::MaximizeHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight)
181{
182 CAMath::AtomicMax(&mHitWeights[row.mHitNumberOffset + hitIndex], weight);
183}
184
185GPUdi() void GPUTPCTrackingData::SetHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight)
186{
187 mHitWeights[row.mHitNumberOffset + hitIndex] = weight;
188}
189
190GPUdi() int32_t GPUTPCTrackingData::HitWeight(const GPUTPCRow& row, uint32_t hitIndex) const { return mHitWeights[row.mHitNumberOffset + hitIndex]; }
191} // namespace o2::gpu
192
193#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
GPUhdi() char *GPUTextureBase() const
int32_t int32_t int32_t iThread
GPUdi() GPUglobalref() const calink *FirstHitInBin(const GPUTPCRow &row) const
GPUhdi() void SetGPUTextureBase(GPUglobalref() const void *val)
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 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
GPUhdi() char *GPUTextureBaseConst() const
GPUhdi() GPUglobalref() const GPUTPCClusterData *ClusterData() const
int32_t int32_t int32_t int32_t float * tmpMinMax
GPUhd() int32_t NumberOfHitsPlusAlign() const
void SetClusterData(const GPUTPCClusterData *data, int32_t nClusters, int32_t clusterIdOffset)
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
GLboolean * data
Definition glcorearb.h:298
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLuint GLfloat * val
Definition glcorearb.h:1582
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