Skip to content

Commit 7210283

Browse files
authored
Fix codechecker warnings (#5272)
1 parent fa62fa0 commit 7210283

11 files changed

Lines changed: 60 additions & 57 deletions

File tree

Detectors/ITSMFT/ITS/tracking/cuda/include/ITStrackingCUDA/PrimaryVertexContextNV.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class PrimaryVertexContextNV final : public PrimaryVertexContext
3636
{
3737
public:
3838
PrimaryVertexContextNV() = default;
39-
virtual ~PrimaryVertexContextNV() = default;
39+
~PrimaryVertexContextNV() override;
4040

4141
void initialise(const MemoryParameters& memParam, const TrackingParameters& trkParam,
4242
const std::vector<std::vector<Cluster>>& cl, const std::array<float, 3>& pv, const int iteration) override;
@@ -62,6 +62,8 @@ class PrimaryVertexContextNV final : public PrimaryVertexContext
6262
std::array<gpu::Vector<Cell>, constants::its2::CellsPerRoad - 1> mTempCellArray;
6363
};
6464

65+
inline PrimaryVertexContextNV::~PrimaryVertexContextNV() = default;
66+
6567
inline gpu::DeviceStoreNV& PrimaryVertexContextNV::getDeviceContext()
6668
{
6769
return *mGPUContextDevicePointer;

Detectors/ITSMFT/ITS/tracking/cuda/include/ITStrackingCUDA/VertexerTraitsGPU.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class VertexerTraitsGPU : public VertexerTraits
4747
~VertexerTraitsGPU() override;
4848
#else
4949
VertexerTraitsGPU();
50-
~VertexerTraitsGPU() = default;
50+
~VertexerTraitsGPU() override;
5151
#endif
5252
void initialise(ROframe*) override;
5353
void computeTracklets() override;

Detectors/ITSMFT/ITS/tracking/cuda/src/VertexerTraitsGPU.cu

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ VertexerTraitsGPU::VertexerTraitsGPU()
9393

9494
#endif
9595

96+
VertexerTraitsGPU::~VertexerTraitsGPU() = default;
97+
9698
void VertexerTraitsGPU::initialise(ROframe* event)
9799
{
98100
reset();

Detectors/ITSMFT/ITS/tracking/hip/include/ITStrackingHIP/UniquePointerHIP.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ UniquePointer<T>::UniquePointer(const T& ref)
8282
{
8383
try {
8484

85-
Utils::HostHIP::gpuMalloc(reinterpret_cast<void**>(&mDevicePointer), sizeof(T));
86-
Utils::HostHIP::gpuMemcpyHostToDevice(mDevicePointer, &ref, sizeof(T));
85+
utils::host_hip::gpuMalloc(reinterpret_cast<void**>(&mDevicePointer), sizeof(T));
86+
utils::host_hip::gpuMemcpyHostToDevice(mDevicePointer, &ref, sizeof(T));
8787

8888
} catch (...) {
8989

@@ -119,7 +119,7 @@ void UniquePointer<T>::destroy()
119119
{
120120
if (mDevicePointer != nullptr) {
121121

122-
Utils::HostHIP::gpuFree(mDevicePointer);
122+
utils::host_hip::gpuFree(mDevicePointer);
123123
}
124124
}
125125

Detectors/ITSMFT/ITS/tracking/hip/include/ITStrackingHIP/UtilsHIP.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ namespace its
2626
namespace gpu
2727
{
2828

29-
namespace Utils
29+
namespace utils
3030
{
3131

32-
namespace HostHIP
32+
namespace host_hip
3333
{
3434

3535
#ifdef __HIPCC__
@@ -50,15 +50,15 @@ void gpuMemcpyHostToDeviceAsync(void*, const void*, int, hipStream_t&);
5050
void gpuMemcpyDeviceToHost(void*, const void*, int);
5151
// void gpuStartProfiler();
5252
// void gpuStopProfiler();
53-
} // namespace Host
53+
} // namespace host_hip
5454
//
55-
namespace DeviceHIP
55+
namespace device_hip
5656
{
5757
GPUd() int getLaneIndex();
5858
GPUd() int shareToWarp(const int, const int);
5959
GPUd() int gpuAtomicAdd(int*, const int);
60-
} // namespace Device
61-
} // namespace Utils
60+
} // namespace device_hip
61+
} // namespace utils
6262
} // namespace gpu
6363
} // namespace its
6464
} // namespace o2

Detectors/ITSMFT/ITS/tracking/hip/include/ITStrackingHIP/VectorHIP.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,17 @@ VectorHIP<T>::VectorHIP(const T* const source, const int size, const int initial
100100
if (size > 0) {
101101
try {
102102

103-
Utils::HostHIP::gpuMalloc(reinterpret_cast<void**>(&mArrayPointer), size * sizeof(T));
104-
Utils::HostHIP::gpuMalloc(reinterpret_cast<void**>(&mDeviceSize), sizeof(int));
103+
utils::host_hip::gpuMalloc(reinterpret_cast<void**>(&mArrayPointer), size * sizeof(T));
104+
utils::host_hip::gpuMalloc(reinterpret_cast<void**>(&mDeviceSize), sizeof(int));
105105

106106
if (source != nullptr) {
107107

108-
Utils::HostHIP::gpuMemcpyHostToDevice(mArrayPointer, source, size * sizeof(T));
109-
Utils::HostHIP::gpuMemcpyHostToDevice(mDeviceSize, &size, sizeof(int));
108+
utils::host_hip::gpuMemcpyHostToDevice(mArrayPointer, source, size * sizeof(T));
109+
utils::host_hip::gpuMemcpyHostToDevice(mDeviceSize, &size, sizeof(int));
110110

111111
} else {
112112

113-
Utils::HostHIP::gpuMemcpyHostToDevice(mDeviceSize, &initialSize, sizeof(int));
113+
utils::host_hip::gpuMemcpyHostToDevice(mDeviceSize, &initialSize, sizeof(int));
114114
}
115115

116116
} catch (...) {
@@ -179,15 +179,15 @@ template <typename T>
179179
int VectorHIP<T>::getSizeFromDevice() const
180180
{
181181
int size;
182-
Utils::HostHIP::gpuMemcpyDeviceToHost(&size, mDeviceSize, sizeof(int));
182+
utils::host_hip::gpuMemcpyDeviceToHost(&size, mDeviceSize, sizeof(int));
183183

184184
return size;
185185
}
186186

187187
template <typename T>
188188
void VectorHIP<T>::resize(const int size)
189189
{
190-
Utils::HostHIP::gpuMemcpyHostToDevice(mDeviceSize, &size, sizeof(int));
190+
utils::host_hip::gpuMemcpyHostToDevice(mDeviceSize, &size, sizeof(int));
191191
}
192192

193193
template <typename T>
@@ -201,20 +201,20 @@ void VectorHIP<T>::reset(const T* const source, const int size, const int initia
201201
{
202202
if (size > mCapacity) {
203203
if (mArrayPointer != nullptr) {
204-
Utils::HostHIP::gpuFree(mArrayPointer);
204+
utils::host_hip::gpuFree(mArrayPointer);
205205
}
206206

207-
Utils::HostHIP::gpuMalloc(reinterpret_cast<void**>(&mArrayPointer), size * sizeof(T));
207+
utils::host_hip::gpuMalloc(reinterpret_cast<void**>(&mArrayPointer), size * sizeof(T));
208208
mCapacity = size;
209209
}
210210

211211
if (source != nullptr) {
212212

213-
Utils::HostHIP::gpuMemcpyHostToDevice(mArrayPointer, source, size * sizeof(T));
214-
Utils::HostHIP::gpuMemcpyHostToDevice(mDeviceSize, &size, sizeof(int));
213+
utils::host_hip::gpuMemcpyHostToDevice(mArrayPointer, source, size * sizeof(T));
214+
utils::host_hip::gpuMemcpyHostToDevice(mDeviceSize, &size, sizeof(int));
215215

216216
} else {
217-
Utils::HostHIP::gpuMemcpyHostToDevice(mDeviceSize, &initialSize, sizeof(int));
217+
utils::host_hip::gpuMemcpyHostToDevice(mDeviceSize, &initialSize, sizeof(int));
218218
}
219219
}
220220

@@ -227,7 +227,7 @@ void VectorHIP<T>::copyIntoVector(std::vector<T>& destinationVector, const int s
227227
try {
228228

229229
hostPrimitivePointer = static_cast<T*>(malloc(size * sizeof(T)));
230-
Utils::HostHIP::gpuMemcpyDeviceToHost(hostPrimitivePointer, mArrayPointer, size * sizeof(T));
230+
utils::host_hip::gpuMemcpyDeviceToHost(hostPrimitivePointer, mArrayPointer, size * sizeof(T));
231231

232232
destinationVector = std::move(std::vector<T>(hostPrimitivePointer, hostPrimitivePointer + size));
233233

@@ -245,20 +245,20 @@ void VectorHIP<T>::copyIntoVector(std::vector<T>& destinationVector, const int s
245245
template <typename T>
246246
void VectorHIP<T>::copyIntoSizedVector(std::vector<T>& destinationVector)
247247
{
248-
Utils::HostHIP::gpuMemcpyDeviceToHost(destinationVector.data(), mArrayPointer, destinationVector.size() * sizeof(T));
248+
utils::host_hip::gpuMemcpyDeviceToHost(destinationVector.data(), mArrayPointer, destinationVector.size() * sizeof(T));
249249
}
250250

251251
template <typename T>
252252
inline void VectorHIP<T>::destroy()
253253
{
254254
if (mArrayPointer != nullptr) {
255255

256-
Utils::HostHIP::gpuFree(mArrayPointer);
256+
utils::host_hip::gpuFree(mArrayPointer);
257257
}
258258

259259
if (mDeviceSize != nullptr) {
260260

261-
Utils::HostHIP::gpuFree(mDeviceSize);
261+
utils::host_hip::gpuFree(mDeviceSize);
262262
}
263263
}
264264

@@ -290,7 +290,7 @@ template <typename T>
290290
T VectorHIP<T>::getElementFromDevice(const int index) const
291291
{
292292
T element;
293-
Utils::HostHIP::gpuMemcpyDeviceToHost(&element, mArrayPointer + index, sizeof(T));
293+
utils::host_hip::gpuMemcpyDeviceToHost(&element, mArrayPointer + index, sizeof(T));
294294

295295
return element;
296296
}
@@ -304,7 +304,7 @@ GPUhd() int VectorHIP<T>::size() const
304304
template <typename T>
305305
GPUd() int VectorHIP<T>::extend(const int sizeIncrement) const
306306
{
307-
const int startIndex = Utils::DeviceHIP::gpuAtomicAdd(mDeviceSize, sizeIncrement);
307+
const int startIndex = utils::device_hip::gpuAtomicAdd(mDeviceSize, sizeIncrement);
308308
assert(size() <= mCapacity);
309309

310310
return startIndex;

Detectors/ITSMFT/ITS/tracking/hip/include/ITStrackingHIP/VertexerTraitsHIP.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "ITStracking/VertexerTraits.h"
2222
#include "ITStracking/Cluster.h"
2323
#include "ITStracking/Constants.h"
24-
// #include "ITStracking/Definitions.h"
2524
#include "ITStracking/Tracklet.h"
2625

2726
#include "ITStrackingHIP/DeviceStoreVertexerHIP.h"

Detectors/ITSMFT/ITS/tracking/hip/src/ContextHIP.hip.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace its
4343
namespace gpu
4444
{
4545

46-
using Utils::HostHIP::checkHIPError;
46+
using utils::host_hip::checkHIPError;
4747

4848
ContextHIP::ContextHIP(bool dumpDevices)
4949
{

Detectors/ITSMFT/ITS/tracking/hip/src/DeviceStoreVertexerHIP.hip.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ UniquePointer<DeviceStoreVertexerHIP> DeviceStoreVertexerHIP::initialise(const s
8484
mIndexTables[0].reset(indexTables[0].data(), static_cast<int>(indexTables[0].size()));
8585
mIndexTables[1].reset(indexTables[2].data(), static_cast<int>(indexTables[2].size()));
8686

87-
const dim3 threadsPerBlock{Utils::HostHIP::getBlockSize(mClusters[1].capacity())};
88-
const dim3 blocksGrid{Utils::HostHIP::getBlocksGrid(threadsPerBlock, mClusters[1].capacity())};
87+
const dim3 threadsPerBlock{utils::host_hip::getBlockSize(mClusters[1].capacity())};
88+
const dim3 blocksGrid{utils::host_hip::getBlocksGrid(threadsPerBlock, mClusters[1].capacity())};
8989

9090
UniquePointer<DeviceStoreVertexerHIP> deviceStoreVertexerPtr{*this};
9191

Detectors/ITSMFT/ITS/tracking/hip/src/UtilsHIP.hip.cxx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
1010
///
11-
/// \file UtilsHIP.hip.cxx
11+
/// \file utilsHIP.hip.cxx
1212
/// \brief
1313
///
1414

@@ -58,7 +58,7 @@ namespace its
5858
namespace gpu
5959
{
6060

61-
void Utils::HostHIP::checkHIPError(const hipError_t error, const char* file, const int line)
61+
void utils::host_hip::checkHIPError(const hipError_t error, const char* file, const int line)
6262
{
6363
if (error != hipSuccess) {
6464
std::ostringstream errorString{};
@@ -68,18 +68,18 @@ void Utils::HostHIP::checkHIPError(const hipError_t error, const char* file, con
6868
}
6969
}
7070

71-
dim3 Utils::HostHIP::getBlockSize(const int colsNum)
71+
dim3 utils::host_hip::getBlockSize(const int colsNum)
7272
{
7373
return getBlockSize(colsNum, 1);
7474
}
7575

76-
dim3 Utils::HostHIP::getBlockSize(const int colsNum, const int rowsNum)
76+
dim3 utils::host_hip::getBlockSize(const int colsNum, const int rowsNum)
7777
{
7878
const DeviceProperties& deviceProperties = ContextHIP::getInstance().getDeviceProperties();
7979
return getBlockSize(colsNum, rowsNum, deviceProperties.streamProcessors / deviceProperties.maxBlocksPerSM);
8080
}
8181

82-
dim3 Utils::HostHIP::getBlockSize(const int colsNum, const int rowsNum, const int maxThreadsPerBlock)
82+
dim3 utils::host_hip::getBlockSize(const int colsNum, const int rowsNum, const int maxThreadsPerBlock)
8383
{
8484
const DeviceProperties& deviceProperties = ContextHIP::getInstance().getDeviceProperties();
8585
int xThreads = std::max(std::min(colsNum, static_cast<int>(deviceProperties.maxThreadsDim.x)), 1);
@@ -98,71 +98,71 @@ dim3 Utils::HostHIP::getBlockSize(const int colsNum, const int rowsNum, const in
9898
return dim3{static_cast<unsigned int>(xThreads), static_cast<unsigned int>(yThreads)};
9999
}
100100

101-
dim3 Utils::HostHIP::getBlocksGrid(const dim3& threadsPerBlock, const int rowsNum)
101+
dim3 utils::host_hip::getBlocksGrid(const dim3& threadsPerBlock, const int rowsNum)
102102
{
103103
return getBlocksGrid(threadsPerBlock, rowsNum, 1);
104104
}
105105

106-
dim3 Utils::HostHIP::getBlocksGrid(const dim3& threadsPerBlock, const int rowsNum, const int colsNum)
106+
dim3 utils::host_hip::getBlocksGrid(const dim3& threadsPerBlock, const int rowsNum, const int colsNum)
107107
{
108108
return dim3{1 + (rowsNum - 1) / threadsPerBlock.x, 1 + (colsNum - 1) / threadsPerBlock.y};
109109
}
110110

111-
void Utils::HostHIP::gpuMalloc(void** p, const int size)
111+
void utils::host_hip::gpuMalloc(void** p, const int size)
112112
{
113113
checkHIPError(hipMalloc(p, size), __FILE__, __LINE__);
114114
}
115115

116-
void Utils::HostHIP::gpuFree(void* p)
116+
void utils::host_hip::gpuFree(void* p)
117117
{
118118
checkHIPError(hipFree(p), __FILE__, __LINE__);
119119
}
120120

121-
void Utils::HostHIP::gpuMemset(void* p, int value, int size)
121+
void utils::host_hip::gpuMemset(void* p, int value, int size)
122122
{
123123
checkHIPError(hipMemset(p, value, size), __FILE__, __LINE__);
124124
}
125125

126-
void Utils::HostHIP::gpuMemcpyHostToDevice(void* dst, const void* src, int size)
126+
void utils::host_hip::gpuMemcpyHostToDevice(void* dst, const void* src, int size)
127127
{
128128
checkHIPError(hipMemcpy(dst, src, size, hipMemcpyHostToDevice), __FILE__, __LINE__);
129129
}
130130

131-
void Utils::HostHIP::gpuMemcpyHostToDeviceAsync(void* dst, const void* src, int size, hipStream_t& stream)
131+
void utils::host_hip::gpuMemcpyHostToDeviceAsync(void* dst, const void* src, int size, hipStream_t& stream)
132132
{
133133
checkHIPError(hipMemcpyAsync(dst, src, size, hipMemcpyHostToDevice, stream), __FILE__, __LINE__);
134134
}
135135

136-
void Utils::HostHIP::gpuMemcpyDeviceToHost(void* dst, const void* src, int size)
136+
void utils::host_hip::gpuMemcpyDeviceToHost(void* dst, const void* src, int size)
137137
{
138138
checkHIPError(hipMemcpy(dst, src, size, hipMemcpyDeviceToHost), __FILE__, __LINE__);
139139
}
140140

141-
// void Utils::HostHIP::gpuStartProfiler()
141+
// void utils::host_hip::gpuStartProfiler()
142142
// {
143143
// checkHIPError(hipProfilerStart(), __FILE__, __LINE__);
144144
// }
145145

146-
// void Utils::HostHIP::gpuStopProfiler()
146+
// void utils::host_hip::gpuStopProfiler()
147147
// {
148148
// checkHIPError(hipProfilerStop(), __FILE__, __LINE__);
149149
// }
150150

151-
GPUd() int Utils::DeviceHIP::getLaneIndex()
151+
GPUd() int utils::device_hip::getLaneIndex()
152152
{
153153
uint32_t laneIndex;
154154
asm volatile("mov.u32 %0, %%laneid;"
155155
: "=r"(laneIndex));
156156
return static_cast<int>(laneIndex);
157157
}
158158

159-
// GPUd() int Utils::Device::shareToWarp(const int value, const int laneIndex)
159+
// GPUd() int utils::Device::shareToWarp(const int value, const int laneIndex)
160160
// {
161161
// cooperative_groups::coalesced_group threadGroup = cooperative_groups::coalesced_threads();
162162
// return threadGroup.shfl(value, laneIndex);
163163
// }
164164

165-
// GPUd() int Utils::Device::gpuAtomicAdd(int* p, const int incrementSize)
165+
// GPUd() int utils::Device::gpuAtomicAdd(int* p, const int incrementSize)
166166
// {
167167
// return atomicAdd(p, incrementSize);
168168
// }

0 commit comments

Comments
 (0)