forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGPUConstantMem.h
126 lines (109 loc) · 3.51 KB
/
GPUConstantMem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file GPUConstantMem.h
/// \author David Rohr
#ifndef GPUCONSTANTMEM_H
#define GPUCONSTANTMEM_H
#include "GPUTPCTracker.h"
#include "GPUParam.h"
#include "GPUDataTypes.h"
#include "GPUErrors.h"
#include "GPUTPCGMMerger.h"
#include "GPUTRDTracker.h"
#include "GPUTPCConvert.h"
#include "GPUTPCCompression.h"
#include "GPUTPCDecompression.h"
#include "GPUITSFitter.h"
#include "GPUTPCClusterFinder.h"
#include "GPUTrackingRefit.h"
#ifdef GPUCA_KERNEL_DEBUGGER_OUTPUT
#include "GPUKernelDebugOutput.h"
#endif
#ifdef GPUCA_HAS_ONNX
#include "GPUTPCNNClusterizer.h"
#endif
namespace o2::gpu
{
struct GPUConstantMem {
GPUParam param;
GPUTPCTracker tpcTrackers[GPUCA_NSECTORS];
GPUTPCConvert tpcConverter;
GPUTPCCompression tpcCompressor;
GPUTPCDecompression tpcDecompressor;
GPUTPCGMMerger tpcMerger;
GPUTRDTrackerGPU trdTrackerGPU;
GPUTRDTracker trdTrackerO2;
GPUTPCClusterFinder tpcClusterer[GPUCA_NSECTORS];
GPUITSFitter itsFitter;
GPUTrackingRefitProcessor trackingRefit;
GPUTrackingInOutPointers ioPtrs;
GPUCalibObjectsConst calibObjects;
GPUErrors errorCodes;
#ifdef GPUCA_KERNEL_DEBUGGER_OUTPUT
GPUKernelDebugOutput debugOutput;
#endif
#ifdef GPUCA_HAS_ONNX
GPUTPCNNClusterizer tpcNNClusterer[GPUCA_NSECTORS];
#endif
template <int32_t I>
GPUd() auto& getTRDTracker();
};
template <>
GPUdi() auto& GPUConstantMem::getTRDTracker<0>()
{
return trdTrackerGPU;
}
template <>
GPUdi() auto& GPUConstantMem::getTRDTracker<1>()
{
return trdTrackerO2;
}
union GPUConstantMemCopyable {
#if !defined(__OPENCL__) || defined(__OPENCL_HOST__)
GPUh() GPUConstantMemCopyable() {} // NOLINT: We want an empty constructor, not a default one
GPUh() ~GPUConstantMemCopyable() {} // NOLINT: We want an empty destructor, not a default one
GPUh() GPUConstantMemCopyable(const GPUConstantMemCopyable& o)
{
for (uint32_t k = 0; k < sizeof(GPUConstantMem) / sizeof(int32_t); k++) {
((int32_t*)&v)[k] = ((int32_t*)&o.v)[k];
}
}
#endif
GPUConstantMem v;
};
#if defined(GPUCA_GPUCODE)
static constexpr size_t gGPUConstantMemBufferSize = (sizeof(GPUConstantMem) + sizeof(uint4) - 1);
#endif
} // namespace o2::gpu
#if defined(GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM) && !defined(GPUCA_GPUCODE_HOSTONLY)
GPUconstant() o2::gpu::GPUConstantMemCopyable gGPUConstantMemBuffer;
#endif // GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM
namespace o2::gpu
{
// Must be placed here, to avoid circular header dependency
GPUdi() GPUconstantref() const GPUConstantMem* GPUProcessor::GetConstantMem() const
{
#if defined(GPUCA_GPUCODE_DEVICE) && defined(GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM) && !defined(GPUCA_GPUCODE_HOSTONLY)
return &GPUCA_CONSMEM;
#else
return mConstantMem;
#endif
}
GPUdi() GPUconstantref() const GPUParam& GPUProcessor::Param() const
{
return GetConstantMem()->param;
}
GPUdi() void GPUProcessor::raiseError(uint32_t code, uint32_t param1, uint32_t param2, uint32_t param3) const
{
GetConstantMem()->errorCodes.raiseError(code, param1, param2, param3);
}
} // namespace o2::gpu
#endif