FZGPUModules
2.0
GPU-accelerated modular compression pipelines
Loading...
Searching...
No Matches
api.h
Go to the documentation of this file.
1
#pragma once
2
34
#if defined(FZGMOD_BACKEND_HIP)
35
36
// The real HIP declarations must be visible *before* the macros below are
37
// defined, so that the macro bodies name already-declared entities.
38
#include <hip/hip_runtime.h>
39
#include <hip/hip_runtime_api.h>
40
41
// ── Hand-mapped: the five identifiers where HIP did not keep CUDA's spelling.
42
// Four are naming-convention drift (`DevAttr` → `DeviceAttribute`), one is a
43
// `_t` suffix CUDA omits.
44
#define cudaDeviceProp hipDeviceProp_t
45
#define cudaPointerAttributes hipPointerAttribute_t
46
#define cudaDevAttrMaxSharedMemoryPerBlock hipDeviceAttributeMaxSharedMemoryPerBlock
47
#define cudaDevAttrMaxSharedMemoryPerBlockOptin hipDeviceAttributeSharedMemPerBlockOptin
48
#define cudaDevAttrMultiProcessorCount hipDeviceAttributeMultiprocessorCount
49
50
// ── Handle types
51
#define cudaError_t hipError_t
52
#define cudaStream_t hipStream_t
53
#define cudaEvent_t hipEvent_t
54
#define cudaGraph_t hipGraph_t
55
#define cudaGraphExec_t hipGraphExec_t
56
#define cudaMemPool_t hipMemPool_t
57
#define cudaMemPoolProps hipMemPoolProps
58
#define cudaFuncAttribute hipFuncAttribute
59
#define cudaStreamCaptureStatus hipStreamCaptureStatus
60
61
// ── Error codes and error reporting
62
#define cudaSuccess hipSuccess
63
#define cudaErrorInvalidValue hipErrorInvalidValue
64
#define cudaErrorNoDevice hipErrorNoDevice
65
#define cudaErrorStreamCaptureUnsupported hipErrorStreamCaptureUnsupported
66
#define cudaGetErrorString hipGetErrorString
67
#define cudaGetErrorName hipGetErrorName
68
#define cudaGetLastError hipGetLastError
69
70
// ── Device management
71
#define cudaSetDevice hipSetDevice
72
#define cudaGetDevice hipGetDevice
73
#define cudaGetDeviceCount hipGetDeviceCount
74
#define cudaGetDeviceProperties hipGetDeviceProperties
75
#define cudaDeviceGetAttribute hipDeviceGetAttribute
76
#define cudaDeviceSynchronize hipDeviceSynchronize
77
#define cudaFuncSetAttribute hipFuncSetAttribute
78
#define cudaFuncAttributeMaxDynamicSharedMemorySize hipFuncAttributeMaxDynamicSharedMemorySize
79
#define cudaOccupancyMaxActiveBlocksPerMultiprocessor hipOccupancyMaxActiveBlocksPerMultiprocessor
80
#define cudaProfilerStart hipProfilerStart
81
82
// ── Plain allocation / transfer
83
#define cudaMalloc hipMalloc
84
#define cudaFree hipFree
85
#define cudaMallocHost hipHostMalloc
86
#define cudaHostAlloc hipHostAlloc
87
#define cudaHostAllocDefault hipHostAllocDefault
88
#define cudaFreeHost hipHostFree
89
#define cudaMemcpy hipMemcpy
90
#define cudaMemcpyAsync hipMemcpyAsync
91
#define cudaMemcpyHostToDevice hipMemcpyHostToDevice
92
#define cudaMemcpyDeviceToHost hipMemcpyDeviceToHost
93
#define cudaMemcpyDeviceToDevice hipMemcpyDeviceToDevice
94
#define cudaMemset hipMemset
95
#define cudaMemsetAsync hipMemsetAsync
96
#define cudaMemGetInfo hipMemGetInfo
97
#define cudaPointerGetAttributes hipPointerGetAttributes
98
#define cudaMemoryTypeDevice hipMemoryTypeDevice
99
#define cudaMemoryTypeHost hipMemoryTypeHost
100
101
// ── Stream-ordered allocation and memory pools
102
#define cudaMallocAsync hipMallocAsync
103
#define cudaFreeAsync hipFreeAsync
104
#define cudaMallocFromPoolAsync hipMallocFromPoolAsync
105
#define cudaMemPoolCreate hipMemPoolCreate
106
#define cudaMemPoolDestroy hipMemPoolDestroy
107
#define cudaMemPoolGetAttribute hipMemPoolGetAttribute
108
#define cudaMemPoolSetAttribute hipMemPoolSetAttribute
109
#define cudaMemPoolTrimTo hipMemPoolTrimTo
110
#define cudaMemPoolAttrReleaseThreshold hipMemPoolAttrReleaseThreshold
111
#define cudaMemPoolAttrReservedMemCurrent hipMemPoolAttrReservedMemCurrent
112
#define cudaMemPoolAttrReservedMemHigh hipMemPoolAttrReservedMemHigh
113
#define cudaMemPoolAttrUsedMemCurrent hipMemPoolAttrUsedMemCurrent
114
#define cudaMemPoolAttrUsedMemHigh hipMemPoolAttrUsedMemHigh
115
#define cudaMemPoolReuseAllowOpportunistic hipMemPoolReuseAllowOpportunistic
116
#define cudaMemPoolReuseAllowInternalDependencies hipMemPoolReuseAllowInternalDependencies
117
#define cudaMemPoolReuseFollowEventDependencies hipMemPoolReuseFollowEventDependencies
118
#define cudaMemAllocationTypePinned hipMemAllocationTypePinned
119
#define cudaMemLocationTypeDevice hipMemLocationTypeDevice
120
#define cudaMemHandleTypeNone hipMemHandleTypeNone
121
122
// ── Streams
123
#define cudaStreamCreate hipStreamCreate
124
#define cudaStreamCreateWithFlags hipStreamCreateWithFlags
125
#define cudaStreamDestroy hipStreamDestroy
126
#define cudaStreamSynchronize hipStreamSynchronize
127
#define cudaStreamWaitEvent hipStreamWaitEvent
128
#define cudaStreamDefault hipStreamDefault
129
#define cudaStreamNonBlocking hipStreamNonBlocking
130
#define cudaStreamLegacy hipStreamLegacy
131
132
// ── Events
133
#define cudaEventCreate hipEventCreate
134
#define cudaEventCreateWithFlags hipEventCreateWithFlags
135
#define cudaEventDestroy hipEventDestroy
136
#define cudaEventRecord hipEventRecord
137
#define cudaEventSynchronize hipEventSynchronize
138
#define cudaEventElapsedTime hipEventElapsedTime
139
#define cudaEventDefault hipEventDefault
140
#define cudaEventDisableTiming hipEventDisableTiming
141
142
// ── Graph capture
143
#define cudaStreamBeginCapture hipStreamBeginCapture
144
#define cudaStreamEndCapture hipStreamEndCapture
145
#define cudaStreamIsCapturing hipStreamIsCapturing
146
#define cudaStreamCaptureModeGlobal hipStreamCaptureModeGlobal
147
#define cudaStreamCaptureStatusNone hipStreamCaptureStatusNone
148
#define cudaGraphInstantiate hipGraphInstantiate
149
#define cudaGraphLaunch hipGraphLaunch
150
#define cudaGraphDestroy hipGraphDestroy
151
#define cudaGraphExecDestroy hipGraphExecDestroy
152
153
// Device-side unconditional abort. CUDA exposes this as the named intrinsic
154
// __trap(); HIP's clang only provides the compiler builtin __builtin_trap().
155
#define __trap() __builtin_trap()
156
157
#elif defined(FZGMOD_BACKEND_SYCL)
158
159
#error "FZGMOD_BACKEND=SYCL is not implemented yet"
160
161
#else
// FZGMOD_BACKEND_CUDA (default)
162
163
#include <cuda_runtime.h>
164
165
#endif
include
backend
api.h
Generated by
1.9.8