23 #ifndef HIP_INCLUDE_HIP_HIP_EXT_H
24 #define HIP_INCLUDE_HIP_HIP_EXT_H
25 #include "hip/hip_runtime.h"
26 #if defined(__cplusplus)
28 #include <type_traits>
61 hipError_t hipExtModuleLaunchKernel(
hipFunction_t f, uint32_t globalWorkSizeX,
62 uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
63 uint32_t localWorkSizeX, uint32_t localWorkSizeY,
64 uint32_t localWorkSizeZ,
size_t sharedMemBytes,
65 hipStream_t hStream,
void** kernelParams,
void** extra,
71 hipError_t hipHccModuleLaunchKernel(
hipFunction_t f, uint32_t globalWorkSizeX,
72 uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
73 uint32_t localWorkSizeX, uint32_t localWorkSizeY,
74 uint32_t localWorkSizeZ,
size_t sharedMemBytes,
75 hipStream_t hStream,
void** kernelParams,
void** extra,
78 __attribute__((deprecated("use hipExtModuleLaunchKernel instead")));
80 #if defined(__HIP_ROCclr__) && defined(__cplusplus)
82 extern "C" hipError_t hipExtLaunchKernel(
const void* function_address,
dim3 numBlocks,
83 dim3 dimBlocks,
void** args,
size_t sharedMemBytes,
87 template <
typename... Args,
typename F = void (*)(Args...)>
88 inline void hipExtLaunchKernelGGL(F kernel,
const dim3& numBlocks,
const dim3& dimBlocks,
92 constexpr
size_t count =
sizeof...(Args);
93 auto tup_ = std::tuple<Args...>{args...};
94 auto tup = validateArgsCountType(kernel, tup_);
98 auto k =
reinterpret_cast<void*
>(kernel);
99 hipExtLaunchKernel(k, numBlocks, dimBlocks, _Args, sharedMemBytes, stream, startEvent,
100 stopEvent, (
int)flags);
102 #elif defined(__HIP_PLATFORM_HCC__) && GENERIC_GRID_LAUNCH == 1 && defined(__HCC__)
107 __attribute__((visibility(
"hidden")))
108 void hipExtLaunchKernelGGLImpl(
109 std::uintptr_t function_address,
110 const
dim3& numBlocks,
111 const
dim3& dimBlocks,
112 std::uint32_t sharedMemBytes,
119 const auto& kd = hip_impl::get_program_state()
120 .kernel_descriptor(function_address, target_agent(stream));
122 hipExtModuleLaunchKernel(kd, numBlocks.x * dimBlocks.x,
123 numBlocks.y * dimBlocks.y,
124 numBlocks.z * dimBlocks.z,
125 dimBlocks.x, dimBlocks.y, dimBlocks.z,
126 sharedMemBytes, stream,
nullptr, kernarg,
127 startEvent, stopEvent, flags);
131 template <
typename... Args,
typename F = void (*)(Args...)>
133 void hipExtLaunchKernelGGL(F kernel,
const dim3& numBlocks,
134 const dim3& dimBlocks, std::uint32_t sharedMemBytes,
138 hip_impl::hip_init();
140 hip_impl::make_kernarg(kernel, std::tuple<Args...>{std::move(args)...});
141 std::size_t kernarg_size = kernarg.size();
144 HIP_LAUNCH_PARAM_BUFFER_POINTER,
146 HIP_LAUNCH_PARAM_BUFFER_SIZE,
148 HIP_LAUNCH_PARAM_END};
150 hip_impl::hipExtLaunchKernelGGLImpl(
reinterpret_cast<std::uintptr_t
>(kernel),
151 numBlocks, dimBlocks, sharedMemBytes,
152 stream, startEvent, stopEvent, flags,
155 #endif // !__HIP_ROCclr__ && defined(__cplusplus)
161 #endif // #iidef HIP_INCLUDE_HIP_HIP_EXT_H