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#if defined(__cplusplus)
11#include <tuple>
12#include <type_traits>
13#include <array>
14#endif
56extern "C" hipError_t hipExtModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
57 uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
58 uint32_t localWorkSizeX, uint32_t localWorkSizeY,
59 uint32_t localWorkSizeZ, size_t sharedMemBytes,
60 hipStream_t hStream, void** kernelParams,
61 void** extra, hipEvent_t startEvent __dparm(NULL),
62 hipEvent_t stopEvent __dparm(NULL),
63 uint32_t flags __dparm(0));
68HIP_DEPRECATED("use hipExtModuleLaunchKernel instead")
70extern "C" hipError_t hipHccModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
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,
75 void** extra, hipEvent_t startEvent __dparm(NULL),
76 hipEvent_t stopEvent __dparm(NULL));
77
78#if defined(__cplusplus)
79
100extern "C" hipError_t hipExtLaunchKernel(const void* function_address, dim3 numBlocks,
101 dim3 dimBlocks, void** args, size_t sharedMemBytes,
102 hipStream_t stream, hipEvent_t startEvent,
103 hipEvent_t stopEvent, int flags);
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
#define __dparm(x)
Definition hip_runtime_api.h:659
struct ihipStream_t * hipStream_t
Definition hip_runtime_api.h:691
struct ihipEvent_t * hipEvent_t
Definition hip_runtime_api.h:722
enum __HIP_NODISCARD hipError_t hipError_t
Definition hip_runtime_api.h:289
struct ihipModuleSymbol_t * hipFunction_t
Definition hip_runtime_api.h:701
#define HIP_DEPRECATED(msg)
Definition hip_runtime_api.h:649
#define HIP_PUBLIC_API
Definition hip_common.h:45
Definition hip_runtime_api.h:1298