SWDEV-523281 - Adds hipLaunchKernelEx C++ wrapper (#44)

此提交包含在:
Betigeri, Sourabh authored and GitHub committed 2025-04-07 09:24:01 +05:30
1 父節點 e4f1c126ad
當前提交 3998c11287
1 file changed
+22
+22
查看文件
@@ -9805,6 +9805,28 @@ static inline hipError_t hipMallocFromPoolAsync(
hipStream_t stream) {
return hipMallocFromPoolAsync(reinterpret_cast<void**>(dev_ptr), size, mem_pool, stream);
}
/**
* @brief Launches a HIP kernel using the specified configuration.
* @ingroup Execution
*
* This function dispatches the provided kernel with the given launch configuration and forwards the
* kernel arguments.
*
* @param [in] config Pointer to the kernel launch configuration structure.
* @param [in] kernel Pointer to the device kernel function to be launched.
* @param [in] args Variadic list of arguments to be passed to the kernel.
*
* @returns #hipSuccess if the kernel is launched successfully, otherwise an appropriate error code.
*/
template <typename... KernelArgs, typename... Params>
static inline __host__ hipError_t hipLaunchKernelEx(const hipLaunchConfig_t* config,
void (*kernel)(KernelArgs...),
Params&&... args) {
return [&](KernelArgs... convertedArgs) {
void* pArgs[] = {&convertedArgs...};
return ::hipLaunchKernelExC(config, reinterpret_cast<void*>(kernel), pArgs);
}(std::forward<Params>(args)...);
}
/**
* @}
*/