include/hip/hip_ext.h Source File

include/hip/hip_ext.h Source File#

HIP Runtime API Reference: include/hip/hip_ext.h Source File
hip_ext.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7#ifndef HIP_INCLUDE_HIP_HIP_EXT_H
8#define HIP_INCLUDE_HIP_HIP_EXT_H
9#include "hip/hip_runtime.h"
10
11#if defined(__cplusplus)
12#include <tuple>
13#include <type_traits>
14#include <array>
15
16extern "C" {
17#endif
59 uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
60 uint32_t localWorkSizeX, uint32_t localWorkSizeY,
61 uint32_t localWorkSizeZ, size_t sharedMemBytes,
62 hipStream_t hStream, void** kernelParams, void** extra,
63 hipEvent_t startEvent __dparm(NULL),
64 hipEvent_t stopEvent __dparm(NULL), uint32_t flags __dparm(0));
69HIP_DEPRECATED("use hipExtModuleLaunchKernel instead")
71 uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
72 uint32_t localWorkSizeX, uint32_t localWorkSizeY,
73 uint32_t localWorkSizeZ, size_t sharedMemBytes,
74 hipStream_t hStream, void** kernelParams, void** extra,
75 hipEvent_t startEvent __dparm(NULL),
76 hipEvent_t stopEvent __dparm(NULL));
77
98hipError_t hipExtLaunchKernel(const void* function_address, dim3 numBlocks, dim3 dimBlocks,
99 void** args, size_t sharedMemBytes, hipStream_t stream,
100 hipEvent_t startEvent, hipEvent_t stopEvent, int flags);
101
102#if defined(__cplusplus)
103} // extern "C"
104
125template <typename... Args, typename F = void (*)(Args...)>
126inline void hipExtLaunchKernelGGL(F kernel, const dim3& numBlocks, const dim3& dimBlocks,
127 std::uint32_t sharedMemBytes, hipStream_t stream,
128 hipEvent_t startEvent, hipEvent_t stopEvent, std::uint32_t flags,
129 Args... args) {
130 validateArgs(kernel);
131 auto k = reinterpret_cast<void*>(kernel);
132
133 if constexpr (std::is_same_v<F, void (*)(Args...)>) {
134 std::array<void*, sizeof...(Args)> ptrArgsArr{static_cast<void*>(&args)...};
135 hipExtLaunchKernel(k, numBlocks, dimBlocks, ptrArgsArr.data(), sharedMemBytes, stream,
136 startEvent, stopEvent, (int)flags);
137 } else {
138 auto formals = validateArgsCountType(kernel, args...);
139 auto ptrArgsArr = pArgs(formals);
140 hipExtLaunchKernel(k, numBlocks, dimBlocks, ptrArgsArr.data(), sharedMemBytes, stream,
141 startEvent, stopEvent, (int)flags);
142 }
143}
144
145#endif // defined(__cplusplus)
146
147// doxygen end AMD-specific features
151#endif // #iidef HIP_INCLUDE_HIP_HIP_EXT_H
hipError_t hipHccModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX, uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ, uint32_t localWorkSizeX, uint32_t localWorkSizeY, uint32_t localWorkSizeZ, size_t sharedMemBytes, hipStream_t hStream, void **kernelParams, void **extra, hipEvent_t startEvent, hipEvent_t stopEvent)
This HIP API is deprecated, please use hipExtModuleLaunchKernel() instead.
hipError_t hipExtModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX, uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ, uint32_t localWorkSizeX, uint32_t localWorkSizeY, uint32_t localWorkSizeZ, size_t sharedMemBytes, hipStream_t hStream, void **kernelParams, void **extra, hipEvent_t startEvent, hipEvent_t stopEvent, uint32_t flags)
Launches kernel with parameters and shared memory on stream with arguments passed to kernel params or...
hipError_t hipExtLaunchKernel(const void *function_address, dim3 numBlocks, dim3 dimBlocks, void **args, size_t sharedMemBytes, hipStream_t stream, hipEvent_t startEvent, hipEvent_t stopEvent, int flags)
Launches kernel from the pointer address, with arguments and shared memory on stream.
void hipExtLaunchKernelGGL(F kernel, const dim3 &numBlocks, const dim3 &dimBlocks, std::uint32_t sharedMemBytes, hipStream_t stream, hipEvent_t startEvent, hipEvent_t stopEvent, std::uint32_t flags, Args... args)
Launches kernel with dimention parameters and shared memory on stream with templated kernel and argum...
Definition hip_ext.h:126
enum __HIP_NODISCARD hipError_t UINT32_BASE hipError_t
#define __dparm(x)
Definition hip_runtime_api.h:707
struct ihipStream_t * hipStream_t
Definition hip_runtime_api.h:799
struct ihipEvent_t * hipEvent_t
Definition hip_runtime_api.h:833
struct ihipModuleSymbol_t * hipFunction_t
Definition hip_runtime_api.h:812
#define HIP_DEPRECATED(msg)
Definition hip_runtime_api.h:696
Definition hip_runtime_api.h:1412