triton-windows 3.2.0.post18__cp39-cp39-win_amd64.whl → 3.2.0.post21__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.

Files changed (111) hide show
  1. triton/_C/libtriton.pyd +0 -0
  2. triton/backends/amd/driver.py +6 -1
  3. triton/backends/nvidia/compiler.py +1 -3
  4. triton/backends/nvidia/driver.c +1 -0
  5. triton/backends/nvidia/driver.py +8 -3
  6. triton/runtime/autotuner.py +2 -2
  7. triton/runtime/build.py +14 -6
  8. triton/runtime/tcc/lib/python310.def +1610 -0
  9. triton/runtime/tcc/lib/python311.def +1633 -0
  10. triton/runtime/tcc/lib/python312.def +1703 -0
  11. triton/runtime/tcc/lib/python313.def +1651 -0
  12. triton/runtime/tcc/lib/python313t.def +1656 -0
  13. triton/runtime/tcc/lib/python39.def +1644 -0
  14. triton/runtime/tcc/lib/python3t.def +905 -0
  15. triton/windows_utils.py +11 -4
  16. {triton_windows-3.2.0.post18.dist-info → triton_windows-3.2.0.post21.dist-info}/METADATA +1 -1
  17. {triton_windows-3.2.0.post18.dist-info → triton_windows-3.2.0.post21.dist-info}/RECORD +19 -104
  18. {triton_windows-3.2.0.post18.dist-info → triton_windows-3.2.0.post21.dist-info}/WHEEL +1 -1
  19. triton/backends/amd/include/hip/amd_detail/amd_channel_descriptor.h +0 -358
  20. triton/backends/amd/include/hip/amd_detail/amd_device_functions.h +0 -1031
  21. triton/backends/amd/include/hip/amd_detail/amd_hip_atomic.h +0 -1612
  22. triton/backends/amd/include/hip/amd_detail/amd_hip_bf16.h +0 -1337
  23. triton/backends/amd/include/hip/amd_detail/amd_hip_bfloat16.h +0 -293
  24. triton/backends/amd/include/hip/amd_detail/amd_hip_common.h +0 -32
  25. triton/backends/amd/include/hip/amd_detail/amd_hip_complex.h +0 -174
  26. triton/backends/amd/include/hip/amd_detail/amd_hip_cooperative_groups.h +0 -829
  27. triton/backends/amd/include/hip/amd_detail/amd_hip_fp16.h +0 -1809
  28. triton/backends/amd/include/hip/amd_detail/amd_hip_gl_interop.h +0 -108
  29. triton/backends/amd/include/hip/amd_detail/amd_hip_math_constants.h +0 -124
  30. triton/backends/amd/include/hip/amd_detail/amd_hip_runtime.h +0 -405
  31. triton/backends/amd/include/hip/amd_detail/amd_hip_runtime_pt_api.h +0 -196
  32. triton/backends/amd/include/hip/amd_detail/amd_hip_unsafe_atomics.h +0 -565
  33. triton/backends/amd/include/hip/amd_detail/amd_hip_vector_types.h +0 -2226
  34. triton/backends/amd/include/hip/amd_detail/amd_math_functions.h +0 -104
  35. triton/backends/amd/include/hip/amd_detail/amd_surface_functions.h +0 -244
  36. triton/backends/amd/include/hip/amd_detail/amd_warp_functions.h +0 -494
  37. triton/backends/amd/include/hip/amd_detail/concepts.hpp +0 -30
  38. triton/backends/amd/include/hip/amd_detail/device_library_decls.h +0 -133
  39. triton/backends/amd/include/hip/amd_detail/functional_grid_launch.hpp +0 -218
  40. triton/backends/amd/include/hip/amd_detail/grid_launch.h +0 -67
  41. triton/backends/amd/include/hip/amd_detail/grid_launch.hpp +0 -50
  42. triton/backends/amd/include/hip/amd_detail/grid_launch_GGL.hpp +0 -26
  43. triton/backends/amd/include/hip/amd_detail/helpers.hpp +0 -137
  44. triton/backends/amd/include/hip/amd_detail/hip_api_trace.hpp +0 -1350
  45. triton/backends/amd/include/hip/amd_detail/hip_assert.h +0 -101
  46. triton/backends/amd/include/hip/amd_detail/hip_cooperative_groups_helper.h +0 -242
  47. triton/backends/amd/include/hip/amd_detail/hip_fp16_gcc.h +0 -254
  48. triton/backends/amd/include/hip/amd_detail/hip_fp16_math_fwd.h +0 -96
  49. triton/backends/amd/include/hip/amd_detail/hip_ldg.h +0 -100
  50. triton/backends/amd/include/hip/amd_detail/hip_prof_str.h +0 -10169
  51. triton/backends/amd/include/hip/amd_detail/hip_runtime_prof.h +0 -77
  52. triton/backends/amd/include/hip/amd_detail/host_defines.h +0 -180
  53. triton/backends/amd/include/hip/amd_detail/hsa_helpers.hpp +0 -102
  54. triton/backends/amd/include/hip/amd_detail/macro_based_grid_launch.hpp +0 -798
  55. triton/backends/amd/include/hip/amd_detail/math_fwd.h +0 -698
  56. triton/backends/amd/include/hip/amd_detail/ockl_image.h +0 -177
  57. triton/backends/amd/include/hip/amd_detail/program_state.hpp +0 -107
  58. triton/backends/amd/include/hip/amd_detail/texture_fetch_functions.h +0 -491
  59. triton/backends/amd/include/hip/amd_detail/texture_indirect_functions.h +0 -478
  60. triton/backends/amd/include/hip/channel_descriptor.h +0 -39
  61. triton/backends/amd/include/hip/device_functions.h +0 -38
  62. triton/backends/amd/include/hip/driver_types.h +0 -468
  63. triton/backends/amd/include/hip/hip_bf16.h +0 -36
  64. triton/backends/amd/include/hip/hip_bfloat16.h +0 -44
  65. triton/backends/amd/include/hip/hip_common.h +0 -100
  66. triton/backends/amd/include/hip/hip_complex.h +0 -38
  67. triton/backends/amd/include/hip/hip_cooperative_groups.h +0 -46
  68. triton/backends/amd/include/hip/hip_deprecated.h +0 -95
  69. triton/backends/amd/include/hip/hip_ext.h +0 -159
  70. triton/backends/amd/include/hip/hip_fp16.h +0 -36
  71. triton/backends/amd/include/hip/hip_gl_interop.h +0 -32
  72. triton/backends/amd/include/hip/hip_hcc.h +0 -24
  73. triton/backends/amd/include/hip/hip_math_constants.h +0 -36
  74. triton/backends/amd/include/hip/hip_profile.h +0 -27
  75. triton/backends/amd/include/hip/hip_runtime.h +0 -75
  76. triton/backends/amd/include/hip/hip_runtime_api.h +0 -8919
  77. triton/backends/amd/include/hip/hip_texture_types.h +0 -29
  78. triton/backends/amd/include/hip/hip_vector_types.h +0 -41
  79. triton/backends/amd/include/hip/hip_version.h +0 -17
  80. triton/backends/amd/include/hip/hiprtc.h +0 -421
  81. triton/backends/amd/include/hip/library_types.h +0 -78
  82. triton/backends/amd/include/hip/math_functions.h +0 -42
  83. triton/backends/amd/include/hip/surface_types.h +0 -63
  84. triton/backends/amd/include/hip/texture_types.h +0 -194
  85. triton/backends/amd/include/hsa/Brig.h +0 -1131
  86. triton/backends/amd/include/hsa/amd_hsa_common.h +0 -91
  87. triton/backends/amd/include/hsa/amd_hsa_elf.h +0 -436
  88. triton/backends/amd/include/hsa/amd_hsa_kernel_code.h +0 -269
  89. triton/backends/amd/include/hsa/amd_hsa_queue.h +0 -109
  90. triton/backends/amd/include/hsa/amd_hsa_signal.h +0 -80
  91. triton/backends/amd/include/hsa/hsa.h +0 -5729
  92. triton/backends/amd/include/hsa/hsa_amd_tool.h +0 -91
  93. triton/backends/amd/include/hsa/hsa_api_trace.h +0 -566
  94. triton/backends/amd/include/hsa/hsa_ext_amd.h +0 -3090
  95. triton/backends/amd/include/hsa/hsa_ext_finalize.h +0 -531
  96. triton/backends/amd/include/hsa/hsa_ext_image.h +0 -1454
  97. triton/backends/amd/include/hsa/hsa_ven_amd_aqlprofile.h +0 -488
  98. triton/backends/amd/include/hsa/hsa_ven_amd_loader.h +0 -667
  99. triton/backends/amd/include/roctracer/ext/prof_protocol.h +0 -107
  100. triton/backends/amd/include/roctracer/hip_ostream_ops.h +0 -4435
  101. triton/backends/amd/include/roctracer/hsa_ostream_ops.h +0 -1467
  102. triton/backends/amd/include/roctracer/hsa_prof_str.h +0 -3027
  103. triton/backends/amd/include/roctracer/roctracer.h +0 -779
  104. triton/backends/amd/include/roctracer/roctracer_ext.h +0 -81
  105. triton/backends/amd/include/roctracer/roctracer_hcc.h +0 -24
  106. triton/backends/amd/include/roctracer/roctracer_hip.h +0 -37
  107. triton/backends/amd/include/roctracer/roctracer_hsa.h +0 -112
  108. triton/backends/amd/include/roctracer/roctracer_plugin.h +0 -137
  109. triton/backends/amd/include/roctracer/roctracer_roctx.h +0 -67
  110. triton/backends/amd/include/roctracer/roctx.h +0 -229
  111. {triton_windows-3.2.0.post18.dist-info → triton_windows-3.2.0.post21.dist-info}/top_level.txt +0 -0
@@ -1,91 +0,0 @@
1
- #ifndef HSA_RUNTIME_AMD_TOOL_EVENTS_H_
2
- #define HSA_RUNTIME_AMD_TOOL_EVENTS_H_
3
-
4
- // Insert license header
5
-
6
- #include <stddef.h>
7
- #include <stdint.h>
8
- #include "hsa.h"
9
-
10
-
11
- typedef enum {
12
- HSA_AMD_EVENT_SCRATCH_ALLOC_FLAG_NONE = 0,
13
- HSA_AMD_EVENT_SCRATCH_ALLOC_FLAG_USE_ONCE =
14
- (1 << 0), // This scratch allocation is only valid for 1 dispatch.
15
- HSA_AMD_EVENT_SCRATCH_ALLOC_FLAG_ALT =
16
- (1 << 1), // Used alternate scratch instead of main scratch
17
- } hsa_amd_event_scratch_alloc_flag_t;
18
-
19
- typedef enum {
20
- HSA_AMD_TOOL_EVENT_MIN = 0,
21
-
22
- // Scratch memory tracking
23
- HSA_AMD_TOOL_EVENT_SCRATCH_ALLOC_START,
24
- HSA_AMD_TOOL_EVENT_SCRATCH_ALLOC_END,
25
- HSA_AMD_TOOL_EVENT_SCRATCH_FREE_START,
26
- HSA_AMD_TOOL_EVENT_SCRATCH_FREE_END,
27
- HSA_AMD_TOOL_EVENT_SCRATCH_ASYNC_RECLAIM_START,
28
- HSA_AMD_TOOL_EVENT_SCRATCH_ASYNC_RECLAIM_END,
29
-
30
- // Add new events above ^
31
- HSA_AMD_TOOL_EVENT_MAX
32
- } hsa_amd_tool_event_kind_t;
33
-
34
- typedef struct {
35
- hsa_amd_tool_event_kind_t kind;
36
- } hsa_amd_tool_event_none_t;
37
-
38
- typedef struct {
39
- hsa_amd_tool_event_kind_t kind;
40
- const hsa_queue_t* queue;
41
- hsa_amd_event_scratch_alloc_flag_t flags;
42
- uint64_t dispatch_id; // Dispatch ID of the AQL packet that needs more scratch memory
43
- } hsa_amd_event_scratch_alloc_start_t;
44
-
45
- typedef struct {
46
- hsa_amd_tool_event_kind_t kind;
47
- const hsa_queue_t* queue;
48
- hsa_amd_event_scratch_alloc_flag_t flags;
49
- uint64_t dispatch_id; // Dispatch ID of the AQL packet that needs more scratch memory
50
- size_t size; // Amount of scratch allocated - in bytes
51
- size_t num_slots; // limit of number of waves
52
- } hsa_amd_event_scratch_alloc_end_t;
53
-
54
- typedef struct {
55
- hsa_amd_tool_event_kind_t kind;
56
- const hsa_queue_t* queue;
57
- hsa_amd_event_scratch_alloc_flag_t flags;
58
- } hsa_amd_event_scratch_free_start_t;
59
-
60
- typedef struct {
61
- hsa_amd_tool_event_kind_t kind;
62
- const hsa_queue_t* queue;
63
- hsa_amd_event_scratch_alloc_flag_t flags;
64
- } hsa_amd_event_scratch_free_end_t;
65
-
66
- typedef struct {
67
- hsa_amd_tool_event_kind_t kind;
68
- const hsa_queue_t* queue;
69
- hsa_amd_event_scratch_alloc_flag_t flags;
70
- } hsa_amd_event_scratch_async_reclaim_start_t;
71
-
72
- typedef struct {
73
- hsa_amd_tool_event_kind_t kind;
74
- const hsa_queue_t* queue;
75
- hsa_amd_event_scratch_alloc_flag_t flags;
76
- } hsa_amd_event_scratch_async_reclaim_end_t;
77
-
78
- typedef union {
79
- const hsa_amd_tool_event_none_t* none;
80
- const hsa_amd_event_scratch_alloc_start_t* scratch_alloc_start;
81
- const hsa_amd_event_scratch_alloc_end_t* scratch_alloc_end;
82
- const hsa_amd_event_scratch_free_start_t* scratch_free_start;
83
- const hsa_amd_event_scratch_free_end_t* scratch_free_end;
84
- const hsa_amd_event_scratch_async_reclaim_start_t* scratch_async_reclaim_start;
85
- const hsa_amd_event_scratch_async_reclaim_end_t* scratch_async_reclaim_end;
86
- } hsa_amd_tool_event_t;
87
-
88
- typedef hsa_status_t (*hsa_amd_tool_event)(hsa_amd_tool_event_t);
89
-
90
-
91
- #endif
@@ -1,566 +0,0 @@
1
- ////////////////////////////////////////////////////////////////////////////////
2
- //
3
- // The University of Illinois/NCSA
4
- // Open Source License (NCSA)
5
- //
6
- // Copyright (c) 2014-2020, Advanced Micro Devices, Inc. All rights reserved.
7
- //
8
- // Developed by:
9
- //
10
- // AMD Research and AMD HSA Software Development
11
- //
12
- // Advanced Micro Devices, Inc.
13
- //
14
- // www.amd.com
15
- //
16
- // Permission is hereby granted, free of charge, to any person obtaining a copy
17
- // of this software and associated documentation files (the "Software"), to
18
- // deal with the Software without restriction, including without limitation
19
- // the rights to use, copy, modify, merge, publish, distribute, sublicense,
20
- // and/or sell copies of the Software, and to permit persons to whom the
21
- // Software is furnished to do so, subject to the following conditions:
22
- //
23
- // - Redistributions of source code must retain the above copyright notice,
24
- // this list of conditions and the following disclaimers.
25
- // - Redistributions in binary form must reproduce the above copyright
26
- // notice, this list of conditions and the following disclaimers in
27
- // the documentation and/or other materials provided with the distribution.
28
- // - Neither the names of Advanced Micro Devices, Inc,
29
- // nor the names of its contributors may be used to endorse or promote
30
- // products derived from this Software without specific prior written
31
- // permission.
32
- //
33
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
36
- // THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
37
- // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
38
- // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
39
- // DEALINGS WITH THE SOFTWARE.
40
- //
41
- ////////////////////////////////////////////////////////////////////////////////
42
-
43
- #ifndef HSA_RUNTIME_INC_HSA_API_TRACE_H
44
- #define HSA_RUNTIME_INC_HSA_API_TRACE_H
45
-
46
- #include "hsa.h"
47
- #ifdef AMD_INTERNAL_BUILD
48
- #include "hsa_ext_image.h"
49
- #include "hsa_ext_amd.h"
50
- #include "hsa_ext_finalize.h"
51
- #include "hsa_amd_tool.h"
52
- #else
53
- #include "inc/hsa_ext_image.h"
54
- #include "inc/hsa_ext_amd.h"
55
- #include "inc/hsa_ext_finalize.h"
56
- #include "inc/hsa_amd_tool.h"
57
- #endif
58
-
59
- #include <string.h>
60
- #include <assert.h>
61
- #include <stddef.h>
62
-
63
- // Major Ids of the Api tables exported by Hsa Core Runtime
64
- #define HSA_API_TABLE_MAJOR_VERSION 0x03
65
- #define HSA_CORE_API_TABLE_MAJOR_VERSION 0x02
66
- #define HSA_AMD_EXT_API_TABLE_MAJOR_VERSION 0x02
67
- #define HSA_FINALIZER_API_TABLE_MAJOR_VERSION 0x02
68
- #define HSA_IMAGE_API_TABLE_MAJOR_VERSION 0x02
69
- #define HSA_AQLPROFILE_API_TABLE_MAJOR_VERSION 0x01
70
- #define HSA_TOOLS_API_TABLE_MAJOR_VERSION 0x01
71
-
72
- // Step Ids of the Api tables exported by Hsa Core Runtime
73
- #define HSA_API_TABLE_STEP_VERSION 0x00
74
- #define HSA_CORE_API_TABLE_STEP_VERSION 0x00
75
- #define HSA_AMD_EXT_API_TABLE_STEP_VERSION 0x01
76
- #define HSA_FINALIZER_API_TABLE_STEP_VERSION 0x00
77
- #define HSA_IMAGE_API_TABLE_STEP_VERSION 0x00
78
- #define HSA_AQLPROFILE_API_TABLE_STEP_VERSION 0x00
79
- #define HSA_TOOLS_API_TABLE_STEP_VERSION 0x00
80
-
81
- // Min function used to copy Api Tables
82
- static inline uint32_t Min(const uint32_t a, const uint32_t b) {
83
- return (a > b) ? b : a;
84
- }
85
-
86
- // Declarations of APIs intended for use only by tools.
87
-
88
- // An AQL packet that can be put in an intercept queue to cause a callback to
89
- // be invoked when the packet is about to be submitted to the underlying
90
- // hardware queue. These packets are not copied to the underlying hardware
91
- // queue. These packets should come immediately before the regular AQL packet
92
- // they relate to. This implies that packet rewriters should always keep these
93
- // packets adjacent to the regular AQL packet that follows them.
94
- const uint32_t AMD_AQL_FORMAT_INTERCEPT_MARKER = 0xFE;
95
-
96
- struct amd_aql_intercept_marker_s;
97
-
98
- // When an intercept queue is processing rewritten packets to put them on the
99
- // underlying hardware queue, if it encounters a
100
- // AMD_AQL_FORMAT_INTERCEPT_MARKER vendor AQL packet it will call the following
101
- // handler. packet points to the packet, queue is the underlying hardware
102
- // queue, and packet_id is the packet id of the next packet to be put on the
103
- // underlying hardware queue. The intercept queue does not put these packets
104
- // onto the underlying hardware queue.
105
- typedef void (*amd_intercept_marker_handler)(const struct amd_aql_intercept_marker_s* packet,
106
- hsa_queue_t* queue, uint64_t packet_id);
107
- // An AQL vendor packet used by the intercept queue to mark the following
108
- // packet. The callback will be invoked to allow a tool to know where in the
109
- // underlying hardware queue the following packet will be placed. user_data can
110
- // be used to hold any data useful to the tool.
111
- typedef struct amd_aql_intercept_marker_s {
112
- uint16_t header; // Must have a packet type of HSA_PACKET_TYPE_VENDOR_SPECIFIC.
113
- uint8_t format; // Must be AMD_AQL_FORMAT_INTERCEPT_MARKER.
114
- uint8_t reserved[5]; // Must be 0.
115
- #ifdef HSA_LARGE_MODEL
116
- amd_intercept_marker_handler callback;
117
- #elif defined HSA_LITTLE_ENDIAN
118
- amd_intercept_marker_handler callback;
119
- uint32_t reserved1; // Must be 0.
120
- #else
121
- uint32_t reserved1; // Must be 0.
122
- amd_intercept_marker_handler callback;
123
- #endif
124
- uint64_t user_data[6];
125
- } amd_aql_intercept_marker_t;
126
-
127
- typedef void (*hsa_amd_queue_intercept_packet_writer)(const void* pkts, uint64_t pkt_count);
128
- typedef void (*hsa_amd_queue_intercept_handler)(const void* pkts, uint64_t pkt_count,
129
- uint64_t user_pkt_index, void* data,
130
- hsa_amd_queue_intercept_packet_writer writer);
131
- hsa_status_t hsa_amd_queue_intercept_register(hsa_queue_t* queue,
132
- hsa_amd_queue_intercept_handler callback,
133
- void* user_data);
134
- hsa_status_t hsa_amd_queue_intercept_create(
135
- hsa_agent_t agent_handle, uint32_t size, hsa_queue_type32_t type,
136
- void (*callback)(hsa_status_t status, hsa_queue_t* source, void* data), void* data,
137
- uint32_t private_segment_size, uint32_t group_segment_size, hsa_queue_t** queue);
138
-
139
- typedef void (*hsa_amd_runtime_queue_notifier)(const hsa_queue_t* queue, hsa_agent_t agent,
140
- void* data);
141
- hsa_status_t hsa_amd_runtime_queue_create_register(hsa_amd_runtime_queue_notifier callback,
142
- void* user_data);
143
-
144
- // Structure of Version used to identify an instance of Api table
145
- // Must be the first member (offsetof == 0) of all API tables.
146
- // This is the root of the table passing ABI.
147
- struct ApiTableVersion {
148
- uint32_t major_id;
149
- uint32_t minor_id;
150
- uint32_t step_id;
151
- uint32_t reserved;
152
- };
153
-
154
- struct ToolsApiTable {
155
- ApiTableVersion version;
156
-
157
- hsa_amd_tool_event hsa_amd_tool_scratch_event_alloc_start_fn;
158
- hsa_amd_tool_event hsa_amd_tool_scratch_event_alloc_end_fn;
159
- hsa_amd_tool_event hsa_amd_tool_scratch_event_free_start_fn;
160
- hsa_amd_tool_event hsa_amd_tool_scratch_event_free_end_fn;
161
- hsa_amd_tool_event hsa_amd_tool_scratch_event_async_reclaim_start_fn;
162
- hsa_amd_tool_event hsa_amd_tool_scratch_event_async_reclaim_end_fn;
163
- };
164
-
165
- // Table to export HSA Finalizer Extension Apis
166
- struct FinalizerExtTable {
167
- ApiTableVersion version;
168
- decltype(hsa_ext_program_create)* hsa_ext_program_create_fn;
169
- decltype(hsa_ext_program_destroy)* hsa_ext_program_destroy_fn;
170
- decltype(hsa_ext_program_add_module)* hsa_ext_program_add_module_fn;
171
- decltype(hsa_ext_program_iterate_modules)* hsa_ext_program_iterate_modules_fn;
172
- decltype(hsa_ext_program_get_info)* hsa_ext_program_get_info_fn;
173
- decltype(hsa_ext_program_finalize)* hsa_ext_program_finalize_fn;
174
- };
175
-
176
- // Table to export HSA Image Extension Apis
177
- struct ImageExtTable {
178
- ApiTableVersion version;
179
- decltype(hsa_ext_image_get_capability)* hsa_ext_image_get_capability_fn;
180
- decltype(hsa_ext_image_data_get_info)* hsa_ext_image_data_get_info_fn;
181
- decltype(hsa_ext_image_create)* hsa_ext_image_create_fn;
182
- decltype(hsa_ext_image_import)* hsa_ext_image_import_fn;
183
- decltype(hsa_ext_image_export)* hsa_ext_image_export_fn;
184
- decltype(hsa_ext_image_copy)* hsa_ext_image_copy_fn;
185
- decltype(hsa_ext_image_clear)* hsa_ext_image_clear_fn;
186
- decltype(hsa_ext_image_destroy)* hsa_ext_image_destroy_fn;
187
- decltype(hsa_ext_sampler_create)* hsa_ext_sampler_create_fn;
188
- decltype(hsa_ext_sampler_destroy)* hsa_ext_sampler_destroy_fn;
189
- decltype(hsa_ext_image_get_capability_with_layout)* hsa_ext_image_get_capability_with_layout_fn;
190
- decltype(hsa_ext_image_data_get_info_with_layout)* hsa_ext_image_data_get_info_with_layout_fn;
191
- decltype(hsa_ext_image_create_with_layout)* hsa_ext_image_create_with_layout_fn;
192
- };
193
-
194
- // Table to export AMD Extension Apis
195
- struct AmdExtTable {
196
- ApiTableVersion version;
197
- decltype(hsa_amd_coherency_get_type)* hsa_amd_coherency_get_type_fn;
198
- decltype(hsa_amd_coherency_set_type)* hsa_amd_coherency_set_type_fn;
199
- decltype(hsa_amd_profiling_set_profiler_enabled)* hsa_amd_profiling_set_profiler_enabled_fn;
200
- decltype(hsa_amd_profiling_async_copy_enable) *hsa_amd_profiling_async_copy_enable_fn;
201
- decltype(hsa_amd_profiling_get_dispatch_time)* hsa_amd_profiling_get_dispatch_time_fn;
202
- decltype(hsa_amd_profiling_get_async_copy_time) *hsa_amd_profiling_get_async_copy_time_fn;
203
- decltype(hsa_amd_profiling_convert_tick_to_system_domain)* hsa_amd_profiling_convert_tick_to_system_domain_fn;
204
- decltype(hsa_amd_signal_async_handler)* hsa_amd_signal_async_handler_fn;
205
- decltype(hsa_amd_async_function)* hsa_amd_async_function_fn;
206
- decltype(hsa_amd_signal_wait_any)* hsa_amd_signal_wait_any_fn;
207
- decltype(hsa_amd_queue_cu_set_mask)* hsa_amd_queue_cu_set_mask_fn;
208
- decltype(hsa_amd_memory_pool_get_info)* hsa_amd_memory_pool_get_info_fn;
209
- decltype(hsa_amd_agent_iterate_memory_pools)* hsa_amd_agent_iterate_memory_pools_fn;
210
- decltype(hsa_amd_memory_pool_allocate)* hsa_amd_memory_pool_allocate_fn;
211
- decltype(hsa_amd_memory_pool_free)* hsa_amd_memory_pool_free_fn;
212
- decltype(hsa_amd_memory_async_copy)* hsa_amd_memory_async_copy_fn;
213
- decltype(hsa_amd_memory_async_copy_on_engine)* hsa_amd_memory_async_copy_on_engine_fn;
214
- decltype(hsa_amd_memory_copy_engine_status)* hsa_amd_memory_copy_engine_status_fn;
215
- decltype(hsa_amd_agent_memory_pool_get_info)* hsa_amd_agent_memory_pool_get_info_fn;
216
- decltype(hsa_amd_agents_allow_access)* hsa_amd_agents_allow_access_fn;
217
- decltype(hsa_amd_memory_pool_can_migrate)* hsa_amd_memory_pool_can_migrate_fn;
218
- decltype(hsa_amd_memory_migrate)* hsa_amd_memory_migrate_fn;
219
- decltype(hsa_amd_memory_lock)* hsa_amd_memory_lock_fn;
220
- decltype(hsa_amd_memory_unlock)* hsa_amd_memory_unlock_fn;
221
- decltype(hsa_amd_memory_fill)* hsa_amd_memory_fill_fn;
222
- decltype(hsa_amd_interop_map_buffer)* hsa_amd_interop_map_buffer_fn;
223
- decltype(hsa_amd_interop_unmap_buffer)* hsa_amd_interop_unmap_buffer_fn;
224
- decltype(hsa_amd_image_create)* hsa_amd_image_create_fn;
225
- decltype(hsa_amd_pointer_info)* hsa_amd_pointer_info_fn;
226
- decltype(hsa_amd_pointer_info_set_userdata)* hsa_amd_pointer_info_set_userdata_fn;
227
- decltype(hsa_amd_ipc_memory_create)* hsa_amd_ipc_memory_create_fn;
228
- decltype(hsa_amd_ipc_memory_attach)* hsa_amd_ipc_memory_attach_fn;
229
- decltype(hsa_amd_ipc_memory_detach)* hsa_amd_ipc_memory_detach_fn;
230
- decltype(hsa_amd_signal_create)* hsa_amd_signal_create_fn;
231
- decltype(hsa_amd_ipc_signal_create)* hsa_amd_ipc_signal_create_fn;
232
- decltype(hsa_amd_ipc_signal_attach)* hsa_amd_ipc_signal_attach_fn;
233
- decltype(hsa_amd_register_system_event_handler)* hsa_amd_register_system_event_handler_fn;
234
- decltype(hsa_amd_queue_intercept_create)* hsa_amd_queue_intercept_create_fn;
235
- decltype(hsa_amd_queue_intercept_register)* hsa_amd_queue_intercept_register_fn;
236
- decltype(hsa_amd_queue_set_priority)* hsa_amd_queue_set_priority_fn;
237
- decltype(hsa_amd_memory_async_copy_rect)* hsa_amd_memory_async_copy_rect_fn;
238
- decltype(hsa_amd_runtime_queue_create_register)* hsa_amd_runtime_queue_create_register_fn;
239
- decltype(hsa_amd_memory_lock_to_pool)* hsa_amd_memory_lock_to_pool_fn;
240
- decltype(hsa_amd_register_deallocation_callback)* hsa_amd_register_deallocation_callback_fn;
241
- decltype(hsa_amd_deregister_deallocation_callback)* hsa_amd_deregister_deallocation_callback_fn;
242
- decltype(hsa_amd_signal_value_pointer)* hsa_amd_signal_value_pointer_fn;
243
- decltype(hsa_amd_svm_attributes_set)* hsa_amd_svm_attributes_set_fn;
244
- decltype(hsa_amd_svm_attributes_get)* hsa_amd_svm_attributes_get_fn;
245
- decltype(hsa_amd_svm_prefetch_async)* hsa_amd_svm_prefetch_async_fn;
246
- decltype(hsa_amd_spm_acquire)* hsa_amd_spm_acquire_fn;
247
- decltype(hsa_amd_spm_release)* hsa_amd_spm_release_fn;
248
- decltype(hsa_amd_spm_set_dest_buffer)* hsa_amd_spm_set_dest_buffer_fn;
249
- decltype(hsa_amd_queue_cu_get_mask)* hsa_amd_queue_cu_get_mask_fn;
250
- decltype(hsa_amd_portable_export_dmabuf)* hsa_amd_portable_export_dmabuf_fn;
251
- decltype(hsa_amd_portable_close_dmabuf)* hsa_amd_portable_close_dmabuf_fn;
252
- decltype(hsa_amd_vmem_address_reserve)* hsa_amd_vmem_address_reserve_fn;
253
- decltype(hsa_amd_vmem_address_free)* hsa_amd_vmem_address_free_fn;
254
- decltype(hsa_amd_vmem_handle_create)* hsa_amd_vmem_handle_create_fn;
255
- decltype(hsa_amd_vmem_handle_release)* hsa_amd_vmem_handle_release_fn;
256
- decltype(hsa_amd_vmem_map)* hsa_amd_vmem_map_fn;
257
- decltype(hsa_amd_vmem_unmap)* hsa_amd_vmem_unmap_fn;
258
- decltype(hsa_amd_vmem_set_access)* hsa_amd_vmem_set_access_fn;
259
- decltype(hsa_amd_vmem_get_access)* hsa_amd_vmem_get_access_fn;
260
- decltype(hsa_amd_vmem_export_shareable_handle)* hsa_amd_vmem_export_shareable_handle_fn;
261
- decltype(hsa_amd_vmem_import_shareable_handle)* hsa_amd_vmem_import_shareable_handle_fn;
262
- decltype(hsa_amd_vmem_retain_alloc_handle)* hsa_amd_vmem_retain_alloc_handle_fn;
263
- decltype(hsa_amd_vmem_get_alloc_properties_from_handle)*
264
- hsa_amd_vmem_get_alloc_properties_from_handle_fn;
265
- decltype(hsa_amd_agent_set_async_scratch_limit)* hsa_amd_agent_set_async_scratch_limit_fn;
266
- };
267
-
268
- // Table to export HSA Core Runtime Apis
269
- struct CoreApiTable {
270
- ApiTableVersion version;
271
- decltype(hsa_init)* hsa_init_fn;
272
- decltype(hsa_shut_down)* hsa_shut_down_fn;
273
- decltype(hsa_system_get_info)* hsa_system_get_info_fn;
274
- decltype(hsa_system_extension_supported)* hsa_system_extension_supported_fn;
275
- decltype(hsa_system_get_extension_table)* hsa_system_get_extension_table_fn;
276
- decltype(hsa_iterate_agents)* hsa_iterate_agents_fn;
277
- decltype(hsa_agent_get_info)* hsa_agent_get_info_fn;
278
- decltype(hsa_queue_create)* hsa_queue_create_fn;
279
- decltype(hsa_soft_queue_create)* hsa_soft_queue_create_fn;
280
- decltype(hsa_queue_destroy)* hsa_queue_destroy_fn;
281
- decltype(hsa_queue_inactivate)* hsa_queue_inactivate_fn;
282
- decltype(hsa_queue_load_read_index_scacquire)* hsa_queue_load_read_index_scacquire_fn;
283
- decltype(hsa_queue_load_read_index_relaxed)* hsa_queue_load_read_index_relaxed_fn;
284
- decltype(hsa_queue_load_write_index_scacquire)* hsa_queue_load_write_index_scacquire_fn;
285
- decltype(hsa_queue_load_write_index_relaxed)* hsa_queue_load_write_index_relaxed_fn;
286
- decltype(hsa_queue_store_write_index_relaxed)* hsa_queue_store_write_index_relaxed_fn;
287
- decltype(hsa_queue_store_write_index_screlease)* hsa_queue_store_write_index_screlease_fn;
288
- decltype(hsa_queue_cas_write_index_scacq_screl)* hsa_queue_cas_write_index_scacq_screl_fn;
289
- decltype(hsa_queue_cas_write_index_scacquire)* hsa_queue_cas_write_index_scacquire_fn;
290
- decltype(hsa_queue_cas_write_index_relaxed)* hsa_queue_cas_write_index_relaxed_fn;
291
- decltype(hsa_queue_cas_write_index_screlease)* hsa_queue_cas_write_index_screlease_fn;
292
- decltype(hsa_queue_add_write_index_scacq_screl)* hsa_queue_add_write_index_scacq_screl_fn;
293
- decltype(hsa_queue_add_write_index_scacquire)* hsa_queue_add_write_index_scacquire_fn;
294
- decltype(hsa_queue_add_write_index_relaxed)* hsa_queue_add_write_index_relaxed_fn;
295
- decltype(hsa_queue_add_write_index_screlease)* hsa_queue_add_write_index_screlease_fn;
296
- decltype(hsa_queue_store_read_index_relaxed)* hsa_queue_store_read_index_relaxed_fn;
297
- decltype(hsa_queue_store_read_index_screlease)* hsa_queue_store_read_index_screlease_fn;
298
- decltype(hsa_agent_iterate_regions)* hsa_agent_iterate_regions_fn;
299
- decltype(hsa_region_get_info)* hsa_region_get_info_fn;
300
- decltype(hsa_agent_get_exception_policies)* hsa_agent_get_exception_policies_fn;
301
- decltype(hsa_agent_extension_supported)* hsa_agent_extension_supported_fn;
302
- decltype(hsa_memory_register)* hsa_memory_register_fn;
303
- decltype(hsa_memory_deregister)* hsa_memory_deregister_fn;
304
- decltype(hsa_memory_allocate)* hsa_memory_allocate_fn;
305
- decltype(hsa_memory_free)* hsa_memory_free_fn;
306
- decltype(hsa_memory_copy)* hsa_memory_copy_fn;
307
- decltype(hsa_memory_assign_agent)* hsa_memory_assign_agent_fn;
308
- decltype(hsa_signal_create)* hsa_signal_create_fn;
309
- decltype(hsa_signal_destroy)* hsa_signal_destroy_fn;
310
- decltype(hsa_signal_load_relaxed)* hsa_signal_load_relaxed_fn;
311
- decltype(hsa_signal_load_scacquire)* hsa_signal_load_scacquire_fn;
312
- decltype(hsa_signal_store_relaxed)* hsa_signal_store_relaxed_fn;
313
- decltype(hsa_signal_store_screlease)* hsa_signal_store_screlease_fn;
314
- decltype(hsa_signal_wait_relaxed)* hsa_signal_wait_relaxed_fn;
315
- decltype(hsa_signal_wait_scacquire)* hsa_signal_wait_scacquire_fn;
316
- decltype(hsa_signal_and_relaxed)* hsa_signal_and_relaxed_fn;
317
- decltype(hsa_signal_and_scacquire)* hsa_signal_and_scacquire_fn;
318
- decltype(hsa_signal_and_screlease)* hsa_signal_and_screlease_fn;
319
- decltype(hsa_signal_and_scacq_screl)* hsa_signal_and_scacq_screl_fn;
320
- decltype(hsa_signal_or_relaxed)* hsa_signal_or_relaxed_fn;
321
- decltype(hsa_signal_or_scacquire)* hsa_signal_or_scacquire_fn;
322
- decltype(hsa_signal_or_screlease)* hsa_signal_or_screlease_fn;
323
- decltype(hsa_signal_or_scacq_screl)* hsa_signal_or_scacq_screl_fn;
324
- decltype(hsa_signal_xor_relaxed)* hsa_signal_xor_relaxed_fn;
325
- decltype(hsa_signal_xor_scacquire)* hsa_signal_xor_scacquire_fn;
326
- decltype(hsa_signal_xor_screlease)* hsa_signal_xor_screlease_fn;
327
- decltype(hsa_signal_xor_scacq_screl)* hsa_signal_xor_scacq_screl_fn;
328
- decltype(hsa_signal_exchange_relaxed)* hsa_signal_exchange_relaxed_fn;
329
- decltype(hsa_signal_exchange_scacquire)* hsa_signal_exchange_scacquire_fn;
330
- decltype(hsa_signal_exchange_screlease)* hsa_signal_exchange_screlease_fn;
331
- decltype(hsa_signal_exchange_scacq_screl)* hsa_signal_exchange_scacq_screl_fn;
332
- decltype(hsa_signal_add_relaxed)* hsa_signal_add_relaxed_fn;
333
- decltype(hsa_signal_add_scacquire)* hsa_signal_add_scacquire_fn;
334
- decltype(hsa_signal_add_screlease)* hsa_signal_add_screlease_fn;
335
- decltype(hsa_signal_add_scacq_screl)* hsa_signal_add_scacq_screl_fn;
336
- decltype(hsa_signal_subtract_relaxed)* hsa_signal_subtract_relaxed_fn;
337
- decltype(hsa_signal_subtract_scacquire)* hsa_signal_subtract_scacquire_fn;
338
- decltype(hsa_signal_subtract_screlease)* hsa_signal_subtract_screlease_fn;
339
- decltype(hsa_signal_subtract_scacq_screl)* hsa_signal_subtract_scacq_screl_fn;
340
- decltype(hsa_signal_cas_relaxed)* hsa_signal_cas_relaxed_fn;
341
- decltype(hsa_signal_cas_scacquire)* hsa_signal_cas_scacquire_fn;
342
- decltype(hsa_signal_cas_screlease)* hsa_signal_cas_screlease_fn;
343
- decltype(hsa_signal_cas_scacq_screl)* hsa_signal_cas_scacq_screl_fn;
344
-
345
- //===--- Instruction Set Architecture -----------------------------------===//
346
-
347
- decltype(hsa_isa_from_name)* hsa_isa_from_name_fn;
348
- // Deprecated since v1.1.
349
- decltype(hsa_isa_get_info)* hsa_isa_get_info_fn;
350
- // Deprecated since v1.1.
351
- decltype(hsa_isa_compatible)* hsa_isa_compatible_fn;
352
-
353
- //===--- Code Objects (deprecated) --------------------------------------===//
354
-
355
- // Deprecated since v1.1.
356
- decltype(hsa_code_object_serialize)* hsa_code_object_serialize_fn;
357
- // Deprecated since v1.1.
358
- decltype(hsa_code_object_deserialize)* hsa_code_object_deserialize_fn;
359
- // Deprecated since v1.1.
360
- decltype(hsa_code_object_destroy)* hsa_code_object_destroy_fn;
361
- // Deprecated since v1.1.
362
- decltype(hsa_code_object_get_info)* hsa_code_object_get_info_fn;
363
- // Deprecated since v1.1.
364
- decltype(hsa_code_object_get_symbol)* hsa_code_object_get_symbol_fn;
365
- // Deprecated since v1.1.
366
- decltype(hsa_code_symbol_get_info)* hsa_code_symbol_get_info_fn;
367
- // Deprecated since v1.1.
368
- decltype(hsa_code_object_iterate_symbols)* hsa_code_object_iterate_symbols_fn;
369
-
370
- //===--- Executable -----------------------------------------------------===//
371
-
372
- // Deprecated since v1.1.
373
- decltype(hsa_executable_create)* hsa_executable_create_fn;
374
- decltype(hsa_executable_destroy)* hsa_executable_destroy_fn;
375
- // Deprecated since v1.1.
376
- decltype(hsa_executable_load_code_object)* hsa_executable_load_code_object_fn;
377
- decltype(hsa_executable_freeze)* hsa_executable_freeze_fn;
378
- decltype(hsa_executable_get_info)* hsa_executable_get_info_fn;
379
- decltype(hsa_executable_global_variable_define)*
380
- hsa_executable_global_variable_define_fn;
381
- decltype(hsa_executable_agent_global_variable_define)*
382
- hsa_executable_agent_global_variable_define_fn;
383
- decltype(hsa_executable_readonly_variable_define)*
384
- hsa_executable_readonly_variable_define_fn;
385
- decltype(hsa_executable_validate)* hsa_executable_validate_fn;
386
- // Deprecated since v1.1.
387
- decltype(hsa_executable_get_symbol)* hsa_executable_get_symbol_fn;
388
- decltype(hsa_executable_symbol_get_info)* hsa_executable_symbol_get_info_fn;
389
- // Deprecated since v1.1.
390
- decltype(hsa_executable_iterate_symbols)* hsa_executable_iterate_symbols_fn;
391
-
392
- //===--- Runtime Notifications ------------------------------------------===//
393
-
394
- decltype(hsa_status_string)* hsa_status_string_fn;
395
-
396
- // Start HSA v1.1 additions
397
- decltype(hsa_extension_get_name)* hsa_extension_get_name_fn;
398
- decltype(hsa_system_major_extension_supported)* hsa_system_major_extension_supported_fn;
399
- decltype(hsa_system_get_major_extension_table)* hsa_system_get_major_extension_table_fn;
400
- decltype(hsa_agent_major_extension_supported)* hsa_agent_major_extension_supported_fn;
401
- decltype(hsa_cache_get_info)* hsa_cache_get_info_fn;
402
- decltype(hsa_agent_iterate_caches)* hsa_agent_iterate_caches_fn;
403
- decltype(hsa_signal_silent_store_relaxed)* hsa_signal_silent_store_relaxed_fn;
404
- decltype(hsa_signal_silent_store_screlease)* hsa_signal_silent_store_screlease_fn;
405
- decltype(hsa_signal_group_create)* hsa_signal_group_create_fn;
406
- decltype(hsa_signal_group_destroy)* hsa_signal_group_destroy_fn;
407
- decltype(hsa_signal_group_wait_any_scacquire)* hsa_signal_group_wait_any_scacquire_fn;
408
- decltype(hsa_signal_group_wait_any_relaxed)* hsa_signal_group_wait_any_relaxed_fn;
409
-
410
- //===--- Instruction Set Architecture - HSA v1.1 additions --------------===//
411
-
412
- decltype(hsa_agent_iterate_isas)* hsa_agent_iterate_isas_fn;
413
- decltype(hsa_isa_get_info_alt)* hsa_isa_get_info_alt_fn;
414
- decltype(hsa_isa_get_exception_policies)* hsa_isa_get_exception_policies_fn;
415
- decltype(hsa_isa_get_round_method)* hsa_isa_get_round_method_fn;
416
- decltype(hsa_wavefront_get_info)* hsa_wavefront_get_info_fn;
417
- decltype(hsa_isa_iterate_wavefronts)* hsa_isa_iterate_wavefronts_fn;
418
-
419
- //===--- Code Objects (deprecated) - HSA v1.1 additions -----------------===//
420
-
421
- // Deprecated since v1.1.
422
- decltype(hsa_code_object_get_symbol_from_name)*
423
- hsa_code_object_get_symbol_from_name_fn;
424
-
425
- //===--- Executable - HSA v1.1 additions --------------------------------===//
426
-
427
- decltype(hsa_code_object_reader_create_from_file)*
428
- hsa_code_object_reader_create_from_file_fn;
429
- decltype(hsa_code_object_reader_create_from_memory)*
430
- hsa_code_object_reader_create_from_memory_fn;
431
- decltype(hsa_code_object_reader_destroy)* hsa_code_object_reader_destroy_fn;
432
- decltype(hsa_executable_create_alt)* hsa_executable_create_alt_fn;
433
- decltype(hsa_executable_load_program_code_object)*
434
- hsa_executable_load_program_code_object_fn;
435
- decltype(hsa_executable_load_agent_code_object)*
436
- hsa_executable_load_agent_code_object_fn;
437
- decltype(hsa_executable_validate_alt)* hsa_executable_validate_alt_fn;
438
- decltype(hsa_executable_get_symbol_by_name)*
439
- hsa_executable_get_symbol_by_name_fn;
440
- decltype(hsa_executable_iterate_agent_symbols)*
441
- hsa_executable_iterate_agent_symbols_fn;
442
- decltype(hsa_executable_iterate_program_symbols)*
443
- hsa_executable_iterate_program_symbols_fn;
444
- };
445
-
446
- // Table to export HSA Apis from Core Runtime, Amd Extensions
447
- // Finalizer and Images
448
- struct HsaApiTable {
449
-
450
- // Version of Hsa Api Table
451
- ApiTableVersion version;
452
-
453
- // Table of function pointers to HSA Core Runtime
454
- CoreApiTable* core_;
455
-
456
- // Table of function pointers to AMD extensions
457
- AmdExtTable* amd_ext_;
458
-
459
- // Table of function pointers to HSA Finalizer Extension
460
- FinalizerExtTable* finalizer_ext_;
461
-
462
- // Table of function pointers to HSA Image Extension
463
- ImageExtTable* image_ext_;
464
-
465
- // Table of function pointers for tools to use
466
- ToolsApiTable* tools_;
467
- };
468
-
469
- // Structure containing instances of different api tables
470
- struct HsaApiTableContainer {
471
- HsaApiTable root;
472
- CoreApiTable core;
473
- AmdExtTable amd_ext;
474
- FinalizerExtTable finalizer_ext;
475
- ImageExtTable image_ext;
476
- ToolsApiTable tools;
477
-
478
- // Default initialization of a container instance
479
- HsaApiTableContainer() {
480
- root.version.major_id = HSA_API_TABLE_MAJOR_VERSION;
481
- root.version.minor_id = sizeof(HsaApiTable);
482
- root.version.step_id = HSA_API_TABLE_STEP_VERSION;
483
-
484
- core.version.major_id = HSA_CORE_API_TABLE_MAJOR_VERSION;
485
- core.version.minor_id = sizeof(CoreApiTable);
486
- core.version.step_id = HSA_CORE_API_TABLE_STEP_VERSION;
487
- root.core_ = &core;
488
-
489
- amd_ext.version.major_id = HSA_AMD_EXT_API_TABLE_MAJOR_VERSION;
490
- amd_ext.version.minor_id = sizeof(AmdExtTable);
491
- amd_ext.version.step_id = HSA_AMD_EXT_API_TABLE_STEP_VERSION;
492
- root.amd_ext_ = &amd_ext;
493
-
494
- finalizer_ext.version.major_id = HSA_FINALIZER_API_TABLE_MAJOR_VERSION;
495
- finalizer_ext.version.minor_id = sizeof(FinalizerExtTable);
496
- finalizer_ext.version.step_id = HSA_FINALIZER_API_TABLE_STEP_VERSION;
497
- root.finalizer_ext_ = &finalizer_ext;
498
-
499
- image_ext.version.major_id = HSA_IMAGE_API_TABLE_MAJOR_VERSION;
500
- image_ext.version.minor_id = sizeof(ImageExtTable);
501
- image_ext.version.step_id = HSA_IMAGE_API_TABLE_STEP_VERSION;
502
- root.image_ext_ = &image_ext;
503
-
504
- tools.version.major_id = HSA_TOOLS_API_TABLE_MAJOR_VERSION;
505
- tools.version.minor_id = sizeof(ToolsApiTable);
506
- tools.version.step_id = HSA_TOOLS_API_TABLE_STEP_VERSION;
507
- root.tools_ = &tools;
508
- }
509
- };
510
-
511
- // Api to copy function pointers of a table
512
- static
513
- void inline copyApi(void* src, void* dest, size_t size) {
514
- assert(size >= sizeof(ApiTableVersion));
515
- memcpy((char*)src + sizeof(ApiTableVersion),
516
- (char*)dest + sizeof(ApiTableVersion),
517
- (size - sizeof(ApiTableVersion)));
518
- }
519
-
520
- // Copy Api child tables if valid.
521
- static void inline copyElement(ApiTableVersion* dest, ApiTableVersion* src) {
522
- if (src->major_id && (dest->major_id == src->major_id)) {
523
- dest->step_id = src->step_id;
524
- dest->minor_id = Min(dest->minor_id, src->minor_id);
525
- copyApi(dest, src, dest->minor_id);
526
- } else {
527
- dest->major_id = 0;
528
- dest->minor_id = 0;
529
- dest->step_id = 0;
530
- }
531
- }
532
-
533
- // Copy constructor for all Api tables. The function assumes the
534
- // user has initialized an instance of tables container correctly
535
- // for the Major, Minor and Stepping Ids of Root and Child Api tables.
536
- // The function will overwrite the value of Minor Id by taking the
537
- // minimum of source and destination parameters. It will also overwrite
538
- // the stepping Id with value from source parameter.
539
- static void inline copyTables(const HsaApiTable* src, HsaApiTable* dest) {
540
- // Verify Major Id of source and destination tables match
541
- if (dest->version.major_id != src->version.major_id) {
542
- dest->version.major_id = 0;
543
- dest->version.minor_id = 0;
544
- dest->version.step_id = 0;
545
- return;
546
- }
547
-
548
- // Initialize the stepping id and minor id of root table. For the
549
- // minor id which encodes struct size, take the minimum of source
550
- // and destination parameters
551
- dest->version.step_id = src->version.step_id;
552
- dest->version.minor_id = Min(dest->version.minor_id, src->version.minor_id);
553
-
554
- // Copy child tables if present
555
- if ((offsetof(HsaApiTable, core_) < dest->version.minor_id))
556
- copyElement(&dest->core_->version, &src->core_->version);
557
- if ((offsetof(HsaApiTable, amd_ext_) < dest->version.minor_id))
558
- copyElement(&dest->amd_ext_->version, &src->amd_ext_->version);
559
- if ((offsetof(HsaApiTable, finalizer_ext_) < dest->version.minor_id))
560
- copyElement(&dest->finalizer_ext_->version, &src->finalizer_ext_->version);
561
- if ((offsetof(HsaApiTable, image_ext_) < dest->version.minor_id))
562
- copyElement(&dest->image_ext_->version, &src->image_ext_->version);
563
- if ((offsetof(HsaApiTable, tools_) < dest->version.minor_id))
564
- copyElement(&dest->tools_->version, &src->tools_->version);
565
- }
566
- #endif