9b9c826520fd08d9962ee28d9b886fba1300c200
[platform/upstream/gcc.git] / libgomp / plugin / hsa.h
1 /* HSA runtime API 1.0.1 representation description.
2    Copyright (C) 2016-2017 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
10
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
19
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23 <http://www.gnu.org/licenses/>.
24
25 The contents of the file was created by extracting data structures, enum,
26 typedef and other definitions from HSA Runtime Programmer’s Reference Manual
27 Version 1.0 (http://www.hsafoundation.com/standards/).
28
29 HTML version is provided on the following link:
30 http://www.hsafoundation.com/html/Content/Runtime/Topics/Runtime_title_page.htm
31 */
32
33 #ifndef _HSA_H
34 #define _HSA_H 1
35
36 #define HSA_LARGE_MODEL 1
37
38 typedef struct hsa_signal_s { uint64_t handle; } hsa_signal_t;
39 typedef enum {
40   HSA_QUEUE_TYPE_MULTI = 0,
41   HSA_QUEUE_TYPE_SINGLE = 1
42 } hsa_queue_type_t;
43
44 typedef enum { HSA_PROFILE_BASE = 0, HSA_PROFILE_FULL = 1 } hsa_profile_t;
45 typedef struct hsa_region_s { uint64_t handle; } hsa_region_t;
46 typedef enum {
47   HSA_EXECUTABLE_SYMBOL_INFO_TYPE = 0,
48   HSA_EXECUTABLE_SYMBOL_INFO_NAME_LENGTH = 1,
49   HSA_EXECUTABLE_SYMBOL_INFO_NAME = 2,
50   HSA_EXECUTABLE_SYMBOL_INFO_MODULE_NAME_LENGTH = 3,
51   HSA_EXECUTABLE_SYMBOL_INFO_MODULE_NAME = 4,
52   HSA_EXECUTABLE_SYMBOL_INFO_AGENT = 20,
53   HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ADDRESS = 21,
54   HSA_EXECUTABLE_SYMBOL_INFO_LINKAGE = 5,
55   HSA_EXECUTABLE_SYMBOL_INFO_IS_DEFINITION = 17,
56   HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ALLOCATION = 6,
57   HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_SEGMENT = 7,
58   HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ALIGNMENT = 8,
59   HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_SIZE = 9,
60   HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_IS_CONST = 10,
61   HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_OBJECT = 22,
62   HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_SIZE = 11,
63   HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_ALIGNMENT = 12,
64   HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_GROUP_SEGMENT_SIZE = 13,
65   HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_PRIVATE_SEGMENT_SIZE = 14,
66   HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_DYNAMIC_CALLSTACK = 15,
67   HSA_EXECUTABLE_SYMBOL_INFO_INDIRECT_FUNCTION_OBJECT = 23,
68   HSA_EXECUTABLE_SYMBOL_INFO_INDIRECT_FUNCTION_CALL_CONVENTION = 16
69 } hsa_executable_symbol_info_t;
70 typedef enum {
71   HSA_REGION_GLOBAL_FLAG_KERNARG = 1,
72   HSA_REGION_GLOBAL_FLAG_FINE_GRAINED = 2,
73   HSA_REGION_GLOBAL_FLAG_COARSE_GRAINED = 4
74 } hsa_region_global_flag_t;
75 typedef struct hsa_code_object_s { uint64_t handle; } hsa_code_object_t;
76 typedef enum {
77   HSA_KERNEL_DISPATCH_PACKET_SETUP_WIDTH_DIMENSIONS = 2
78 } hsa_kernel_dispatch_packet_setup_width_t;
79 typedef enum {
80   HSA_DEVICE_TYPE_CPU = 0,
81   HSA_DEVICE_TYPE_GPU = 1,
82   HSA_DEVICE_TYPE_DSP = 2
83 } hsa_device_type_t;
84 typedef enum {
85   HSA_STATUS_SUCCESS = 0x0,
86   HSA_STATUS_INFO_BREAK = 0x1,
87   HSA_STATUS_ERROR = 0x1000,
88   HSA_STATUS_ERROR_INVALID_ARGUMENT = 0x1001,
89   HSA_STATUS_ERROR_INVALID_QUEUE_CREATION = 0x1002,
90   HSA_STATUS_ERROR_INVALID_ALLOCATION = 0x1003,
91   HSA_STATUS_ERROR_INVALID_AGENT = 0x1004,
92   HSA_STATUS_ERROR_INVALID_REGION = 0x1005,
93   HSA_STATUS_ERROR_INVALID_SIGNAL = 0x1006,
94   HSA_STATUS_ERROR_INVALID_QUEUE = 0x1007,
95   HSA_STATUS_ERROR_OUT_OF_RESOURCES = 0x1008,
96   HSA_STATUS_ERROR_INVALID_PACKET_FORMAT = 0x1009,
97   HSA_STATUS_ERROR_RESOURCE_FREE = 0x100A,
98   HSA_STATUS_ERROR_NOT_INITIALIZED = 0x100B,
99   HSA_STATUS_ERROR_REFCOUNT_OVERFLOW = 0x100C,
100   HSA_STATUS_ERROR_INCOMPATIBLE_ARGUMENTS = 0x100D,
101   HSA_STATUS_ERROR_INVALID_INDEX = 0x100E,
102   HSA_STATUS_ERROR_INVALID_ISA = 0x100F,
103   HSA_STATUS_ERROR_INVALID_ISA_NAME = 0x1017,
104   HSA_STATUS_ERROR_INVALID_CODE_OBJECT = 0x1010,
105   HSA_STATUS_ERROR_INVALID_EXECUTABLE = 0x1011,
106   HSA_STATUS_ERROR_FROZEN_EXECUTABLE = 0x1012,
107   HSA_STATUS_ERROR_INVALID_SYMBOL_NAME = 0x1013,
108   HSA_STATUS_ERROR_VARIABLE_ALREADY_DEFINED = 0x1014,
109   HSA_STATUS_ERROR_VARIABLE_UNDEFINED = 0x1015,
110   HSA_STATUS_ERROR_EXCEPTION = 0x1016
111 } hsa_status_t;
112 typedef enum {
113   HSA_EXTENSION_FINALIZER = 0,
114   HSA_EXTENSION_IMAGES = 1
115 } hsa_extension_t;
116 typedef struct hsa_queue_s {
117   hsa_queue_type_t type;
118   uint32_t features;
119
120 #ifdef HSA_LARGE_MODEL
121   void *base_address;
122 #elif defined HSA_LITTLE_ENDIAN
123   void *base_address;
124   uint32_t reserved0;
125 #else
126   uint32_t reserved0;
127   void *base_address;
128 #endif
129
130   hsa_signal_t doorbell_signal;
131   uint32_t size;
132   uint32_t reserved1;
133   uint64_t id;
134 } hsa_queue_t;
135 typedef struct hsa_agent_dispatch_packet_s {
136   uint16_t header;
137   uint16_t type;
138   uint32_t reserved0;
139
140 #ifdef HSA_LARGE_MODEL
141   void *return_address;
142 #elif defined HSA_LITTLE_ENDIAN
143   void *return_address;
144   uint32_t reserved1;
145 #else
146   uint32_t reserved1;
147   void *return_address;
148 #endif
149   uint64_t arg[4];
150   uint64_t reserved2;
151   hsa_signal_t completion_signal;
152 } hsa_agent_dispatch_packet_t;
153 typedef enum {
154   HSA_CODE_SYMBOL_INFO_TYPE = 0,
155   HSA_CODE_SYMBOL_INFO_NAME_LENGTH = 1,
156   HSA_CODE_SYMBOL_INFO_NAME = 2,
157   HSA_CODE_SYMBOL_INFO_MODULE_NAME_LENGTH = 3,
158   HSA_CODE_SYMBOL_INFO_MODULE_NAME = 4,
159   HSA_CODE_SYMBOL_INFO_LINKAGE = 5,
160   HSA_CODE_SYMBOL_INFO_IS_DEFINITION = 17,
161   HSA_CODE_SYMBOL_INFO_VARIABLE_ALLOCATION = 6,
162   HSA_CODE_SYMBOL_INFO_VARIABLE_SEGMENT = 7,
163   HSA_CODE_SYMBOL_INFO_VARIABLE_ALIGNMENT = 8,
164   HSA_CODE_SYMBOL_INFO_VARIABLE_SIZE = 9,
165   HSA_CODE_SYMBOL_INFO_VARIABLE_IS_CONST = 10,
166   HSA_CODE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_SIZE = 11,
167   HSA_CODE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_ALIGNMENT = 12,
168   HSA_CODE_SYMBOL_INFO_KERNEL_GROUP_SEGMENT_SIZE = 13,
169   HSA_CODE_SYMBOL_INFO_KERNEL_PRIVATE_SEGMENT_SIZE = 14,
170   HSA_CODE_SYMBOL_INFO_KERNEL_DYNAMIC_CALLSTACK = 15,
171   HSA_CODE_SYMBOL_INFO_INDIRECT_FUNCTION_CALL_CONVENTION = 16
172 } hsa_code_symbol_info_t;
173 typedef enum {
174   HSA_QUEUE_FEATURE_KERNEL_DISPATCH = 1,
175   HSA_QUEUE_FEATURE_AGENT_DISPATCH = 2
176 } hsa_queue_feature_t;
177 typedef enum {
178   HSA_VARIABLE_ALLOCATION_AGENT = 0,
179   HSA_VARIABLE_ALLOCATION_PROGRAM = 1
180 } hsa_variable_allocation_t;
181 typedef enum {
182   HSA_FENCE_SCOPE_NONE = 0,
183   HSA_FENCE_SCOPE_AGENT = 1,
184   HSA_FENCE_SCOPE_SYSTEM = 2
185 } hsa_fence_scope_t;
186 typedef struct hsa_agent_s { uint64_t handle; } hsa_agent_t;
187 typedef enum { HSA_CODE_OBJECT_TYPE_PROGRAM = 0 } hsa_code_object_type_t;
188 typedef enum {
189   HSA_SIGNAL_CONDITION_EQ = 0,
190   HSA_SIGNAL_CONDITION_NE = 1,
191   HSA_SIGNAL_CONDITION_LT = 2,
192   HSA_SIGNAL_CONDITION_GTE = 3
193 } hsa_signal_condition_t;
194 typedef enum {
195   HSA_EXECUTABLE_STATE_UNFROZEN = 0,
196   HSA_EXECUTABLE_STATE_FROZEN = 1
197 } hsa_executable_state_t;
198 typedef enum {
199   HSA_ENDIANNESS_LITTLE = 0,
200   HSA_ENDIANNESS_BIG = 1
201 } hsa_endianness_t;
202 typedef enum {
203   HSA_MACHINE_MODEL_SMALL = 0,
204   HSA_MACHINE_MODEL_LARGE = 1
205 } hsa_machine_model_t;
206 typedef enum {
207   HSA_AGENT_INFO_NAME = 0,
208   HSA_AGENT_INFO_VENDOR_NAME = 1,
209   HSA_AGENT_INFO_FEATURE = 2,
210   HSA_AGENT_INFO_MACHINE_MODEL = 3,
211   HSA_AGENT_INFO_PROFILE = 4,
212   HSA_AGENT_INFO_DEFAULT_FLOAT_ROUNDING_MODE = 5,
213   HSA_AGENT_INFO_BASE_PROFILE_DEFAULT_FLOAT_ROUNDING_MODES = 23,
214   HSA_AGENT_INFO_FAST_F16_OPERATION = 24,
215   HSA_AGENT_INFO_WAVEFRONT_SIZE = 6,
216   HSA_AGENT_INFO_WORKGROUP_MAX_DIM = 7,
217   HSA_AGENT_INFO_WORKGROUP_MAX_SIZE = 8,
218   HSA_AGENT_INFO_GRID_MAX_DIM = 9,
219   HSA_AGENT_INFO_GRID_MAX_SIZE = 10,
220   HSA_AGENT_INFO_FBARRIER_MAX_SIZE = 11,
221   HSA_AGENT_INFO_QUEUES_MAX = 12,
222   HSA_AGENT_INFO_QUEUE_MIN_SIZE = 13,
223   HSA_AGENT_INFO_QUEUE_MAX_SIZE = 14,
224   HSA_AGENT_INFO_QUEUE_TYPE = 15,
225   HSA_AGENT_INFO_NODE = 16,
226   HSA_AGENT_INFO_DEVICE = 17,
227   HSA_AGENT_INFO_CACHE_SIZE = 18,
228   HSA_AGENT_INFO_ISA = 19,
229   HSA_AGENT_INFO_EXTENSIONS = 20,
230   HSA_AGENT_INFO_VERSION_MAJOR = 21,
231   HSA_AGENT_INFO_VERSION_MINOR = 22
232 } hsa_agent_info_t;
233 typedef struct hsa_barrier_and_packet_s {
234   uint16_t header;
235   uint16_t reserved0;
236   uint32_t reserved1;
237   hsa_signal_t dep_signal[5];
238   uint64_t reserved2;
239   hsa_signal_t completion_signal;
240 } hsa_barrier_and_packet_t;
241 typedef struct hsa_dim3_s {
242   uint32_t x;
243   uint32_t y;
244   uint32_t z;
245 } hsa_dim3_t;
246 typedef enum {
247   HSA_ACCESS_PERMISSION_RO = 1,
248   HSA_ACCESS_PERMISSION_WO = 2,
249   HSA_ACCESS_PERMISSION_RW = 3
250 } hsa_access_permission_t;
251 typedef enum {
252   HSA_AGENT_FEATURE_KERNEL_DISPATCH = 1,
253   HSA_AGENT_FEATURE_AGENT_DISPATCH = 2
254 } hsa_agent_feature_t;
255 typedef enum {
256   HSA_WAIT_STATE_BLOCKED = 0,
257   HSA_WAIT_STATE_ACTIVE = 1
258 } hsa_wait_state_t;
259 typedef struct hsa_executable_s { uint64_t handle; } hsa_executable_t;
260 typedef enum {
261   HSA_REGION_SEGMENT_GLOBAL = 0,
262   HSA_REGION_SEGMENT_READONLY = 1,
263   HSA_REGION_SEGMENT_PRIVATE = 2,
264   HSA_REGION_SEGMENT_GROUP = 3
265 } hsa_region_segment_t;
266 typedef enum {
267   HSA_REGION_INFO_SEGMENT = 0,
268   HSA_REGION_INFO_GLOBAL_FLAGS = 1,
269   HSA_REGION_INFO_SIZE = 2,
270   HSA_REGION_INFO_ALLOC_MAX_SIZE = 4,
271   HSA_REGION_INFO_RUNTIME_ALLOC_ALLOWED = 5,
272   HSA_REGION_INFO_RUNTIME_ALLOC_GRANULE = 6,
273   HSA_REGION_INFO_RUNTIME_ALLOC_ALIGNMENT = 7
274 } hsa_region_info_t;
275 typedef enum {
276   HSA_ISA_INFO_NAME_LENGTH = 0,
277   HSA_ISA_INFO_NAME = 1,
278   HSA_ISA_INFO_CALL_CONVENTION_COUNT = 2,
279   HSA_ISA_INFO_CALL_CONVENTION_INFO_WAVEFRONT_SIZE = 3,
280   HSA_ISA_INFO_CALL_CONVENTION_INFO_WAVEFRONTS_PER_COMPUTE_UNIT = 4
281 } hsa_isa_info_t;
282 typedef enum {
283   HSA_VARIABLE_SEGMENT_GLOBAL = 0,
284   HSA_VARIABLE_SEGMENT_READONLY = 1
285 } hsa_variable_segment_t;
286 typedef struct hsa_callback_data_s { uint64_t handle; } hsa_callback_data_t;
287 typedef enum {
288   HSA_SYMBOL_KIND_VARIABLE = 0,
289   HSA_SYMBOL_KIND_KERNEL = 1,
290   HSA_SYMBOL_KIND_INDIRECT_FUNCTION = 2
291 } hsa_symbol_kind_t;
292 typedef struct hsa_kernel_dispatch_packet_s {
293   uint16_t header;
294   uint16_t setup;
295   uint16_t workgroup_size_x;
296   uint16_t workgroup_size_y;
297   uint16_t workgroup_size_z;
298   uint16_t reserved0;
299   uint32_t grid_size_x;
300   uint32_t grid_size_y;
301   uint32_t grid_size_z;
302   uint32_t private_segment_size;
303   uint32_t group_segment_size;
304   uint64_t kernel_object;
305
306 #ifdef HSA_LARGE_MODEL
307   void *kernarg_address;
308 #elif defined HSA_LITTLE_ENDIAN
309   void *kernarg_address;
310   uint32_t reserved1;
311 #else
312   uint32_t reserved1;
313   void *kernarg_address;
314 #endif
315   uint64_t reserved2;
316   hsa_signal_t completion_signal;
317 } hsa_kernel_dispatch_packet_t;
318 typedef enum {
319   HSA_PACKET_TYPE_VENDOR_SPECIFIC = 0,
320   HSA_PACKET_TYPE_INVALID = 1,
321   HSA_PACKET_TYPE_KERNEL_DISPATCH = 2,
322   HSA_PACKET_TYPE_BARRIER_AND = 3,
323   HSA_PACKET_TYPE_AGENT_DISPATCH = 4,
324   HSA_PACKET_TYPE_BARRIER_OR = 5
325 } hsa_packet_type_t;
326 typedef enum {
327   HSA_PACKET_HEADER_TYPE = 0,
328   HSA_PACKET_HEADER_BARRIER = 8,
329   HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE = 9,
330   HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE = 11
331 } hsa_packet_header_t;
332 typedef struct hsa_isa_s { uint64_t handle; } hsa_isa_t;
333 typedef enum {
334   HSA_DEFAULT_FLOAT_ROUNDING_MODE_DEFAULT = 0,
335   HSA_DEFAULT_FLOAT_ROUNDING_MODE_ZERO = 1,
336   HSA_DEFAULT_FLOAT_ROUNDING_MODE_NEAR = 2
337 } hsa_default_float_rounding_mode_t;
338 typedef struct hsa_code_symbol_s { uint64_t handle; } hsa_code_symbol_t;
339 typedef struct hsa_executable_symbol_s {
340   uint64_t handle;
341 } hsa_executable_symbol_t;
342 #ifdef HSA_LARGE_MODEL
343 typedef int64_t hsa_signal_value_t;
344 #else
345 typedef int32_t hsa_signal_value_t;
346 #endif
347 typedef enum {
348   HSA_EXCEPTION_POLICY_BREAK = 1,
349   HSA_EXCEPTION_POLICY_DETECT = 2
350 } hsa_exception_policy_t;
351 typedef enum {
352   HSA_SYSTEM_INFO_VERSION_MAJOR = 0,
353   HSA_SYSTEM_INFO_VERSION_MINOR = 1,
354   HSA_SYSTEM_INFO_TIMESTAMP = 2,
355   HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY = 3,
356   HSA_SYSTEM_INFO_SIGNAL_MAX_WAIT = 4,
357   HSA_SYSTEM_INFO_ENDIANNESS = 5,
358   HSA_SYSTEM_INFO_MACHINE_MODEL = 6,
359   HSA_SYSTEM_INFO_EXTENSIONS = 7
360 } hsa_system_info_t;
361 typedef enum {
362   HSA_EXECUTABLE_INFO_PROFILE = 1,
363   HSA_EXECUTABLE_INFO_STATE = 2
364 } hsa_executable_info_t;
365 typedef enum {
366   HSA_KERNEL_DISPATCH_PACKET_SETUP_DIMENSIONS = 0
367 } hsa_kernel_dispatch_packet_setup_t;
368 typedef enum {
369   HSA_PACKET_HEADER_WIDTH_TYPE = 8,
370   HSA_PACKET_HEADER_WIDTH_BARRIER = 1,
371   HSA_PACKET_HEADER_WIDTH_ACQUIRE_FENCE_SCOPE = 2,
372   HSA_PACKET_HEADER_WIDTH_RELEASE_FENCE_SCOPE = 2
373 } hsa_packet_header_width_t;
374 typedef enum {
375   HSA_CODE_OBJECT_INFO_VERSION = 0,
376   HSA_CODE_OBJECT_INFO_TYPE = 1,
377   HSA_CODE_OBJECT_INFO_ISA = 2,
378   HSA_CODE_OBJECT_INFO_MACHINE_MODEL = 3,
379   HSA_CODE_OBJECT_INFO_PROFILE = 4,
380   HSA_CODE_OBJECT_INFO_DEFAULT_FLOAT_ROUNDING_MODE = 5
381 } hsa_code_object_info_t;
382 typedef struct hsa_barrier_or_packet_s {
383   uint16_t header;
384   uint16_t reserved0;
385   uint32_t reserved1;
386   hsa_signal_t dep_signal[5];
387   uint64_t reserved2;
388   hsa_signal_t completion_signal;
389 } hsa_barrier_or_packet_t;
390 typedef enum {
391   HSA_SYMBOL_KIND_LINKAGE_MODULE = 0,
392   HSA_SYMBOL_KIND_LINKAGE_PROGRAM = 1,
393 } hsa_symbol_kind_linkage_t;
394 hsa_status_t hsa_executable_validate(hsa_executable_t executable,
395                                      uint32_t *result);
396 uint64_t hsa_queue_add_write_index_acq_rel(const hsa_queue_t *queue,
397                                            uint64_t value);
398
399 uint64_t hsa_queue_add_write_index_acquire(const hsa_queue_t *queue,
400                                            uint64_t value);
401
402 uint64_t hsa_queue_add_write_index_relaxed(const hsa_queue_t *queue,
403                                            uint64_t value);
404
405 uint64_t hsa_queue_add_write_index_release(const hsa_queue_t *queue,
406                                            uint64_t value);
407 hsa_status_t hsa_shut_down();
408 void hsa_signal_add_acq_rel(hsa_signal_t signal, hsa_signal_value_t value);
409
410 void hsa_signal_add_acquire(hsa_signal_t signal, hsa_signal_value_t value);
411
412 void hsa_signal_add_relaxed(hsa_signal_t signal, hsa_signal_value_t value);
413
414 void hsa_signal_add_release(hsa_signal_t signal, hsa_signal_value_t value);
415 hsa_status_t hsa_executable_readonly_variable_define(
416     hsa_executable_t executable, hsa_agent_t agent, const char *variable_name,
417     void *address);
418 hsa_status_t hsa_agent_extension_supported(uint16_t extension,
419                                            hsa_agent_t agent,
420                                            uint16_t version_major,
421                                            uint16_t version_minor,
422                                            bool *result);
423 hsa_signal_value_t hsa_signal_load_acquire(hsa_signal_t signal);
424
425 hsa_signal_value_t hsa_signal_load_relaxed(hsa_signal_t signal);
426 hsa_status_t hsa_executable_get_info(hsa_executable_t executable,
427                                      hsa_executable_info_t attribute,
428                                      void *value);
429 hsa_status_t hsa_iterate_agents(hsa_status_t (*callback)(hsa_agent_t agent,
430                                                          void *data),
431                                 void *data);
432 void hsa_signal_subtract_acq_rel(hsa_signal_t signal, hsa_signal_value_t value);
433
434 void hsa_signal_subtract_acquire(hsa_signal_t signal, hsa_signal_value_t value);
435
436 void hsa_signal_subtract_relaxed(hsa_signal_t signal, hsa_signal_value_t value);
437
438 void hsa_signal_subtract_release(hsa_signal_t signal, hsa_signal_value_t value);
439 hsa_status_t
440 hsa_executable_symbol_get_info(hsa_executable_symbol_t executable_symbol,
441                                hsa_executable_symbol_info_t attribute,
442                                void *value);
443 void hsa_signal_xor_acq_rel(hsa_signal_t signal, hsa_signal_value_t value);
444
445 void hsa_signal_xor_acquire(hsa_signal_t signal, hsa_signal_value_t value);
446
447 void hsa_signal_xor_relaxed(hsa_signal_t signal, hsa_signal_value_t value);
448
449 void hsa_signal_xor_release(hsa_signal_t signal, hsa_signal_value_t value);
450 hsa_status_t hsa_code_object_get_info(hsa_code_object_t code_object,
451                                       hsa_code_object_info_t attribute,
452                                       void *value);
453 hsa_status_t hsa_code_object_deserialize(void *serialized_code_object,
454                                          size_t serialized_code_object_size,
455                                          const char *options,
456                                          hsa_code_object_t *code_object);
457 hsa_status_t hsa_status_string(hsa_status_t status, const char **status_string);
458 hsa_status_t hsa_code_object_get_symbol(hsa_code_object_t code_object,
459                                         const char *symbol_name,
460                                         hsa_code_symbol_t *symbol);
461 void hsa_signal_store_relaxed(hsa_signal_t signal, hsa_signal_value_t value);
462
463 void hsa_signal_store_release(hsa_signal_t signal, hsa_signal_value_t value);
464 hsa_status_t hsa_signal_destroy(hsa_signal_t signal);
465 hsa_status_t hsa_system_get_extension_table(uint16_t extension,
466                                             uint16_t version_major,
467                                             uint16_t version_minor,
468                                             void *table);
469 hsa_status_t hsa_agent_iterate_regions(
470     hsa_agent_t agent,
471     hsa_status_t (*callback)(hsa_region_t region, void *data), void *data);
472 hsa_status_t hsa_executable_agent_global_variable_define(
473     hsa_executable_t executable, hsa_agent_t agent, const char *variable_name,
474     void *address);
475 hsa_status_t hsa_queue_create(hsa_agent_t agent, uint32_t size,
476                               hsa_queue_type_t type,
477                               void (*callback)(hsa_status_t status,
478                                                hsa_queue_t *source, void *data),
479                               void *data, uint32_t private_segment_size,
480                               uint32_t group_segment_size, hsa_queue_t **queue);
481 hsa_status_t hsa_isa_compatible(hsa_isa_t code_object_isa, hsa_isa_t agent_isa,
482                                 bool *result);
483 hsa_status_t hsa_code_object_serialize(
484     hsa_code_object_t code_object,
485     hsa_status_t (*alloc_callback)(size_t size, hsa_callback_data_t data,
486                                    void **address),
487     hsa_callback_data_t callback_data, const char *options,
488     void **serialized_code_object, size_t *serialized_code_object_size);
489 hsa_status_t hsa_region_get_info(hsa_region_t region,
490                                  hsa_region_info_t attribute, void *value);
491 hsa_status_t hsa_executable_freeze(hsa_extension_t executable,
492                                    const char *options);
493 hsa_status_t hsa_system_extension_supported(uint16_t extension,
494                                             uint16_t version_major,
495                                             uint16_t version_minor,
496                                             bool *result);
497 hsa_signal_value_t hsa_signal_wait_acquire(hsa_signal_t signal,
498                                            hsa_signal_condition_t condition,
499                                            hsa_signal_value_t compare_value,
500                                            uint64_t timeout_hint,
501                                            hsa_wait_state_t wait_state_hint);
502
503 hsa_signal_value_t hsa_signal_wait_relaxed(hsa_signal_t signal,
504                                            hsa_signal_condition_t condition,
505                                            hsa_signal_value_t compare_value,
506                                            uint64_t timeout_hint,
507                                            hsa_wait_state_t wait_state_hint);
508 hsa_status_t hsa_memory_copy(void *dst, const void *src, size_t size);
509 hsa_status_t hsa_memory_free(void *ptr);
510 hsa_status_t hsa_queue_destroy(hsa_queue_t *queue);
511 hsa_status_t hsa_isa_from_name(const char *name, hsa_isa_t *isa);
512 hsa_status_t hsa_isa_get_info(hsa_isa_t isa, hsa_isa_info_t attribute,
513                               uint32_t index, void *value);
514 hsa_status_t hsa_signal_create(hsa_signal_value_t initial_value,
515                                uint32_t num_consumers,
516                                const hsa_agent_t *consumers,
517                                hsa_signal_t *signal);
518 hsa_status_t hsa_code_symbol_get_info(hsa_code_symbol_t code_symbol,
519                                       hsa_code_symbol_info_t attribute,
520                                       void *value);
521 hsa_signal_value_t hsa_signal_cas_acq_rel(hsa_signal_t signal,
522                                           hsa_signal_value_t expected,
523                                           hsa_signal_value_t value);
524
525 hsa_signal_value_t hsa_signal_cas_acquire(hsa_signal_t signal,
526                                           hsa_signal_value_t expected,
527                                           hsa_signal_value_t value);
528
529 hsa_signal_value_t hsa_signal_cas_relaxed(hsa_signal_t signal,
530                                           hsa_signal_value_t expected,
531                                           hsa_signal_value_t value);
532
533 hsa_signal_value_t hsa_signal_cas_release(hsa_signal_t signal,
534                                           hsa_signal_value_t expected,
535                                           hsa_signal_value_t value);
536 hsa_status_t hsa_code_object_iterate_symbols(
537     hsa_code_object_t code_object,
538     hsa_status_t (*callback)(hsa_code_object_t code_object,
539                              hsa_code_symbol_t symbol, void *data),
540     void *data);
541 void hsa_queue_store_read_index_relaxed(const hsa_queue_t *queue,
542                                         uint64_t value);
543
544 void hsa_queue_store_read_index_release(const hsa_queue_t *queue,
545                                         uint64_t value);
546 hsa_status_t hsa_memory_assign_agent(void *ptr, hsa_agent_t agent,
547                                      hsa_access_permission_t access);
548 hsa_status_t hsa_queue_inactivate(hsa_queue_t *queue);
549 hsa_status_t hsa_executable_get_symbol(hsa_executable_t executable,
550                                        const char *module_name,
551                                        const char *symbol_name,
552                                        hsa_agent_t agent,
553                                        int32_t call_convention,
554                                        hsa_executable_symbol_t *symbol);
555 uint64_t hsa_queue_cas_write_index_acq_rel(const hsa_queue_t *queue,
556                                            uint64_t expected, uint64_t value);
557
558 uint64_t hsa_queue_cas_write_index_acquire(const hsa_queue_t *queue,
559                                            uint64_t expected, uint64_t value);
560
561 uint64_t hsa_queue_cas_write_index_relaxed(const hsa_queue_t *queue,
562                                            uint64_t expected, uint64_t value);
563
564 uint64_t hsa_queue_cas_write_index_release(const hsa_queue_t *queue,
565                                            uint64_t expected, uint64_t value);
566 void hsa_signal_and_acq_rel(hsa_signal_t signal, hsa_signal_value_t value);
567
568 void hsa_signal_and_acquire(hsa_signal_t signal, hsa_signal_value_t value);
569
570 void hsa_signal_and_relaxed(hsa_signal_t signal, hsa_signal_value_t value);
571
572 void hsa_signal_and_release(hsa_signal_t signal, hsa_signal_value_t value);
573 uint64_t hsa_queue_load_read_index_acquire(const hsa_queue_t *queue);
574
575 uint64_t hsa_queue_load_read_index_relaxed(const hsa_queue_t *queue);
576 hsa_status_t hsa_executable_load_code_object(hsa_executable_t executable,
577                                              hsa_agent_t agent,
578                                              hsa_code_object_t code_object,
579                                              const char *options);
580 uint64_t hsa_queue_load_write_index_acquire(const hsa_queue_t *queue);
581
582 uint64_t hsa_queue_load_write_index_relaxed(const hsa_queue_t *queue);
583 hsa_status_t hsa_agent_get_exception_policies(hsa_agent_t agent,
584                                               hsa_profile_t profile,
585                                               uint16_t *mask);
586 hsa_status_t hsa_memory_deregister(void *ptr, size_t size);
587 void hsa_signal_or_acq_rel(hsa_signal_t signal, hsa_signal_value_t value);
588
589 void hsa_signal_or_acquire(hsa_signal_t signal, hsa_signal_value_t value);
590
591 void hsa_signal_or_relaxed(hsa_signal_t signal, hsa_signal_value_t value);
592
593 void hsa_signal_or_release(hsa_signal_t signal, hsa_signal_value_t value);
594 hsa_status_t hsa_soft_queue_create(hsa_region_t region, uint32_t size,
595                                    hsa_queue_type_t type, uint32_t features,
596                                    hsa_signal_t doorbell_signal,
597                                    hsa_queue_t **queue);
598 hsa_status_t hsa_executable_iterate_symbols(
599     hsa_executable_t executable,
600     hsa_status_t (*callback)(hsa_executable_t executable,
601                              hsa_executable_symbol_t symbol, void *data),
602     void *data);
603 hsa_status_t hsa_memory_register(void *ptr, size_t size);
604 void hsa_queue_store_write_index_relaxed(const hsa_queue_t *queue,
605                                          uint64_t value);
606
607 void hsa_queue_store_write_index_release(const hsa_queue_t *queue,
608                                          uint64_t value);
609 hsa_status_t hsa_executable_global_variable_define(hsa_executable_t executable,
610                                                    const char *variable_name,
611                                                    void *address);
612 hsa_status_t hsa_executable_destroy(hsa_executable_t executable);
613 hsa_status_t hsa_code_object_destroy(hsa_code_object_t code_object);
614 hsa_status_t hsa_memory_allocate(hsa_region_t region, size_t size, void **ptr);
615 hsa_signal_value_t hsa_signal_exchange_acq_rel(hsa_signal_t signal,
616                                                hsa_signal_value_t value);
617
618 hsa_signal_value_t hsa_signal_exchange_acquire(hsa_signal_t signal,
619                                                hsa_signal_value_t value);
620
621 hsa_signal_value_t hsa_signal_exchange_relaxed(hsa_signal_t signal,
622                                                hsa_signal_value_t value);
623
624 hsa_signal_value_t hsa_signal_exchange_release(hsa_signal_t signal,
625                                                hsa_signal_value_t value);
626 hsa_status_t hsa_agent_get_info(hsa_agent_t agent, hsa_agent_info_t attribute,
627                                 void *value);
628 hsa_status_t hsa_init();
629 hsa_status_t hsa_system_get_info(hsa_system_info_t attribute, void *value);
630 hsa_status_t hsa_executable_create(hsa_profile_t profile,
631                                    hsa_executable_state_t executable_state,
632                                    const char *options,
633                                    hsa_executable_t *executable);
634
635 #endif /* _HSA_H */