HIP: Heterogenous-computing Interface for Portability
Loading...
Searching...
No Matches
amd_hip_runtime_pt_api.h
1/*
2Copyright (c) 2022 - Present Advanced Micro Devices, Inc. All rights reserved.
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20THE SOFTWARE.
21*/
22
23#pragma once
24
25#ifndef HIP_INCLUDE_HIP_HIP_RUNTIME_PT_API_H
26#define HIP_INCLUDE_HIP_HIP_RUNTIME_PT_API_H
27
28#if (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
29
31#if defined(HIP_API_PER_THREAD_DEFAULT_STREAM)
32 #define __HIP_STREAM_PER_THREAD
33 #define __HIP_API_SPT(api) api ## _spt
34#else
35 #define __HIP_API_SPT(api) api
36#endif
37
38#if defined(__HIP_STREAM_PER_THREAD)
39 // Memory APIs
40 #define hipMemcpy __HIP_API_SPT(hipMemcpy)
41 #define hipMemcpyToSymbol __HIP_API_SPT(hipMemcpyToSymbol)
42 #define hipMemcpyFromSymbol __HIP_API_SPT(hipMemcpyFromSymbol)
43 #define hipMemcpy2D __HIP_API_SPT(hipMemcpy2D)
44 #define hipMemcpy2DFromArray __HIP_API_SPT(hipMemcpy2DFromArray)
45 #define hipMemcpy3D __HIP_API_SPT(hipMemcpy3D)
46 #define hipMemset __HIP_API_SPT(hipMemset)
47 #define hipMemset2D __HIP_API_SPT(hipMemset2D)
48 #define hipMemset3D __HIP_API_SPT(hipMemset3D)
49 #define hipMemcpyAsync __HIP_API_SPT(hipMemcpyAsync)
50 #define hipMemset3DAsync __HIP_API_SPT(hipMemset3DAsync)
51 #define hipMemset2DAsync __HIP_API_SPT(hipMemset2DAsync)
52 #define hipMemsetAsync __HIP_API_SPT(hipMemsetAsync)
53 #define hipMemcpy3DAsync __HIP_API_SPT(hipMemcpy3DAsync)
54 #define hipMemcpy2DAsync __HIP_API_SPT(hipMemcpy2DAsync)
55 #define hipMemcpyFromSymbolAsync __HIP_API_SPT(hipMemcpyFromSymbolAsync)
56 #define hipMemcpyToSymbolAsync __HIP_API_SPT(hipMemcpyToSymbolAsync)
57 #define hipMemcpyFromArray __HIP_API_SPT(hipMemcpyFromArray)
58 #define hipMemcpy2DToArray __HIP_API_SPT(hipMemcpy2DToArray)
59 #define hipMemcpy2DFromArrayAsync __HIP_API_SPT(hipMemcpy2DFromArrayAsync)
60 #define hipMemcpy2DToArrayAsync __HIP_API_SPT(hipMemcpy2DToArrayAsync)
61
62 // Stream APIs
63 #define hipStreamSynchronize __HIP_API_SPT(hipStreamSynchronize)
64 #define hipStreamQuery __HIP_API_SPT(hipStreamQuery)
65 #define hipStreamGetFlags __HIP_API_SPT(hipStreamGetFlags)
66 #define hipStreamGetPriority __HIP_API_SPT(hipStreamGetPriority)
67 #define hipStreamWaitEvent __HIP_API_SPT(hipStreamWaitEvent)
68 #define hipStreamAddCallback __HIP_API_SPT(hipStreamAddCallback)
69 #define hipLaunchHostFunc __HIP_API_SPT(hipLaunchHostFunc)
70
71 // Event APIs
72 #define hipEventRecord __HIP_API_SPT(hipEventRecord)
73
74 // Launch APIs
75 #define hipLaunchKernel __HIP_API_SPT(hipLaunchKernel)
76 #define hipLaunchCooperativeKernel __HIP_API_SPT(hipLaunchCooperativeKernel)
77
78 // Graph APIs
79 #define hipGraphLaunch __HIP_API_SPT(hipGraphLaunch)
80 #define hipStreamBeginCapture __HIP_API_SPT(hipStreamBeginCapture)
81 #define hipStreamEndCapture __HIP_API_SPT(hipStreamEndCapture)
82 #define hipStreamIsCapturing __HIP_API_SPT(hipStreamIsCapturing)
83 #define hipStreamGetCaptureInfo __HIP_API_SPT(hipStreamGetCaptureInfo)
84 #define hipStreamGetCaptureInfo_v2 __HIP_API_SPT(hipStreamGetCaptureInfo_v2)
85#endif
86
87#ifdef __cplusplus
88extern "C" {
89#endif
90
91hipError_t hipMemcpy_spt(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind);
92
93hipError_t hipMemcpyToSymbol_spt(const void* symbol, const void* src, size_t sizeBytes,
94 size_t offset __dparm(0),
95 hipMemcpyKind kind __dparm(hipMemcpyHostToDevice));
96
97hipError_t hipMemcpyFromSymbol_spt(void* dst, const void* symbol,size_t sizeBytes,
98 size_t offset __dparm(0),
99 hipMemcpyKind kind __dparm(hipMemcpyDeviceToHost));
100
101hipError_t hipMemcpy2D_spt(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width,
102 size_t height, hipMemcpyKind kind);
103
104hipError_t hipMemcpy2DFromArray_spt( void* dst, size_t dpitch, hipArray_const_t src, size_t wOffset,
105 size_t hOffset, size_t width, size_t height, hipMemcpyKind kind);
106
107hipError_t hipMemcpy3D_spt(const struct hipMemcpy3DParms* p);
108
109hipError_t hipMemset_spt(void* dst, int value, size_t sizeBytes);
110
111hipError_t hipMemsetAsync_spt(void* dst, int value, size_t sizeBytes, hipStream_t stream);
112
113hipError_t hipMemset2D_spt(void* dst, size_t pitch, int value, size_t width, size_t height);
114
115hipError_t hipMemset2DAsync_spt(void* dst, size_t pitch, int value,
116 size_t width, size_t height, hipStream_t stream);
117
118hipError_t hipMemset3DAsync_spt(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent, hipStream_t stream);
119
120hipError_t hipMemset3D_spt(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent );
121
122hipError_t hipMemcpyAsync_spt(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind,
123 hipStream_t stream);
124
125hipError_t hipMemcpy3DAsync_spt(const hipMemcpy3DParms* p, hipStream_t stream);
126
127hipError_t hipMemcpy2DAsync_spt(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width,
128 size_t height, hipMemcpyKind kind, hipStream_t stream);
129
130hipError_t hipMemcpyFromSymbolAsync_spt(void* dst, const void* symbol, size_t sizeBytes,
131 size_t offset, hipMemcpyKind kind, hipStream_t stream);
132
133hipError_t hipMemcpyToSymbolAsync_spt(const void* symbol, const void* src, size_t sizeBytes,
134 size_t offset, hipMemcpyKind kind, hipStream_t stream);
135
136hipError_t hipMemcpyFromArray_spt(void* dst, hipArray_const_t src, size_t wOffsetSrc, size_t hOffset,
137 size_t count, hipMemcpyKind kind);
138
139hipError_t hipMemcpy2DToArray_spt(hipArray* dst, size_t wOffset, size_t hOffset, const void* src,
140 size_t spitch, size_t width, size_t height, hipMemcpyKind kind);
141
142hipError_t hipMemcpy2DFromArrayAsync_spt(void* dst, size_t dpitch, hipArray_const_t src,
143 size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height,
144 hipMemcpyKind kind, hipStream_t stream);
145
146hipError_t hipMemcpy2DToArrayAsync_spt(hipArray* dst, size_t wOffset, size_t hOffset, const void* src,
147 size_t spitch, size_t width, size_t height, hipMemcpyKind kind,
148 hipStream_t stream);
149
150hipError_t hipStreamQuery_spt(hipStream_t stream);
151
152hipError_t hipStreamSynchronize_spt(hipStream_t stream);
153
154hipError_t hipStreamGetPriority_spt(hipStream_t stream, int* priority);
155
156hipError_t hipStreamWaitEvent_spt(hipStream_t stream, hipEvent_t event, unsigned int flags);
157
158hipError_t hipStreamGetFlags_spt(hipStream_t stream, unsigned int* flags);
159
160hipError_t hipStreamAddCallback_spt(hipStream_t stream, hipStreamCallback_t callback, void* userData,
161 unsigned int flags);
162#ifdef __cplusplus
163hipError_t hipEventRecord_spt(hipEvent_t event, hipStream_t stream = NULL);
164#else
165hipError_t hipEventRecord_spt(hipEvent_t event, hipStream_t stream);
166#endif
167
168hipError_t hipLaunchCooperativeKernel_spt(const void* f,
169 dim3 gridDim, dim3 blockDim,
170 void **kernelParams, uint32_t sharedMemBytes, hipStream_t hStream);
171
172hipError_t hipLaunchKernel_spt(const void* function_address,
173 dim3 numBlocks,
174 dim3 dimBlocks,
175 void** args,
176 size_t sharedMemBytes, hipStream_t stream);
177
178hipError_t hipGraphLaunch_spt(hipGraphExec_t graphExec, hipStream_t stream);
179hipError_t hipStreamBeginCapture_spt(hipStream_t stream, hipStreamCaptureMode mode);
180hipError_t hipStreamEndCapture_spt(hipStream_t stream, hipGraph_t* pGraph);
181hipError_t hipStreamIsCapturing_spt(hipStream_t stream, hipStreamCaptureStatus* pCaptureStatus);
182hipError_t hipStreamGetCaptureInfo_spt(hipStream_t stream, hipStreamCaptureStatus* pCaptureStatus,
183 unsigned long long* pId);
184hipError_t hipStreamGetCaptureInfo_v2_spt(hipStream_t stream, hipStreamCaptureStatus* captureStatus_out,
185 unsigned long long* id_out, hipGraph_t* graph_out,
186 const hipGraphNode_t** dependencies_out,
187 size_t* numDependencies_out);
188hipError_t hipLaunchHostFunc_spt(hipStream_t stream, hipHostFn_t fn, void* userData);
189
190
191#ifdef __cplusplus
192}
193#endif // extern "C"
194
195#endif //(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
196#endif //HIP_INCLUDE_HIP_HIP_RUNTIME_PT_API_H