Skip to content

Commit 92afdd8

Browse files
committed
GPU: runKernel* functions do anyway return always 0, so remove return value
1 parent 33be683 commit 92afdd8

File tree

9 files changed

+32
-37
lines changed

9 files changed

+32
-37
lines changed

GPU/GPUTracking/Base/GPUReconstructionCPU.cxx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ GPUReconstructionCPU::~GPUReconstructionCPU()
5656
}
5757

5858
template <class T, int32_t I, typename... Args>
59-
inline int32_t GPUReconstructionCPUBackend::runKernelBackendInternal(const krnlSetupTime& _xyz, const Args&... args)
59+
inline void GPUReconstructionCPUBackend::runKernelBackendInternal(const krnlSetupTime& _xyz, const Args&... args)
6060
{
6161
auto& x = _xyz.x;
6262
auto& y = _xyz.y;
@@ -90,11 +90,10 @@ inline int32_t GPUReconstructionCPUBackend::runKernelBackendInternal(const krnlS
9090
}
9191
}
9292
}
93-
return 0;
9493
}
9594

9695
template <>
97-
inline int32_t GPUReconstructionCPUBackend::runKernelBackendInternal<GPUMemClean16, 0>(const krnlSetupTime& _xyz, void* const& ptr, uint64_t const& size)
96+
inline void GPUReconstructionCPUBackend::runKernelBackendInternal<GPUMemClean16, 0>(const krnlSetupTime& _xyz, void* const& ptr, uint64_t const& size)
9897
{
9998
int32_t nnThreads = std::max<int32_t>(1, std::min<int32_t>(size / (16 * 1024 * 1024), getNKernelHostThreads(true)));
10099
if (nnThreads > 1) {
@@ -112,13 +111,12 @@ inline int32_t GPUReconstructionCPUBackend::runKernelBackendInternal<GPUMemClean
112111
} else {
113112
memset(ptr, 0, size);
114113
}
115-
return 0;
116114
}
117115

118116
template <class T, int32_t I, typename... Args>
119-
int32_t GPUReconstructionCPUBackend::runKernelBackend(const krnlSetupArgs<T, I, Args...>& args)
117+
void GPUReconstructionCPUBackend::runKernelBackend(const krnlSetupArgs<T, I, Args...>& args)
120118
{
121-
return std::apply([this, &args](auto&... vals) { return runKernelBackendInternal<T, I, Args...>(args.s, vals...); }, args.v);
119+
std::apply([this, &args](auto&... vals) { runKernelBackendInternal<T, I, Args...>(args.s, vals...); }, args.v);
122120
}
123121

124122
template <class T, int32_t I>
@@ -127,8 +125,8 @@ krnlProperties GPUReconstructionCPUBackend::getKernelPropertiesBackend()
127125
return krnlProperties{1, 1};
128126
}
129127

130-
#define GPUCA_KRNL(x_class, x_attributes, x_arguments, x_forward, x_types) \
131-
template int32_t GPUReconstructionCPUBackend::runKernelBackend<GPUCA_M_KRNL_TEMPLATE(x_class)>(const krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>& args); \
128+
#define GPUCA_KRNL(x_class, x_attributes, x_arguments, x_forward, x_types) \
129+
template void GPUReconstructionCPUBackend::runKernelBackend<GPUCA_M_KRNL_TEMPLATE(x_class)>(const krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>& args); \
132130
template krnlProperties GPUReconstructionCPUBackend::getKernelPropertiesBackend<GPUCA_M_KRNL_TEMPLATE(x_class)>();
133131
#include "GPUReconstructionKernelList.h"
134132
#undef GPUCA_KRNL

GPU/GPUTracking/Base/GPUReconstructionCPU.h

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class GPUReconstructionCPUBackend : public GPUReconstructionProcessing
3535
protected:
3636
GPUReconstructionCPUBackend(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionProcessing(cfg) {}
3737
template <class T, int32_t I = 0, typename... Args>
38-
int32_t runKernelBackend(const gpu_reconstruction_kernels::krnlSetupArgs<T, I, Args...>& args);
38+
void runKernelBackend(const gpu_reconstruction_kernels::krnlSetupArgs<T, I, Args...>& args);
3939
template <class T, int32_t I = 0, typename... Args>
40-
int32_t runKernelBackendInternal(const gpu_reconstruction_kernels::krnlSetupTime& _xyz, const Args&... args);
40+
void runKernelBackendInternal(const gpu_reconstruction_kernels::krnlSetupTime& _xyz, const Args&... args);
4141
template <class T, int32_t I>
4242
gpu_reconstruction_kernels::krnlProperties getKernelPropertiesBackend();
4343
};
@@ -53,7 +53,7 @@ class GPUReconstructionCPU : public GPUReconstructionKernels<GPUReconstructionCP
5353
static constexpr krnlEvent krnlEventNone = krnlEvent{nullptr, nullptr, 0};
5454

5555
template <class S, int32_t I = 0, typename... Args>
56-
int32_t runKernel(krnlSetup&& setup, Args&&... args);
56+
void runKernel(krnlSetup&& setup, Args&&... args);
5757
template <class S, int32_t I = 0>
5858
const gpu_reconstruction_kernels::krnlProperties getKernelProperties()
5959
{
@@ -77,14 +77,14 @@ class GPUReconstructionCPU : public GPUReconstructionKernels<GPUReconstructionCP
7777

7878
GPUReconstructionCPU(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionKernels(cfg) {}
7979

80-
#define GPUCA_KRNL(x_class, attributes, x_arguments, x_forward, x_types) \
81-
inline int32_t runKernelImplWrapper(gpu_reconstruction_kernels::classArgument<GPUCA_M_KRNL_TEMPLATE(x_class)>, bool cpuFallback, double& timer, krnlSetup&& setup GPUCA_M_STRIP(x_arguments)) \
82-
{ \
83-
if (cpuFallback) { \
84-
return GPUReconstructionCPU::runKernelImpl(krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>(setup.x, setup.y, setup.z, timer GPUCA_M_STRIP(x_forward))); \
85-
} else { \
86-
return runKernelImpl(krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>(setup.x, setup.y, setup.z, timer GPUCA_M_STRIP(x_forward))); \
87-
} \
80+
#define GPUCA_KRNL(x_class, attributes, x_arguments, x_forward, x_types) \
81+
inline void runKernelImplWrapper(gpu_reconstruction_kernels::classArgument<GPUCA_M_KRNL_TEMPLATE(x_class)>, bool cpuFallback, double& timer, krnlSetup&& setup GPUCA_M_STRIP(x_arguments)) \
82+
{ \
83+
if (cpuFallback) { \
84+
GPUReconstructionCPU::runKernelImpl(krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>(setup.x, setup.y, setup.z, timer GPUCA_M_STRIP(x_forward))); \
85+
} else { \
86+
runKernelImpl(krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>(setup.x, setup.y, setup.z, timer GPUCA_M_STRIP(x_forward))); \
87+
} \
8888
}
8989
#include "GPUReconstructionKernelList.h"
9090
#undef GPUCA_KRNL
@@ -131,7 +131,7 @@ class GPUReconstructionCPU : public GPUReconstructionKernels<GPUReconstructionCP
131131
};
132132

133133
template <class S, int32_t I, typename... Args>
134-
inline int32_t GPUReconstructionCPU::runKernel(krnlSetup&& setup, Args&&... args)
134+
inline void GPUReconstructionCPU::runKernel(krnlSetup&& setup, Args&&... args)
135135
{
136136
HighResTimer* t = nullptr;
137137
GPUCA_RECO_STEP myStep = S::GetRecoStep() == GPUCA_RECO_STEP::NoRecoStep ? setup.x.step : S::GetRecoStep();
@@ -164,7 +164,7 @@ inline int32_t GPUReconstructionCPU::runKernel(krnlSetup&& setup, Args&&... args
164164
GPUInfo("Running kernel %s (Stream %d, Range %d/%d, Grid %d/%d) on %s", GetKernelName<S, I>(), stream, setup.y.start, setup.y.num, nBlocks, nThreads, cpuFallback == 2 ? "CPU (forced)" : cpuFallback ? "CPU (fallback)" : mDeviceName.c_str());
165165
}
166166
if (nThreads == 0 || nBlocks == 0) {
167-
return 0;
167+
return;
168168
}
169169
if (mProcessingSettings.debugLevel >= 1) {
170170
t = &getKernelTimer<S, I>(myStep, !IsGPU() || cpuFallback ? getHostThreadIndex() : stream);
@@ -173,7 +173,7 @@ inline int32_t GPUReconstructionCPU::runKernel(krnlSetup&& setup, Args&&... args
173173
}
174174
}
175175
double deviceTimerTime = 0.;
176-
int32_t retVal = runKernelImplWrapper(gpu_reconstruction_kernels::classArgument<S, I>(), cpuFallback, deviceTimerTime, std::forward<krnlSetup&&>(setup), std::forward<Args>(args)...);
176+
runKernelImplWrapper(gpu_reconstruction_kernels::classArgument<S, I>(), cpuFallback, deviceTimerTime, std::forward<krnlSetup&&>(setup), std::forward<Args>(args)...);
177177
if (GPUDebug(GetKernelName<S, I>(), stream, mProcessingSettings.serializeGPU & 1)) {
178178
throw std::runtime_error("kernel failure");
179179
}
@@ -192,7 +192,6 @@ inline int32_t GPUReconstructionCPU::runKernel(krnlSetup&& setup, Args&&... args
192192
throw std::runtime_error("kernel error code");
193193
}
194194
}
195-
return retVal;
196195
}
197196

198197
} // namespace o2::gpu

GPU/GPUTracking/Base/GPUReconstructionKernels.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ class GPUReconstructionKernels : public T
9999
using krnlSetupArgs = gpu_reconstruction_kernels::krnlSetupArgs<S, I, Args...>;
100100

101101
#define GPUCA_KRNL(x_class, attributes, x_arguments, x_forward, x_types) \
102-
virtual int32_t runKernelImpl(const krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>& args) \
102+
virtual void runKernelImpl(const krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>& args) \
103103
{ \
104-
return T::template runKernelBackend<GPUCA_M_KRNL_TEMPLATE(x_class)>(args); \
104+
T::template runKernelBackend<GPUCA_M_KRNL_TEMPLATE(x_class)>(args); \
105105
} \
106106
virtual gpu_reconstruction_kernels::krnlProperties getKernelPropertiesImpl(gpu_reconstruction_kernels::classArgument<GPUCA_M_KRNL_TEMPLATE(x_class)>) \
107107
{ \

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class GPUReconstructionCUDABackend : public GPUReconstructionDeviceBase
4242
void PrintKernelOccupancies() override;
4343

4444
template <class T, int32_t I = 0, typename... Args>
45-
int32_t runKernelBackend(const krnlSetupArgs<T, I, Args...>& args);
45+
void runKernelBackend(const krnlSetupArgs<T, I, Args...>& args);
4646
template <class T, int32_t I = 0, typename... Args>
4747
void runKernelBackendInternal(const krnlSetupTime& _xyz, const Args&... args);
4848
template <class T, int32_t I = 0>

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAKernels.cu

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ inline void GPUReconstructionCUDABackend::runKernelBackendInternal(const krnlSet
6767
}
6868

6969
template <class T, int32_t I, typename... Args>
70-
int32_t GPUReconstructionCUDABackend::runKernelBackend(const krnlSetupArgs<T, I, Args...>& args)
70+
void GPUReconstructionCUDABackend::runKernelBackend(const krnlSetupArgs<T, I, Args...>& args)
7171
{
7272
auto& x = args.s.x;
7373
auto& z = args.s.z;
@@ -84,7 +84,6 @@ int32_t GPUReconstructionCUDABackend::runKernelBackend(const krnlSetupArgs<T, I,
8484
if (z.ev) {
8585
GPUFailedMsg(cudaEventRecord(*(cudaEvent_t*)z.ev, mInternals->Streams[x.stream]));
8686
}
87-
return 0;
8887
}
8988

9089
#undef GPUCA_KRNL_REG
@@ -93,7 +92,7 @@ int32_t GPUReconstructionCUDABackend::runKernelBackend(const krnlSetupArgs<T, I,
9392
#if defined(GPUCA_KERNEL_COMPILE_MODE) && GPUCA_KERNEL_COMPILE_MODE == 1
9493
#define GPUCA_KRNL(x_class, x_attributes, x_arguments, x_forward, x_types) \
9594
GPUCA_KRNL_PROP(x_class, x_attributes) \
96-
template int32_t GPUReconstructionCUDABackend::runKernelBackend<GPUCA_M_KRNL_TEMPLATE(x_class)>(const krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>& args);
95+
template void GPUReconstructionCUDABackend::runKernelBackend<GPUCA_M_KRNL_TEMPLATE(x_class)>(const krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>& args);
9796
#else
9897
#if defined(GPUCA_KERNEL_COMPILE_MODE) && GPUCA_KERNEL_COMPILE_MODE == 2
9998
#define GPUCA_KRNL_DEFONLY
@@ -102,7 +101,7 @@ int32_t GPUReconstructionCUDABackend::runKernelBackend(const krnlSetupArgs<T, I,
102101
#define GPUCA_KRNL(x_class, x_attributes, x_arguments, x_forward, x_types) \
103102
GPUCA_KRNL_PROP(x_class, x_attributes) \
104103
GPUCA_KRNL_WRAP(GPUCA_KRNL_, x_class, x_attributes, x_arguments, x_forward, x_types) \
105-
template int32_t GPUReconstructionCUDABackend::runKernelBackend<GPUCA_M_KRNL_TEMPLATE(x_class)>(const krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>& args);
104+
template void GPUReconstructionCUDABackend::runKernelBackend<GPUCA_M_KRNL_TEMPLATE(x_class)>(const krnlSetupArgs<GPUCA_M_KRNL_TEMPLATE(x_class) GPUCA_M_STRIP(x_types)>& args);
106105
#ifndef __HIPCC__ // CUDA version
107106
#define GPUCA_KRNL_CALL_single(x_class, ...) \
108107
GPUCA_M_CAT(krnl_, GPUCA_M_KRNL_NAME(x_class))<<<x.nBlocks, x.nThreads, 0, me->mInternals->Streams[x.stream]>>>(GPUCA_CONSMEM_CALL y.start, args...);

GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,10 @@ int32_t GPUReconstructionOCLBackend::GPUDebug(const char* state, int32_t stream,
559559
}
560560

561561
template <class T, int32_t I, typename... Args>
562-
int32_t GPUReconstructionOCLBackend::runKernelBackend(const krnlSetupArgs<T, I, Args...>& args)
562+
void GPUReconstructionOCLBackend::runKernelBackend(const krnlSetupArgs<T, I, Args...>& args)
563563
{
564564
cl_kernel k = args.s.y.num > 1 ? getKernelObject<cl_kernel, T, I, true>() : getKernelObject<cl_kernel, T, I, false>();
565-
return std::apply([this, &args, &k](auto&... vals) { return runKernelBackendInternal(args.s, k, vals...); }, args.v);
565+
std::apply([this, &args, &k](auto&... vals) { runKernelBackendInternal(args.s, k, vals...); }, args.v);
566566
}
567567

568568
template <class S, class T, int32_t I, bool MULTI>

GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ class GPUReconstructionOCLBackend : public GPUReconstructionDeviceBase
6060
template <class T, int32_t I = 0>
6161
uint32_t FindKernel(int32_t num);
6262
template <typename K, typename... Args>
63-
int32_t runKernelBackendInternal(const krnlSetupTime& _xyz, K& k, const Args&... args);
63+
void runKernelBackendInternal(const krnlSetupTime& _xyz, K& k, const Args&... args);
6464
template <class T, int32_t I = 0>
6565
gpu_reconstruction_kernels::krnlProperties getKernelPropertiesBackend();
6666

6767
GPUReconstructionOCLInternals* mInternals;
6868
float mOclVersion;
6969

7070
template <class T, int32_t I = 0, typename... Args>
71-
int32_t runKernelBackend(const krnlSetupArgs<T, I, Args...>& args);
71+
void runKernelBackend(const krnlSetupArgs<T, I, Args...>& args);
7272
template <class S, class T, int32_t I, bool MULTI>
7373
S& getKernelObject();
7474

GPU/GPUTracking/Base/opencl/GPUReconstructionOCLInternals.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ struct GPUReconstructionOCLInternals {
171171
};
172172

173173
template <typename K, typename... Args>
174-
inline int32_t GPUReconstructionOCLBackend::runKernelBackendInternal(const krnlSetupTime& _xyz, K& k, const Args&... args)
174+
inline void GPUReconstructionOCLBackend::runKernelBackendInternal(const krnlSetupTime& _xyz, K& k, const Args&... args)
175175
{
176176
auto& x = _xyz.x;
177177
auto& y = _xyz.y;
@@ -202,7 +202,6 @@ inline int32_t GPUReconstructionOCLBackend::runKernelBackendInternal(const krnlS
202202
GPUFailedMsg(clReleaseEvent(ev));
203203
}
204204
}
205-
return 0;
206205
}
207206

208207
template <class T, int32_t I>

GPU/GPUTracking/Global/GPUChain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class GPUChain
171171
mRec->ReadStructFromFile<T>(file, obj);
172172
}
173173
template <class S, int32_t I = 0, typename... Args>
174-
inline int32_t runKernel(gpu_reconstruction_kernels::krnlSetup&& setup, Args&&... args)
174+
inline void runKernel(gpu_reconstruction_kernels::krnlSetup&& setup, Args&&... args)
175175
{
176176
return mRec->runKernel<S, I, Args...>(std::forward<gpu_reconstruction_kernels::krnlSetup&&>(setup), std::forward<Args>(args)...);
177177
}

0 commit comments

Comments
 (0)