triton-windows 3.2.0.post11__cp39-cp39-win_amd64.whl → 3.3.0a0.post11__cp39-cp39-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of triton-windows might be problematic. Click here for more details.
- triton/_C/libtriton.pyd +0 -0
- triton/__init__.py +3 -3
- triton/_internal_testing.py +59 -4
- triton/_utils.py +35 -0
- triton/backends/amd/compiler.py +121 -74
- triton/backends/amd/driver.py +77 -43
- triton/backends/amd/include/hip/amd_detail/amd_device_functions.h +28 -49
- triton/backends/amd/include/hip/amd_detail/amd_hip_atomic.h +35 -9
- triton/backends/amd/include/hip/amd_detail/amd_hip_bf16.h +761 -284
- triton/backends/amd/include/hip/amd_detail/amd_hip_cooperative_groups.h +9 -3
- triton/backends/amd/include/hip/amd_detail/amd_hip_fp8.h +1391 -0
- triton/backends/amd/include/hip/amd_detail/amd_hip_gl_interop.h +3 -3
- triton/backends/amd/include/hip/amd_detail/amd_warp_functions.h +44 -0
- triton/backends/amd/include/hip/amd_detail/amd_warp_sync_functions.h +288 -0
- triton/backends/amd/include/hip/amd_detail/hip_api_trace.hpp +110 -14
- triton/backends/amd/include/hip/amd_detail/hip_prof_str.h +504 -103
- triton/backends/amd/include/hip/amd_detail/hip_runtime_prof.h +2 -1
- triton/backends/amd/include/hip/amd_detail/host_defines.h +4 -0
- triton/backends/amd/include/hip/hip_ext.h +4 -2
- triton/backends/amd/include/hip/hip_fp8.h +33 -0
- triton/backends/amd/include/hip/hip_runtime_api.h +375 -33
- triton/backends/amd/include/hip/hip_version.h +3 -3
- triton/backends/amd/include/hip/hiprtc.h +25 -25
- triton/backends/amd/include/hsa/amd_hsa_elf.h +40 -14
- triton/backends/amd/include/hsa/hsa.h +11 -2
- triton/backends/amd/include/hsa/hsa_api_trace.h +30 -17
- triton/backends/amd/include/hsa/hsa_api_trace_version.h +68 -0
- triton/backends/amd/include/hsa/hsa_ext_amd.h +83 -27
- triton/backends/amd/include/hsa/hsa_ven_amd_aqlprofile.h +46 -46
- triton/backends/amd/include/hsa/hsa_ven_amd_pc_sampling.h +416 -0
- triton/backends/amd/include/roctracer/hip_ostream_ops.h +84 -4
- triton/backends/amd/include/roctracer/hsa_ostream_ops.h +260 -0
- triton/backends/amd/include/roctracer/hsa_prof_str.h +51 -19
- triton/backends/amd/lib/asanrtl.bc +0 -0
- triton/backends/compiler.py +25 -225
- triton/backends/driver.py +7 -2
- triton/backends/nvidia/bin/ptxas.exe +0 -0
- triton/backends/nvidia/compiler.py +135 -90
- triton/backends/nvidia/driver.c +0 -1
- triton/backends/nvidia/driver.py +135 -49
- triton/backends/nvidia/include/cuda.h +2162 -241
- triton/backends/nvidia/lib/x64/cuda.lib +0 -0
- triton/compiler/__init__.py +2 -2
- triton/compiler/code_generator.py +334 -231
- triton/compiler/compiler.py +77 -66
- triton/language/__init__.py +22 -5
- triton/language/core.py +448 -74
- triton/language/extra/cuda/_experimental_tma.py +3 -5
- triton/language/math.py +1 -1
- triton/language/random.py +2 -1
- triton/language/semantic.py +206 -52
- triton/language/standard.py +35 -18
- triton/runtime/_allocation.py +32 -0
- triton/runtime/autotuner.py +27 -32
- triton/runtime/build.py +1 -48
- triton/runtime/cache.py +6 -6
- triton/runtime/errors.py +10 -0
- triton/runtime/interpreter.py +179 -45
- triton/runtime/jit.py +149 -190
- triton/testing.py +39 -11
- triton/tools/compile.py +27 -20
- triton/tools/{compile.c → extra/cuda/compile.c} +1 -0
- triton/tools/mxfp.py +301 -0
- {triton_windows-3.2.0.post11.dist-info → triton_windows-3.3.0a0.post11.dist-info}/METADATA +5 -2
- {triton_windows-3.2.0.post11.dist-info → triton_windows-3.3.0a0.post11.dist-info}/RECORD +68 -59
- {triton_windows-3.2.0.post11.dist-info → triton_windows-3.3.0a0.post11.dist-info}/top_level.txt +2 -0
- /triton/tools/{compile.h → extra/cuda/compile.h} +0 -0
- {triton_windows-3.2.0.post11.dist-info → triton_windows-3.3.0a0.post11.dist-info}/WHEEL +0 -0
|
@@ -50,7 +50,7 @@ typedef enum hipGLDeviceList {
|
|
|
50
50
|
typedef unsigned int GLuint;
|
|
51
51
|
/** GLenum as uint.*/
|
|
52
52
|
typedef unsigned int GLenum;
|
|
53
|
-
|
|
53
|
+
/**
|
|
54
54
|
* @}
|
|
55
55
|
*/
|
|
56
56
|
|
|
@@ -99,10 +99,10 @@ hipError_t hipGraphicsGLRegisterBuffer(hipGraphicsResource** resource, GLuint bu
|
|
|
99
99
|
*/
|
|
100
100
|
hipError_t hipGraphicsGLRegisterImage(hipGraphicsResource** resource, GLuint image,
|
|
101
101
|
GLenum target, unsigned int flags);
|
|
102
|
-
|
|
102
|
+
/**
|
|
103
103
|
* @}
|
|
104
104
|
*/
|
|
105
105
|
#if defined(__cplusplus)
|
|
106
106
|
}
|
|
107
107
|
#endif /* __cplusplus */
|
|
108
|
-
#endif /* HIP_INCLUDE_AMD_HIP_GL_INTEROP_H */
|
|
108
|
+
#endif /* HIP_INCLUDE_AMD_HIP_GL_INTEROP_H */
|
|
@@ -75,6 +75,50 @@ __device__ static inline int __hip_move_dpp_N(int src) {
|
|
|
75
75
|
|
|
76
76
|
static constexpr int warpSize = __AMDGCN_WAVEFRONT_SIZE;
|
|
77
77
|
|
|
78
|
+
// warp vote function __all __any __ballot
|
|
79
|
+
__device__
|
|
80
|
+
inline
|
|
81
|
+
int __all(int predicate) {
|
|
82
|
+
return __ockl_wfall_i32(predicate);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
__device__
|
|
86
|
+
inline
|
|
87
|
+
int __any(int predicate) {
|
|
88
|
+
return __ockl_wfany_i32(predicate);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// XXX from llvm/include/llvm/IR/InstrTypes.h
|
|
92
|
+
#define ICMP_NE 33
|
|
93
|
+
|
|
94
|
+
__device__
|
|
95
|
+
inline
|
|
96
|
+
unsigned long long int __ballot(int predicate) {
|
|
97
|
+
return __builtin_amdgcn_uicmp(predicate, 0, ICMP_NE);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
__device__
|
|
101
|
+
inline
|
|
102
|
+
unsigned long long int __ballot64(int predicate) {
|
|
103
|
+
return __builtin_amdgcn_uicmp(predicate, 0, ICMP_NE);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// See amd_warp_sync_functions.h for an explanation of this preprocessor flag.
|
|
107
|
+
#ifdef HIP_ENABLE_WARP_SYNC_BUILTINS
|
|
108
|
+
// Since threads in a wave do not make independent progress, __activemask()
|
|
109
|
+
// always returns the exact active mask, i.e, all active threads in the wave.
|
|
110
|
+
__device__
|
|
111
|
+
inline
|
|
112
|
+
unsigned long long __activemask() {
|
|
113
|
+
return __ballot(true);
|
|
114
|
+
}
|
|
115
|
+
#endif // HIP_ENABLE_WARP_SYNC_BUILTINS
|
|
116
|
+
|
|
117
|
+
__device__ static inline unsigned int __lane_id() {
|
|
118
|
+
return __builtin_amdgcn_mbcnt_hi(
|
|
119
|
+
-1, __builtin_amdgcn_mbcnt_lo(-1, 0));
|
|
120
|
+
}
|
|
121
|
+
|
|
78
122
|
__device__
|
|
79
123
|
inline
|
|
80
124
|
int __shfl(int var, int src_lane, int width = warpSize) {
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
#pragma once
|
|
24
|
+
|
|
25
|
+
// Warp sync builtins (with explicit mask argument) introduced in ROCm 6.2 as a
|
|
26
|
+
// preview to allow end-users to adapt to the new interface involving 64-bit
|
|
27
|
+
// masks. These are disabled by default, and can be enabled by setting the macro
|
|
28
|
+
// below. The builtins will be enabled unconditionally in ROCm 6.3.
|
|
29
|
+
//
|
|
30
|
+
// This arrangement also applies to the __activemask() builtin defined in
|
|
31
|
+
// amd_warp_functions.h.
|
|
32
|
+
#ifdef HIP_ENABLE_WARP_SYNC_BUILTINS
|
|
33
|
+
|
|
34
|
+
#if !defined(__HIPCC_RTC__)
|
|
35
|
+
#include "amd_warp_functions.h"
|
|
36
|
+
#include "hip_assert.h"
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
template <typename T>
|
|
40
|
+
__device__ inline
|
|
41
|
+
T __hip_readfirstlane(T val) {
|
|
42
|
+
// In theory, behaviour is undefined when reading from a union member other
|
|
43
|
+
// than the member that was last assigned to, but it works in practice because
|
|
44
|
+
// we rely on the compiler to do the reasonable thing.
|
|
45
|
+
union {
|
|
46
|
+
unsigned long long l;
|
|
47
|
+
T d;
|
|
48
|
+
} u;
|
|
49
|
+
u.d = val;
|
|
50
|
+
// NOTE: The builtin returns int, so we first cast it to unsigned int and only
|
|
51
|
+
// then extend it to 64 bits.
|
|
52
|
+
unsigned long long lower = (unsigned)__builtin_amdgcn_readfirstlane(u.l);
|
|
53
|
+
unsigned long long upper =
|
|
54
|
+
(unsigned)__builtin_amdgcn_readfirstlane(u.l >> 32);
|
|
55
|
+
u.l = (upper << 32) | lower;
|
|
56
|
+
return u.d;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// When compiling for wave32 mode, ignore the upper half of the 64-bit mask.
|
|
60
|
+
#define __hip_adjust_mask_for_wave32(MASK) \
|
|
61
|
+
do { \
|
|
62
|
+
if (warpSize == 32) MASK &= 0xFFFFFFFF; \
|
|
63
|
+
} while (0)
|
|
64
|
+
|
|
65
|
+
// We use a macro to expand each builtin into a waterfall that implements the
|
|
66
|
+
// mask semantics:
|
|
67
|
+
//
|
|
68
|
+
// 1. The mask argument may be divergent.
|
|
69
|
+
// 2. Each active thread must have its own bit set in its own mask value.
|
|
70
|
+
// 3. For a given mask value, all threads that are mentioned in the mask must
|
|
71
|
+
// execute the same static instance of the builtin with the same mask.
|
|
72
|
+
// 4. The union of all mask values supplied at a static instance must be equal
|
|
73
|
+
// to the activemask at the program point.
|
|
74
|
+
//
|
|
75
|
+
// Thus, the mask argument partitions the set of currently active threads in the
|
|
76
|
+
// wave into disjoint subsets that cover all active threads.
|
|
77
|
+
//
|
|
78
|
+
// Implementation notes:
|
|
79
|
+
// ---------------------
|
|
80
|
+
//
|
|
81
|
+
// We implement this as a waterfall loop that executes the builtin for each
|
|
82
|
+
// subset separately. The return value is a divergent value across the active
|
|
83
|
+
// threads. The value for inactive threads is defined by each builtin
|
|
84
|
+
// separately.
|
|
85
|
+
//
|
|
86
|
+
// As long as every mask value is non-zero, we don't need to check if a lane
|
|
87
|
+
// specifies itself in the mask; that is done by the later assertion where all
|
|
88
|
+
// chosen lanes must be in the chosen mask.
|
|
89
|
+
|
|
90
|
+
#define __hip_check_mask(MASK) \
|
|
91
|
+
do { \
|
|
92
|
+
__hip_assert(MASK && "mask must be non-zero"); \
|
|
93
|
+
bool done = false; \
|
|
94
|
+
while (__any(!done)) { \
|
|
95
|
+
if (!done) { \
|
|
96
|
+
auto chosen_mask = __hip_readfirstlane(MASK); \
|
|
97
|
+
if (MASK == chosen_mask) { \
|
|
98
|
+
__hip_assert(MASK == __ballot(true) && \
|
|
99
|
+
"all threads specified in the mask" \
|
|
100
|
+
" must execute the same operation with the same mask"); \
|
|
101
|
+
done = true; \
|
|
102
|
+
} \
|
|
103
|
+
} \
|
|
104
|
+
} \
|
|
105
|
+
} while(0)
|
|
106
|
+
|
|
107
|
+
#define __hip_do_sync(RETVAL, FUNC, MASK, ...) \
|
|
108
|
+
do { \
|
|
109
|
+
__hip_assert(MASK && "mask must be non-zero"); \
|
|
110
|
+
bool done = false; \
|
|
111
|
+
while (__any(!done)) { \
|
|
112
|
+
if (!done) { \
|
|
113
|
+
auto chosen_mask = __hip_readfirstlane(MASK); \
|
|
114
|
+
if (MASK == chosen_mask) { \
|
|
115
|
+
__hip_assert(MASK == __ballot(true) && \
|
|
116
|
+
"all threads specified in the mask" \
|
|
117
|
+
" must execute the same operation with the same mask"); \
|
|
118
|
+
RETVAL = FUNC(__VA_ARGS__); \
|
|
119
|
+
done = true; \
|
|
120
|
+
} \
|
|
121
|
+
} \
|
|
122
|
+
} \
|
|
123
|
+
} while(0)
|
|
124
|
+
|
|
125
|
+
// __all_sync, __any_sync, __ballot_sync
|
|
126
|
+
|
|
127
|
+
template <typename MaskT>
|
|
128
|
+
__device__ inline
|
|
129
|
+
unsigned long long __ballot_sync(MaskT mask, int predicate) {
|
|
130
|
+
static_assert(
|
|
131
|
+
__hip_internal::is_integral<MaskT>::value && sizeof(MaskT) == 8,
|
|
132
|
+
"The mask must be a 64-bit integer. "
|
|
133
|
+
"Implicitly promoting a smaller integer is almost always an error.");
|
|
134
|
+
__hip_adjust_mask_for_wave32(mask);
|
|
135
|
+
__hip_check_mask(mask);
|
|
136
|
+
return __ballot(predicate) & mask;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
template <typename MaskT>
|
|
140
|
+
__device__ inline
|
|
141
|
+
int __all_sync(MaskT mask, int predicate) {
|
|
142
|
+
static_assert(
|
|
143
|
+
__hip_internal::is_integral<MaskT>::value && sizeof(MaskT) == 8,
|
|
144
|
+
"The mask must be a 64-bit integer. "
|
|
145
|
+
"Implicitly promoting a smaller integer is almost always an error.");
|
|
146
|
+
__hip_adjust_mask_for_wave32(mask);
|
|
147
|
+
return __ballot_sync(mask, predicate) == mask;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
template <typename MaskT>
|
|
151
|
+
__device__ inline
|
|
152
|
+
int __any_sync(MaskT mask, int predicate) {
|
|
153
|
+
static_assert(
|
|
154
|
+
__hip_internal::is_integral<MaskT>::value && sizeof(MaskT) == 8,
|
|
155
|
+
"The mask must be a 64-bit integer. "
|
|
156
|
+
"Implicitly promoting a smaller integer is almost always an error.");
|
|
157
|
+
__hip_adjust_mask_for_wave32(mask);
|
|
158
|
+
return __ballot_sync(mask, predicate) != 0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// __match_any, __match_all and sync variants
|
|
162
|
+
|
|
163
|
+
template <typename T>
|
|
164
|
+
__device__ inline
|
|
165
|
+
unsigned long long __match_any(T value) {
|
|
166
|
+
static_assert(
|
|
167
|
+
(__hip_internal::is_integral<T>::value || __hip_internal::is_floating_point<T>::value) &&
|
|
168
|
+
(sizeof(T) == 4 || sizeof(T) == 8),
|
|
169
|
+
"T can be int, unsigned int, long, unsigned long, long long, unsigned "
|
|
170
|
+
"long long, float or double.");
|
|
171
|
+
bool done = false;
|
|
172
|
+
unsigned long long retval = 0;
|
|
173
|
+
|
|
174
|
+
while (__any(!done)) {
|
|
175
|
+
if (!done) {
|
|
176
|
+
T chosen = __hip_readfirstlane(value);
|
|
177
|
+
if (chosen == value) {
|
|
178
|
+
retval = __activemask();
|
|
179
|
+
done = true;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return retval;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
template <typename MaskT, typename T>
|
|
188
|
+
__device__ inline
|
|
189
|
+
unsigned long long __match_any_sync(MaskT mask, T value) {
|
|
190
|
+
static_assert(
|
|
191
|
+
__hip_internal::is_integral<MaskT>::value && sizeof(MaskT) == 8,
|
|
192
|
+
"The mask must be a 64-bit integer. "
|
|
193
|
+
"Implicitly promoting a smaller integer is almost always an error.");
|
|
194
|
+
__hip_adjust_mask_for_wave32(mask);
|
|
195
|
+
__hip_check_mask(mask);
|
|
196
|
+
return __match_any(value) & mask;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
template <typename T>
|
|
200
|
+
__device__ inline
|
|
201
|
+
unsigned long long __match_all(T value, int* pred) {
|
|
202
|
+
static_assert(
|
|
203
|
+
(__hip_internal::is_integral<T>::value || __hip_internal::is_floating_point<T>::value) &&
|
|
204
|
+
(sizeof(T) == 4 || sizeof(T) == 8),
|
|
205
|
+
"T can be int, unsigned int, long, unsigned long, long long, unsigned "
|
|
206
|
+
"long long, float or double.");
|
|
207
|
+
T first = __hip_readfirstlane(value);
|
|
208
|
+
if (__all(first == value)) {
|
|
209
|
+
*pred = true;
|
|
210
|
+
return __activemask();
|
|
211
|
+
} else {
|
|
212
|
+
*pred = false;
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
template <typename MaskT, typename T>
|
|
218
|
+
__device__ inline
|
|
219
|
+
unsigned long long __match_all_sync(MaskT mask, T value, int* pred) {
|
|
220
|
+
static_assert(
|
|
221
|
+
__hip_internal::is_integral<MaskT>::value && sizeof(MaskT) == 8,
|
|
222
|
+
"The mask must be a 64-bit integer. "
|
|
223
|
+
"Implicitly promoting a smaller integer is almost always an error.");
|
|
224
|
+
MaskT retval = 0;
|
|
225
|
+
__hip_adjust_mask_for_wave32(mask);
|
|
226
|
+
__hip_do_sync(retval, __match_all, mask, value, pred);
|
|
227
|
+
return retval;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// various variants of shfl
|
|
231
|
+
|
|
232
|
+
template <typename MaskT, typename T>
|
|
233
|
+
__device__ inline
|
|
234
|
+
T __shfl_sync(MaskT mask, T var, int srcLane,
|
|
235
|
+
int width = __AMDGCN_WAVEFRONT_SIZE) {
|
|
236
|
+
static_assert(
|
|
237
|
+
__hip_internal::is_integral<MaskT>::value && sizeof(MaskT) == 8,
|
|
238
|
+
"The mask must be a 64-bit integer. "
|
|
239
|
+
"Implicitly promoting a smaller integer is almost always an error.");
|
|
240
|
+
__hip_adjust_mask_for_wave32(mask);
|
|
241
|
+
__hip_check_mask(mask);
|
|
242
|
+
return __shfl(var, srcLane, width);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
template <typename MaskT, typename T>
|
|
246
|
+
__device__ inline
|
|
247
|
+
T __shfl_up_sync(MaskT mask, T var, unsigned int delta,
|
|
248
|
+
int width = __AMDGCN_WAVEFRONT_SIZE) {
|
|
249
|
+
static_assert(
|
|
250
|
+
__hip_internal::is_integral<MaskT>::value && sizeof(MaskT) == 8,
|
|
251
|
+
"The mask must be a 64-bit integer. "
|
|
252
|
+
"Implicitly promoting a smaller integer is almost always an error.");
|
|
253
|
+
__hip_adjust_mask_for_wave32(mask);
|
|
254
|
+
__hip_check_mask(mask);
|
|
255
|
+
return __shfl_up(var, delta, width);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
template <typename MaskT, typename T>
|
|
259
|
+
__device__ inline
|
|
260
|
+
T __shfl_down_sync(MaskT mask, T var, unsigned int delta,
|
|
261
|
+
int width = __AMDGCN_WAVEFRONT_SIZE) {
|
|
262
|
+
static_assert(
|
|
263
|
+
__hip_internal::is_integral<MaskT>::value && sizeof(MaskT) == 8,
|
|
264
|
+
"The mask must be a 64-bit integer. "
|
|
265
|
+
"Implicitly promoting a smaller integer is almost always an error.");
|
|
266
|
+
__hip_adjust_mask_for_wave32(mask);
|
|
267
|
+
__hip_check_mask(mask);
|
|
268
|
+
return __shfl_down(var, delta, width);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
template <typename MaskT, typename T>
|
|
272
|
+
__device__ inline
|
|
273
|
+
T __shfl_xor_sync(MaskT mask, T var, int laneMask,
|
|
274
|
+
int width = __AMDGCN_WAVEFRONT_SIZE) {
|
|
275
|
+
static_assert(
|
|
276
|
+
__hip_internal::is_integral<MaskT>::value && sizeof(MaskT) == 8,
|
|
277
|
+
"The mask must be a 64-bit integer. "
|
|
278
|
+
"Implicitly promoting a smaller integer is almost always an error.");
|
|
279
|
+
__hip_adjust_mask_for_wave32(mask);
|
|
280
|
+
__hip_check_mask(mask);
|
|
281
|
+
return __shfl_xor(var, laneMask, width);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
#undef __hip_do_sync
|
|
285
|
+
#undef __hip_check_mask
|
|
286
|
+
#undef __hip_adjust_mask_for_wave32
|
|
287
|
+
|
|
288
|
+
#endif // HIP_ENABLE_WARP_SYNC_BUILTINS
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
|
2
|
+
Copyright (c) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved.
|
|
3
3
|
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -23,6 +23,46 @@
|
|
|
23
23
|
|
|
24
24
|
#include <hip/hip_runtime.h>
|
|
25
25
|
|
|
26
|
+
// Define some version macros for the API table. Use similar naming conventions to HSA-runtime
|
|
27
|
+
// (MAJOR and STEP versions). Three groups at this time:
|
|
28
|
+
//
|
|
29
|
+
// (A) HIP_API_TABLE_* defines for versioning for API table structure
|
|
30
|
+
// (B) HIP_RUNTIME_API_TABLE_* defines for versioning the HipDispatchTable struct
|
|
31
|
+
// (C) HIP_COMPILER_API_TABLE_* defines for versioning the HipCompilerDispatchTable struct
|
|
32
|
+
//
|
|
33
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
34
|
+
//
|
|
35
|
+
// 1. When new functions are added to the API table, always add the new function pointer to the
|
|
36
|
+
// end of the table and increment the dispatch table's step version number. NEVER re-arrange
|
|
37
|
+
// the order of the member variables in a dispatch table. This will break the ABI.
|
|
38
|
+
// 2. In dire circumstances, if the type of an existing member variable in a dispatch
|
|
39
|
+
// table has be changed because a data type has been changed/removed, increment the dispatch
|
|
40
|
+
// table's major version number. If the function pointer type can no longer be declared, DO
|
|
41
|
+
// NOT REMOVE IT! Make the function pointer type void* and have it always be set to a nullptr.
|
|
42
|
+
//
|
|
43
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
44
|
+
//
|
|
45
|
+
// The major version number should (ideally) never need to be incremented.
|
|
46
|
+
// - Increment the HIP_API_TABLE_MAJOR_VERSION for fundamental changes to the API table structs.
|
|
47
|
+
// - Increment the HIP_RUNTIME_API_TABLE_MAJOR_VERSION for fundamental changes to the
|
|
48
|
+
// HipDispatchTable struct, such as a *change* to type/name an existing member variable. DO NOT
|
|
49
|
+
// REMOVE IT.
|
|
50
|
+
// - Increment the HIP_COMPILER_API_TABLE_MAJOR_VERSION for fundamental changes to the
|
|
51
|
+
// HipCompilerDispatchTable struct, such as a *change* to type/name an existing member variable.
|
|
52
|
+
// DO NOT REMOVE IT.
|
|
53
|
+
#define HIP_API_TABLE_MAJOR_VERSION 0
|
|
54
|
+
#define HIP_COMPILER_API_TABLE_MAJOR_VERSION 0
|
|
55
|
+
#define HIP_RUNTIME_API_TABLE_MAJOR_VERSION 0
|
|
56
|
+
|
|
57
|
+
// The step version number should be changed whenever the size of the API table struct(s) change.
|
|
58
|
+
// - Increment the HIP_API_TABLE_STEP_VERSION when/if new API table structs are added
|
|
59
|
+
// - Increment the HIP_RUNTIME_API_TABLE_STEP_VERSION when new runtime API functions are added
|
|
60
|
+
// - Increment the HIP_COMPILER_API_TABLE_STEP_VERSION when new compiler API functions are added
|
|
61
|
+
// - Reset any of the *_STEP_VERSION defines to zero if the corresponding *_MAJOR_VERSION increases
|
|
62
|
+
#define HIP_API_TABLE_STEP_VERSION 0
|
|
63
|
+
#define HIP_COMPILER_API_TABLE_STEP_VERSION 0
|
|
64
|
+
#define HIP_RUNTIME_API_TABLE_STEP_VERSION 3
|
|
65
|
+
|
|
26
66
|
// HIP API interface
|
|
27
67
|
typedef hipError_t (*t___hipPopCallConfiguration)(dim3* gridDim, dim3* blockDim, size_t* sharedMem,
|
|
28
68
|
hipStream_t* stream);
|
|
@@ -255,6 +295,7 @@ typedef hipError_t (*t_hipGraphAddMemsetNode)(hipGraphNode_t* pGraphNode, hipGra
|
|
|
255
295
|
const hipGraphNode_t* pDependencies,
|
|
256
296
|
size_t numDependencies,
|
|
257
297
|
const hipMemsetParams* pMemsetParams);
|
|
298
|
+
|
|
258
299
|
typedef hipError_t (*t_hipGraphChildGraphNodeGetGraph)(hipGraphNode_t node, hipGraph_t* pGraph);
|
|
259
300
|
typedef hipError_t (*t_hipGraphClone)(hipGraph_t* pGraphClone, hipGraph_t originalGraph);
|
|
260
301
|
typedef hipError_t (*t_hipGraphCreate)(hipGraph_t* pGraph, unsigned int flags);
|
|
@@ -866,28 +907,68 @@ typedef hipError_t (*t_hipHccModuleLaunchKernel)(hipFunction_t f, uint32_t globa
|
|
|
866
907
|
void** extra, hipEvent_t startEvent,
|
|
867
908
|
hipEvent_t stopEvent);
|
|
868
909
|
typedef int (*t_hipGetStreamDeviceId)(hipStream_t stream);
|
|
869
|
-
|
|
870
910
|
typedef hipError_t (*t_hipDrvGraphAddMemsetNode)(hipGraphNode_t* phGraphNode, hipGraph_t hGraph,
|
|
871
911
|
const hipGraphNode_t* dependencies, size_t numDependencies,
|
|
872
912
|
const HIP_MEMSET_NODE_PARAMS* memsetParams, hipCtx_t ctx);
|
|
873
|
-
typedef hipError_t (*t_hipGraphAddExternalSemaphoresWaitNode)(hipGraphNode_t* pGraphNode,
|
|
874
|
-
const hipGraphNode_t* pDependencies,
|
|
913
|
+
typedef hipError_t (*t_hipGraphAddExternalSemaphoresWaitNode)(hipGraphNode_t* pGraphNode,
|
|
914
|
+
hipGraph_t graph, const hipGraphNode_t* pDependencies,
|
|
915
|
+
size_t numDependencies,
|
|
875
916
|
const hipExternalSemaphoreWaitNodeParams* nodeParams);
|
|
876
|
-
typedef hipError_t (*t_hipGraphAddExternalSemaphoresSignalNode)(hipGraphNode_t* pGraphNode,
|
|
877
|
-
const hipGraphNode_t* pDependencies,
|
|
917
|
+
typedef hipError_t (*t_hipGraphAddExternalSemaphoresSignalNode)(hipGraphNode_t* pGraphNode,
|
|
918
|
+
hipGraph_t graph, const hipGraphNode_t* pDependencies,
|
|
919
|
+
size_t numDependencies,
|
|
878
920
|
const hipExternalSemaphoreSignalNodeParams* nodeParams);
|
|
879
921
|
typedef hipError_t (*t_hipGraphExternalSemaphoresSignalNodeSetParams)(hipGraphNode_t hNode,
|
|
880
|
-
|
|
922
|
+
const hipExternalSemaphoreSignalNodeParams* nodeParams);
|
|
881
923
|
typedef hipError_t (*t_hipGraphExternalSemaphoresWaitNodeSetParams)(hipGraphNode_t hNode,
|
|
882
|
-
|
|
924
|
+
const hipExternalSemaphoreWaitNodeParams* nodeParams);
|
|
883
925
|
typedef hipError_t (*t_hipGraphExternalSemaphoresSignalNodeGetParams)(hipGraphNode_t hNode,
|
|
884
|
-
|
|
926
|
+
hipExternalSemaphoreSignalNodeParams* params_out);
|
|
885
927
|
typedef hipError_t (*t_hipGraphExternalSemaphoresWaitNodeGetParams)(hipGraphNode_t hNode,
|
|
886
|
-
|
|
887
|
-
typedef hipError_t (*t_hipGraphExecExternalSemaphoresSignalNodeSetParams)(hipGraphExec_t hGraphExec,
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
928
|
+
hipExternalSemaphoreWaitNodeParams* params_out);
|
|
929
|
+
typedef hipError_t (*t_hipGraphExecExternalSemaphoresSignalNodeSetParams)(hipGraphExec_t hGraphExec,
|
|
930
|
+
hipGraphNode_t hNode,
|
|
931
|
+
const hipExternalSemaphoreSignalNodeParams* nodeParams);
|
|
932
|
+
typedef hipError_t (*t_hipGraphExecExternalSemaphoresWaitNodeSetParams)(hipGraphExec_t hGraphExec,
|
|
933
|
+
hipGraphNode_t hNode,
|
|
934
|
+
const hipExternalSemaphoreWaitNodeParams* nodeParams);
|
|
935
|
+
typedef hipError_t (*t_hipGraphAddNode)(hipGraphNode_t *pGraphNode, hipGraph_t graph,
|
|
936
|
+
const hipGraphNode_t *pDependencies, size_t numDependencies,
|
|
937
|
+
hipGraphNodeParams *nodeParams);
|
|
938
|
+
typedef hipError_t (*t_hipGraphInstantiateWithParams)(hipGraphExec_t* pGraphExec, hipGraph_t graph,
|
|
939
|
+
hipGraphInstantiateParams* instantiateParams);
|
|
940
|
+
typedef hipError_t (*t_hipExtGetLastError)();
|
|
941
|
+
typedef hipError_t (*t_hipTexRefGetBorderColor)(float* pBorderColor,
|
|
942
|
+
const textureReference* texRef);
|
|
943
|
+
typedef hipError_t (*t_hipTexRefGetArray)(hipArray_t* pArray, const textureReference* texRef);
|
|
944
|
+
|
|
945
|
+
typedef hipError_t (*t_hipTexRefGetBorderColor)(float* pBorderColor,
|
|
946
|
+
const textureReference* texRef);
|
|
947
|
+
typedef hipError_t (*t_hipTexRefGetArray)(hipArray_t* pArray, const textureReference* texRef);
|
|
948
|
+
typedef hipError_t (*t_hipGetProcAddress)(const char* symbol, void** pfn, int hipVersion, uint64_t flags,
|
|
949
|
+
hipDriverProcAddressQueryResult* symbolStatus);
|
|
950
|
+
typedef hipError_t (*t_hipStreamBeginCaptureToGraph)(hipStream_t stream, hipGraph_t graph,
|
|
951
|
+
const hipGraphNode_t* dependencies,
|
|
952
|
+
const hipGraphEdgeData* dependencyData,
|
|
953
|
+
size_t numDependencies,
|
|
954
|
+
hipStreamCaptureMode mode);
|
|
955
|
+
typedef hipError_t (*t_hipGetFuncBySymbol)(hipFunction_t* functionPtr, const void* symbolPtr);
|
|
956
|
+
typedef hipError_t (*t_hipSetValidDevices)(int* device_arr, int len);
|
|
957
|
+
typedef hipError_t (*t_hipMemcpyAtoD)(hipDeviceptr_t dstDevice, hipArray_t srcArray,
|
|
958
|
+
size_t srcOffset, size_t ByteCount);
|
|
959
|
+
typedef hipError_t (*t_hipMemcpyDtoA)(hipArray_t dstArray, size_t dstOffset,
|
|
960
|
+
hipDeviceptr_t srcDevice, size_t ByteCount);
|
|
961
|
+
typedef hipError_t (*t_hipMemcpyAtoA)(hipArray_t dstArray, size_t dstOffset, hipArray_t srcArray,
|
|
962
|
+
size_t srcOffset, size_t ByteCount);
|
|
963
|
+
typedef hipError_t (*t_hipMemcpyAtoHAsync)(void* dstHost, hipArray_t srcArray, size_t srcOffset,
|
|
964
|
+
size_t ByteCount, hipStream_t stream);
|
|
965
|
+
typedef hipError_t (*t_hipMemcpyHtoAAsync)(hipArray_t dstArray, size_t dstOffset,
|
|
966
|
+
const void* srcHost, size_t ByteCount,
|
|
967
|
+
hipStream_t stream);
|
|
968
|
+
typedef hipError_t (*t_hipMemcpy2DArrayToArray)(hipArray_t dst, size_t wOffsetDst,
|
|
969
|
+
size_t hOffsetDst, hipArray_const_t src,
|
|
970
|
+
size_t wOffsetSrc, size_t hOffsetSrc, size_t width,
|
|
971
|
+
size_t height, hipMemcpyKind kind);
|
|
891
972
|
|
|
892
973
|
// HIP Compiler dispatch table
|
|
893
974
|
struct HipCompilerDispatchTable {
|
|
@@ -1347,4 +1428,19 @@ struct HipDispatchTable {
|
|
|
1347
1428
|
t_hipGraphExternalSemaphoresWaitNodeGetParams hipGraphExternalSemaphoresWaitNodeGetParams_fn;
|
|
1348
1429
|
t_hipGraphExecExternalSemaphoresSignalNodeSetParams hipGraphExecExternalSemaphoresSignalNodeSetParams_fn;
|
|
1349
1430
|
t_hipGraphExecExternalSemaphoresWaitNodeSetParams hipGraphExecExternalSemaphoresWaitNodeSetParams_fn;
|
|
1431
|
+
t_hipGraphAddNode hipGraphAddNode_fn;
|
|
1432
|
+
t_hipGraphInstantiateWithParams hipGraphInstantiateWithParams_fn;
|
|
1433
|
+
t_hipExtGetLastError hipExtGetLastError_fn;
|
|
1434
|
+
t_hipTexRefGetBorderColor hipTexRefGetBorderColor_fn;
|
|
1435
|
+
t_hipTexRefGetArray hipTexRefGetArray_fn;
|
|
1436
|
+
t_hipGetProcAddress hipGetProcAddress_fn;
|
|
1437
|
+
t_hipStreamBeginCaptureToGraph hipStreamBeginCaptureToGraph_fn;
|
|
1438
|
+
t_hipGetFuncBySymbol hipGetFuncBySymbol_fn;
|
|
1439
|
+
t_hipSetValidDevices hipSetValidDevices_fn;
|
|
1440
|
+
t_hipMemcpyAtoD hipMemcpyAtoD_fn;
|
|
1441
|
+
t_hipMemcpyDtoA hipMemcpyDtoA_fn;
|
|
1442
|
+
t_hipMemcpyAtoA hipMemcpyAtoA_fn;
|
|
1443
|
+
t_hipMemcpyAtoHAsync hipMemcpyAtoHAsync_fn;
|
|
1444
|
+
t_hipMemcpyHtoAAsync hipMemcpyHtoAAsync_fn;
|
|
1445
|
+
t_hipMemcpy2DArrayToArray hipMemcpy2DArrayToArray_fn;
|
|
1350
1446
|
};
|