Skip to content

Commit 3fe271a

Browse files
committed
GPU: Drop hip ExtLaunchKernel for device timer support, can use same code path as CUDA
1 parent 7f9d10a commit 3fe271a

2 files changed

Lines changed: 5 additions & 30 deletions

File tree

GPU/GPUTracking/Base/GPUReconstructionKernelMacros.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
#define GPUCA_KRNL_CUSTOM(...)
4141
#endif
4242
#define GPUCA_KRNL_CUSTOM_INTERNAL_PROP(...)
43-
#ifndef GPUCA_KRNL_BACKEND_XARGS
44-
#define GPUCA_KRNL_BACKEND_XARGS
45-
#endif
4643
#define GPUCA_ATTRRES_REG(XX, reg, num, ...) GPUCA_M_EXPAND(GPUCA_M_CAT(GPUCA_KRNL_REG, XX))(num) GPUCA_ATTRRES2(XX, __VA_ARGS__)
4744
#define GPUCA_ATTRRES2_REG(XX, reg, num, ...) GPUCA_M_EXPAND(GPUCA_M_CAT(GPUCA_KRNL_REG, XX))(num) GPUCA_ATTRRES3(XX, __VA_ARGS__)
4845
#define GPUCA_ATTRRES_CUSTOM(XX, custom, args, ...) GPUCA_M_EXPAND(GPUCA_M_CAT(GPUCA_KRNL_CUSTOM, XX))(args) GPUCA_ATTRRES2(XX, __VA_ARGS__)
@@ -89,7 +86,7 @@
8986
template <> class GPUCA_KRNL_BACKEND_CLASS::backendInternal<GPUCA_M_KRNL_TEMPLATE(x_class)> { \
9087
public: \
9188
template <typename T, typename... Args> \
92-
static inline void runKernelBackendMacro(const krnlSetupTime& _xyz, T* me, GPUCA_KRNL_BACKEND_XARGS const Args&... args) \
89+
static inline void runKernelBackendMacro(const krnlSetupTime& _xyz, T* me, const Args&... args) \
9390
{ \
9491
auto& x = _xyz.x; \
9592
auto& y = _xyz.y;

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAKernels.cu

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ inline void GPUReconstructionCUDABackend::runKernelBackendInternal<GPUMemClean16
4242
template <class T, int I, typename... Args>
4343
inline void GPUReconstructionCUDABackend::runKernelBackendInternal(const krnlSetupTime& _xyz, const Args&... args)
4444
{
45-
#ifndef __HIPCC__ // CUDA version
4645
GPUDebugTiming timer(mProcessingSettings.deviceTimers && mProcessingSettings.debugLevel > 0, (deviceEvent*)mDebugEvents, mInternals->Streams, _xyz, this);
4746
#if !defined(GPUCA_KERNEL_COMPILE_MODE) || GPUCA_KERNEL_COMPILE_MODE != 1
4847
if (!mProcessingSettings.rtc.enable) {
@@ -67,17 +66,6 @@ inline void GPUReconstructionCUDABackend::runKernelBackendInternal(const krnlSet
6766
GPUFailedMsg(cuLaunchKernel(*mInternals->kernelFunctions[getRTCkernelNum<true, T, I>()], x.nBlocks, 1, 1, x.nThreads, 1, 1, 0, mInternals->Streams[x.stream], (void**)pArgs, nullptr));
6867
}
6968
}
70-
#else // HIP version
71-
if (mProcessingSettings.deviceTimers && mProcessingSettings.debugLevel > 0) {
72-
backendInternal<T, I>::runKernelBackendMacro(_xyz, this, mDebugEvents->DebugStart.getEventList<hipEvent_t>(), mDebugEvents->DebugStop.getEventList<hipEvent_t>(), args...);
73-
GPUFailedMsg(hipEventSynchronize(mDebugEvents->DebugStop.get<hipEvent_t>()));
74-
float v;
75-
GPUFailedMsg(hipEventElapsedTime(&v, mDebugEvents->DebugStart.get<hipEvent_t>(), mDebugEvents->DebugStop.get<hipEvent_t>()));
76-
_xyz.t = v * 1.e-3f;
77-
} else {
78-
backendInternal<T, I>::runKernelBackendMacro(_xyz, this, nullptr, nullptr, args...);
79-
}
80-
#endif
8169
}
8270

8371
template <class T, int I, typename... Args>
@@ -126,20 +114,10 @@ int GPUReconstructionCUDABackend::runKernelBackend(const krnlSetupArgs<T, I, Arg
126114
#else // HIP version
127115
#undef GPUCA_KRNL_CUSTOM
128116
#define GPUCA_KRNL_CUSTOM(args) GPUCA_M_STRIP(args)
129-
#undef GPUCA_KRNL_BACKEND_XARGS
130-
#define GPUCA_KRNL_BACKEND_XARGS hipEvent_t *debugStartEvent, hipEvent_t *debugStopEvent,
131-
#define GPUCA_KRNL_CALL_single(x_class, ...) \
132-
if (debugStartEvent == nullptr) { \
133-
hipLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT(krnl_, GPUCA_M_KRNL_NAME(x_class))), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], GPUCA_CONSMEM_CALL y.start, args...); \
134-
} else { \
135-
hipExtLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT(krnl_, GPUCA_M_KRNL_NAME(x_class))), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], *debugStartEvent, *debugStopEvent, 0, GPUCA_CONSMEM_CALL y.start, args...); \
136-
}
137-
#define GPUCA_KRNL_CALL_multi(x_class, ...) \
138-
if (debugStartEvent == nullptr) { \
139-
hipLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT3(krnl_, GPUCA_M_KRNL_NAME(x_class), _multi)), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], GPUCA_CONSMEM_CALL y.start, y.num, args...); \
140-
} else { \
141-
hipExtLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT3(krnl_, GPUCA_M_KRNL_NAME(x_class), _multi)), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], *debugStartEvent, *debugStopEvent, 0, GPUCA_CONSMEM_CALL y.start, y.num, args...); \
142-
}
117+
#define GPUCA_KRNL_CALL_single(x_class, ...) \
118+
hipLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT(krnl_, GPUCA_M_KRNL_NAME(x_class))), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], GPUCA_CONSMEM_CALL y.start, args...);
119+
#define GPUCA_KRNL_CALL_multi(x_class, ...) \
120+
hipLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT3(krnl_, GPUCA_M_KRNL_NAME(x_class), _multi)), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], GPUCA_CONSMEM_CALL y.start, y.num, args...);
143121
#endif // __HIPCC__
144122
#endif
145123

0 commit comments

Comments
 (0)