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_AMD__) && !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,
112 hipStream_t stream __dparm(hipStreamPerThread));
113
114hipError_t hipMemset2D_spt(void* dst, size_t pitch, int value, size_t width, size_t height);
115
116hipError_t hipMemset2DAsync_spt(void* dst, size_t pitch, int value,
117 size_t width, size_t height,
118 hipStream_t stream __dparm(hipStreamPerThread));
119
120hipError_t hipMemset3DAsync_spt(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent,
121 hipStream_t stream __dparm(hipStreamPerThread));
122
123hipError_t hipMemset3D_spt(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent );
124
125hipError_t hipMemcpyAsync_spt(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind,
126 hipStream_t stream __dparm(hipStreamPerThread));
127
128hipError_t hipMemcpy3DAsync_spt(const hipMemcpy3DParms* p,
129 hipStream_t stream __dparm(hipStreamPerThread));
130
131hipError_t hipMemcpy2DAsync_spt(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width,
132 size_t height, hipMemcpyKind kind,
133 hipStream_t stream __dparm(hipStreamPerThread));
134
135hipError_t hipMemcpyFromSymbolAsync_spt(void* dst, const void* symbol, size_t sizeBytes,
136 size_t offset, hipMemcpyKind kind,
137 hipStream_t stream __dparm(hipStreamPerThread));
138
139hipError_t hipMemcpyToSymbolAsync_spt(const void* symbol, const void* src, size_t sizeBytes,
140 size_t offset, hipMemcpyKind kind,
141 hipStream_t stream __dparm(hipStreamPerThread));
142
143hipError_t hipMemcpyFromArray_spt(void* dst, hipArray_const_t src, size_t wOffsetSrc, size_t hOffset,
144 size_t count, hipMemcpyKind kind);
145
146hipError_t hipMemcpy2DToArray_spt(hipArray_t dst, size_t wOffset, size_t hOffset, const void* src,
147 size_t spitch, size_t width, size_t height, hipMemcpyKind kind);
148
149hipError_t hipMemcpy2DFromArrayAsync_spt(void* dst, size_t dpitch, hipArray_const_t src,
150 size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height,
151 hipMemcpyKind kind,
152 hipStream_t stream __dparm(hipStreamPerThread));
153
154hipError_t hipMemcpy2DToArrayAsync_spt(hipArray_t dst, size_t wOffset, size_t hOffset, const void* src,
155 size_t spitch, size_t width, size_t height, hipMemcpyKind kind,
156 hipStream_t stream __dparm(hipStreamPerThread));
157
158hipError_t hipStreamQuery_spt(hipStream_t stream);
159
160hipError_t hipStreamSynchronize_spt(hipStream_t stream);
161
162hipError_t hipStreamGetPriority_spt(hipStream_t stream, int* priority);
163
164hipError_t hipStreamWaitEvent_spt(hipStream_t stream, hipEvent_t event, unsigned int flags __dparm(0));
165
166hipError_t hipStreamGetFlags_spt(hipStream_t stream, unsigned int* flags);
167
168hipError_t hipStreamAddCallback_spt(hipStream_t stream, hipStreamCallback_t callback, void* userData,
169 unsigned int flags);
170
171hipError_t hipEventRecord_spt(hipEvent_t event, hipStream_t stream __dparm(hipStreamPerThread));
172
173hipError_t hipLaunchCooperativeKernel_spt(const void* f,
174 dim3 gridDim, dim3 blockDim,
175 void **kernelParams, uint32_t sharedMemBytes,
176 hipStream_t hStream __dparm(hipStreamPerThread));
177
178hipError_t hipLaunchKernel_spt(const void* function_address,
179 dim3 numBlocks,
180 dim3 dimBlocks,
181 void** args,
182 size_t sharedMemBytes, hipStream_t stream __dparm(hipStreamPerThread));
183
184hipError_t hipGraphLaunch_spt(hipGraphExec_t graphExec, hipStream_t stream);
185hipError_t hipStreamBeginCapture_spt(hipStream_t stream, hipStreamCaptureMode mode);
186hipError_t hipStreamEndCapture_spt(hipStream_t stream, hipGraph_t* pGraph);
187hipError_t hipStreamIsCapturing_spt(hipStream_t stream, hipStreamCaptureStatus* pCaptureStatus);
188hipError_t hipStreamGetCaptureInfo_spt(hipStream_t stream, hipStreamCaptureStatus* pCaptureStatus,
189 unsigned long long* pId);
190hipError_t hipStreamGetCaptureInfo_v2_spt(hipStream_t stream, hipStreamCaptureStatus* captureStatus_out,
191 unsigned long long* id_out, hipGraph_t* graph_out,
192 const hipGraphNode_t** dependencies_out,
193 size_t* numDependencies_out);
194hipError_t hipLaunchHostFunc_spt(hipStream_t stream, hipHostFn_t fn, void* userData);
195
196
197#ifdef __cplusplus
198}
199#endif // extern "C"
200
201#endif //defined(__HIP_PLATFORM_AMD__) && !defined(__HIP_PLATFORM_NVIDIA__)
202#endif //HIP_INCLUDE_HIP_HIP_RUNTIME_PT_API_H