1 /* HSA BRIG (binary representation of HSAIL) 1.0.1 representation description.
2 Copyright (C) 2016-2019 Free Software Foundation, Inc.
4 This file is part of GCC.
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)
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.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>.
20 The contents of the file was created by extracting data structures, enum,
21 typedef and other definitions from HSA Programmer's Reference Manual Version
22 1.0.1 (http://www.hsafoundation.com/standards/).
24 HTML version is provided on the following link:
25 http://www.hsafoundation.com/html/Content/PRM/Topics/PRM_title_page.htm */
27 #ifndef HSA_BRIG_FORMAT_H
28 #define HSA_BRIG_FORMAT_H
30 struct BrigModuleHeader
;
31 typedef uint16_t BrigKind16_t
;
32 typedef uint32_t BrigVersion32_t
;
34 typedef BrigModuleHeader
*BrigModule_t
;
35 typedef uint32_t BrigDataOffset32_t
;
36 typedef uint32_t BrigCodeOffset32_t
;
37 typedef uint32_t BrigOperandOffset32_t
;
38 typedef BrigDataOffset32_t BrigDataOffsetString32_t
;
39 typedef BrigDataOffset32_t BrigDataOffsetCodeList32_t
;
40 typedef BrigDataOffset32_t BrigDataOffsetOperandList32_t
;
41 typedef uint8_t BrigAlignment8_t
;
45 BRIG_ALIGNMENT_NONE
= 0,
50 BRIG_ALIGNMENT_16
= 5,
51 BRIG_ALIGNMENT_32
= 6,
52 BRIG_ALIGNMENT_64
= 7,
53 BRIG_ALIGNMENT_128
= 8,
54 BRIG_ALIGNMENT_256
= 9
57 typedef uint8_t BrigAllocation8_t
;
61 BRIG_ALLOCATION_NONE
= 0,
62 BRIG_ALLOCATION_PROGRAM
= 1,
63 BRIG_ALLOCATION_AGENT
= 2,
64 BRIG_ALLOCATION_AUTOMATIC
= 3
67 typedef uint8_t BrigAluModifier8_t
;
69 enum BrigAluModifierMask
74 typedef uint8_t BrigAtomicOperation8_t
;
76 enum BrigAtomicOperation
88 BRIG_ATOMIC_WRAPDEC
= 10,
89 BRIG_ATOMIC_WRAPINC
= 11,
91 BRIG_ATOMIC_WAIT_EQ
= 13,
92 BRIG_ATOMIC_WAIT_NE
= 14,
93 BRIG_ATOMIC_WAIT_LT
= 15,
94 BRIG_ATOMIC_WAIT_GTE
= 16,
95 BRIG_ATOMIC_WAITTIMEOUT_EQ
= 17,
96 BRIG_ATOMIC_WAITTIMEOUT_NE
= 18,
97 BRIG_ATOMIC_WAITTIMEOUT_LT
= 19,
98 BRIG_ATOMIC_WAITTIMEOUT_GTE
= 20
107 typedef uint8_t BrigCompareOperation8_t
;
109 enum BrigCompareOperation
117 BRIG_COMPARE_EQU
= 6,
118 BRIG_COMPARE_NEU
= 7,
119 BRIG_COMPARE_LTU
= 8,
120 BRIG_COMPARE_LEU
= 9,
121 BRIG_COMPARE_GTU
= 10,
122 BRIG_COMPARE_GEU
= 11,
123 BRIG_COMPARE_NUM
= 12,
124 BRIG_COMPARE_NAN
= 13,
125 BRIG_COMPARE_SEQ
= 14,
126 BRIG_COMPARE_SNE
= 15,
127 BRIG_COMPARE_SLT
= 16,
128 BRIG_COMPARE_SLE
= 17,
129 BRIG_COMPARE_SGT
= 18,
130 BRIG_COMPARE_SGE
= 19,
131 BRIG_COMPARE_SGEU
= 20,
132 BRIG_COMPARE_SEQU
= 21,
133 BRIG_COMPARE_SNEU
= 22,
134 BRIG_COMPARE_SLTU
= 23,
135 BRIG_COMPARE_SLEU
= 24,
136 BRIG_COMPARE_SNUM
= 25,
137 BRIG_COMPARE_SNAN
= 26,
138 BRIG_COMPARE_SGTU
= 27
141 typedef uint16_t BrigControlDirective16_t
;
143 enum BrigControlDirective
145 BRIG_CONTROL_NONE
= 0,
146 BRIG_CONTROL_ENABLEBREAKEXCEPTIONS
= 1,
147 BRIG_CONTROL_ENABLEDETECTEXCEPTIONS
= 2,
148 BRIG_CONTROL_MAXDYNAMICGROUPSIZE
= 3,
149 BRIG_CONTROL_MAXFLATGRIDSIZE
= 4,
150 BRIG_CONTROL_MAXFLATWORKGROUPSIZE
= 5,
151 BRIG_CONTROL_REQUIREDDIM
= 6,
152 BRIG_CONTROL_REQUIREDGRIDSIZE
= 7,
153 BRIG_CONTROL_REQUIREDWORKGROUPSIZE
= 8,
154 BRIG_CONTROL_REQUIRENOPARTIALWORKGROUPS
= 9
157 typedef uint32_t BrigExceptions32_t
;
159 enum BrigExceptionsMask
161 BRIG_EXCEPTIONS_INVALID_OPERATION
= 1 << 0,
162 BRIG_EXCEPTIONS_DIVIDE_BY_ZERO
= 1 << 1,
163 BRIG_EXCEPTIONS_OVERFLOW
= 1 << 2,
164 BRIG_EXCEPTIONS_UNDERFLOW
= 1 << 3,
165 BRIG_EXCEPTIONS_INEXACT
= 1 << 4,
166 BRIG_EXCEPTIONS_FIRST_USER_DEFINED
= 1 << 16
169 typedef uint8_t BrigExecutableModifier8_t
;
171 enum BrigExecutableModifierMask
173 BRIG_EXECUTABLE_DEFINITION
= 1
176 typedef uint8_t BrigImageChannelOrder8_t
;
178 enum BrigImageChannelOrder
180 BRIG_CHANNEL_ORDER_A
= 0,
181 BRIG_CHANNEL_ORDER_R
= 1,
182 BRIG_CHANNEL_ORDER_RX
= 2,
183 BRIG_CHANNEL_ORDER_RG
= 3,
184 BRIG_CHANNEL_ORDER_RGX
= 4,
185 BRIG_CHANNEL_ORDER_RA
= 5,
186 BRIG_CHANNEL_ORDER_RGB
= 6,
187 BRIG_CHANNEL_ORDER_RGBX
= 7,
188 BRIG_CHANNEL_ORDER_RGBA
= 8,
189 BRIG_CHANNEL_ORDER_BGRA
= 9,
190 BRIG_CHANNEL_ORDER_ARGB
= 10,
191 BRIG_CHANNEL_ORDER_ABGR
= 11,
192 BRIG_CHANNEL_ORDER_SRGB
= 12,
193 BRIG_CHANNEL_ORDER_SRGBX
= 13,
194 BRIG_CHANNEL_ORDER_SRGBA
= 14,
195 BRIG_CHANNEL_ORDER_SBGRA
= 15,
196 BRIG_CHANNEL_ORDER_INTENSITY
= 16,
197 BRIG_CHANNEL_ORDER_LUMINANCE
= 17,
198 BRIG_CHANNEL_ORDER_DEPTH
= 18,
199 BRIG_CHANNEL_ORDER_DEPTH_STENCIL
= 19,
200 BRIG_CHANNEL_ORDER_FIRST_USER_DEFINED
= 128
203 typedef uint8_t BrigImageChannelType8_t
;
205 enum BrigImageChannelType
207 BRIG_CHANNEL_TYPE_SNORM_INT8
= 0,
208 BRIG_CHANNEL_TYPE_SNORM_INT16
= 1,
209 BRIG_CHANNEL_TYPE_UNORM_INT8
= 2,
210 BRIG_CHANNEL_TYPE_UNORM_INT16
= 3,
211 BRIG_CHANNEL_TYPE_UNORM_INT24
= 4,
212 BRIG_CHANNEL_TYPE_UNORM_SHORT_555
= 5,
213 BRIG_CHANNEL_TYPE_UNORM_SHORT_565
= 6,
214 BRIG_CHANNEL_TYPE_UNORM_INT_101010
= 7,
215 BRIG_CHANNEL_TYPE_SIGNED_INT8
= 8,
216 BRIG_CHANNEL_TYPE_SIGNED_INT16
= 9,
217 BRIG_CHANNEL_TYPE_SIGNED_INT32
= 10,
218 BRIG_CHANNEL_TYPE_UNSIGNED_INT8
= 11,
219 BRIG_CHANNEL_TYPE_UNSIGNED_INT16
= 12,
220 BRIG_CHANNEL_TYPE_UNSIGNED_INT32
= 13,
221 BRIG_CHANNEL_TYPE_HALF_FLOAT
= 14,
222 BRIG_CHANNEL_TYPE_FLOAT
= 15,
223 BRIG_CHANNEL_TYPE_FIRST_USER_DEFINED
= 128
226 typedef uint8_t BrigImageGeometry8_t
;
228 enum BrigImageGeometry
230 BRIG_GEOMETRY_1D
= 0,
231 BRIG_GEOMETRY_2D
= 1,
232 BRIG_GEOMETRY_3D
= 2,
233 BRIG_GEOMETRY_1DA
= 3,
234 BRIG_GEOMETRY_2DA
= 4,
235 BRIG_GEOMETRY_1DB
= 5,
236 BRIG_GEOMETRY_2DDEPTH
= 6,
237 BRIG_GEOMETRY_2DADEPTH
= 7,
238 BRIG_GEOMETRY_FIRST_USER_DEFINED
= 128
241 typedef uint8_t BrigImageQuery8_t
;
245 BRIG_IMAGE_QUERY_WIDTH
= 0,
246 BRIG_IMAGE_QUERY_HEIGHT
= 1,
247 BRIG_IMAGE_QUERY_DEPTH
= 2,
248 BRIG_IMAGE_QUERY_ARRAY
= 3,
249 BRIG_IMAGE_QUERY_CHANNELORDER
= 4,
250 BRIG_IMAGE_QUERY_CHANNELTYPE
= 5
255 BRIG_KIND_NONE
= 0x0000,
256 BRIG_KIND_DIRECTIVE_BEGIN
= 0x1000,
257 BRIG_KIND_DIRECTIVE_ARG_BLOCK_END
= 0x1000,
258 BRIG_KIND_DIRECTIVE_ARG_BLOCK_START
= 0x1001,
259 BRIG_KIND_DIRECTIVE_COMMENT
= 0x1002,
260 BRIG_KIND_DIRECTIVE_CONTROL
= 0x1003,
261 BRIG_KIND_DIRECTIVE_EXTENSION
= 0x1004,
262 BRIG_KIND_DIRECTIVE_FBARRIER
= 0x1005,
263 BRIG_KIND_DIRECTIVE_FUNCTION
= 0x1006,
264 BRIG_KIND_DIRECTIVE_INDIRECT_FUNCTION
= 0x1007,
265 BRIG_KIND_DIRECTIVE_KERNEL
= 0x1008,
266 BRIG_KIND_DIRECTIVE_LABEL
= 0x1009,
267 BRIG_KIND_DIRECTIVE_LOC
= 0x100a,
268 BRIG_KIND_DIRECTIVE_MODULE
= 0x100b,
269 BRIG_KIND_DIRECTIVE_PRAGMA
= 0x100c,
270 BRIG_KIND_DIRECTIVE_SIGNATURE
= 0x100d,
271 BRIG_KIND_DIRECTIVE_VARIABLE
= 0x100e,
272 BRIG_KIND_DIRECTIVE_END
= 0x100f,
273 BRIG_KIND_INST_BEGIN
= 0x2000,
274 BRIG_KIND_INST_ADDR
= 0x2000,
275 BRIG_KIND_INST_ATOMIC
= 0x2001,
276 BRIG_KIND_INST_BASIC
= 0x2002,
277 BRIG_KIND_INST_BR
= 0x2003,
278 BRIG_KIND_INST_CMP
= 0x2004,
279 BRIG_KIND_INST_CVT
= 0x2005,
280 BRIG_KIND_INST_IMAGE
= 0x2006,
281 BRIG_KIND_INST_LANE
= 0x2007,
282 BRIG_KIND_INST_MEM
= 0x2008,
283 BRIG_KIND_INST_MEM_FENCE
= 0x2009,
284 BRIG_KIND_INST_MOD
= 0x200a,
285 BRIG_KIND_INST_QUERY_IMAGE
= 0x200b,
286 BRIG_KIND_INST_QUERY_SAMPLER
= 0x200c,
287 BRIG_KIND_INST_QUEUE
= 0x200d,
288 BRIG_KIND_INST_SEG
= 0x200e,
289 BRIG_KIND_INST_SEG_CVT
= 0x200f,
290 BRIG_KIND_INST_SIGNAL
= 0x2010,
291 BRIG_KIND_INST_SOURCE_TYPE
= 0x2011,
292 BRIG_KIND_INST_END
= 0x2012,
293 BRIG_KIND_OPERAND_BEGIN
= 0x3000,
294 BRIG_KIND_OPERAND_ADDRESS
= 0x3000,
295 BRIG_KIND_OPERAND_ALIGN
= 0x3001,
296 BRIG_KIND_OPERAND_CODE_LIST
= 0x3002,
297 BRIG_KIND_OPERAND_CODE_REF
= 0x3003,
298 BRIG_KIND_OPERAND_CONSTANT_BYTES
= 0x3004,
299 BRIG_KIND_OPERAND_RESERVED
= 0x3005,
300 BRIG_KIND_OPERAND_CONSTANT_IMAGE
= 0x3006,
301 BRIG_KIND_OPERAND_CONSTANT_OPERAND_LIST
= 0x3007,
302 BRIG_KIND_OPERAND_CONSTANT_SAMPLER
= 0x3008,
303 BRIG_KIND_OPERAND_OPERAND_LIST
= 0x3009,
304 BRIG_KIND_OPERAND_REGISTER
= 0x300a,
305 BRIG_KIND_OPERAND_STRING
= 0x300b,
306 BRIG_KIND_OPERAND_WAVESIZE
= 0x300c,
307 BRIG_KIND_OPERAND_END
= 0x300d
310 typedef uint8_t BrigLinkage8_t
;
314 BRIG_LINKAGE_NONE
= 0,
315 BRIG_LINKAGE_PROGRAM
= 1,
316 BRIG_LINKAGE_MODULE
= 2,
317 BRIG_LINKAGE_FUNCTION
= 3,
321 typedef uint8_t BrigMachineModel8_t
;
323 enum BrigMachineModel
325 BRIG_MACHINE_SMALL
= 0,
326 BRIG_MACHINE_LARGE
= 1
329 typedef uint8_t BrigMemoryModifier8_t
;
331 enum BrigMemoryModifierMask
333 BRIG_MEMORY_CONST
= 1
336 typedef uint8_t BrigMemoryOrder8_t
;
340 BRIG_MEMORY_ORDER_NONE
= 0,
341 BRIG_MEMORY_ORDER_RELAXED
= 1,
342 BRIG_MEMORY_ORDER_SC_ACQUIRE
= 2,
343 BRIG_MEMORY_ORDER_SC_RELEASE
= 3,
344 BRIG_MEMORY_ORDER_SC_ACQUIRE_RELEASE
= 4
347 typedef uint8_t BrigMemoryScope8_t
;
351 BRIG_MEMORY_SCOPE_NONE
= 0,
352 BRIG_MEMORY_SCOPE_WORKITEM
= 1,
353 BRIG_MEMORY_SCOPE_WAVEFRONT
= 2,
354 BRIG_MEMORY_SCOPE_WORKGROUP
= 3,
355 BRIG_MEMORY_SCOPE_AGENT
= 4,
356 BRIG_MEMORY_SCOPE_SYSTEM
= 5
359 struct BrigModuleHeader
361 char identification
[8];
362 BrigVersion32_t brigMajor
;
363 BrigVersion32_t brigMinor
;
367 uint32_t sectionCount
;
368 uint64_t sectionIndex
;
371 typedef uint16_t BrigOpcode16_t
;
378 BRIG_OPCODE_BORROW
= 3,
379 BRIG_OPCODE_CARRY
= 4,
380 BRIG_OPCODE_CEIL
= 5,
381 BRIG_OPCODE_COPYSIGN
= 6,
383 BRIG_OPCODE_FLOOR
= 8,
385 BRIG_OPCODE_FRACT
= 10,
386 BRIG_OPCODE_MAD
= 11,
387 BRIG_OPCODE_MAX
= 12,
388 BRIG_OPCODE_MIN
= 13,
389 BRIG_OPCODE_MUL
= 14,
390 BRIG_OPCODE_MULHI
= 15,
391 BRIG_OPCODE_NEG
= 16,
392 BRIG_OPCODE_REM
= 17,
393 BRIG_OPCODE_RINT
= 18,
394 BRIG_OPCODE_SQRT
= 19,
395 BRIG_OPCODE_SUB
= 20,
396 BRIG_OPCODE_TRUNC
= 21,
397 BRIG_OPCODE_MAD24
= 22,
398 BRIG_OPCODE_MAD24HI
= 23,
399 BRIG_OPCODE_MUL24
= 24,
400 BRIG_OPCODE_MUL24HI
= 25,
401 BRIG_OPCODE_SHL
= 26,
402 BRIG_OPCODE_SHR
= 27,
403 BRIG_OPCODE_AND
= 28,
404 BRIG_OPCODE_NOT
= 29,
406 BRIG_OPCODE_POPCOUNT
= 31,
407 BRIG_OPCODE_XOR
= 32,
408 BRIG_OPCODE_BITEXTRACT
= 33,
409 BRIG_OPCODE_BITINSERT
= 34,
410 BRIG_OPCODE_BITMASK
= 35,
411 BRIG_OPCODE_BITREV
= 36,
412 BRIG_OPCODE_BITSELECT
= 37,
413 BRIG_OPCODE_FIRSTBIT
= 38,
414 BRIG_OPCODE_LASTBIT
= 39,
415 BRIG_OPCODE_COMBINE
= 40,
416 BRIG_OPCODE_EXPAND
= 41,
417 BRIG_OPCODE_LDA
= 42,
418 BRIG_OPCODE_MOV
= 43,
419 BRIG_OPCODE_SHUFFLE
= 44,
420 BRIG_OPCODE_UNPACKHI
= 45,
421 BRIG_OPCODE_UNPACKLO
= 46,
422 BRIG_OPCODE_PACK
= 47,
423 BRIG_OPCODE_UNPACK
= 48,
424 BRIG_OPCODE_CMOV
= 49,
425 BRIG_OPCODE_CLASS
= 50,
426 BRIG_OPCODE_NCOS
= 51,
427 BRIG_OPCODE_NEXP2
= 52,
428 BRIG_OPCODE_NFMA
= 53,
429 BRIG_OPCODE_NLOG2
= 54,
430 BRIG_OPCODE_NRCP
= 55,
431 BRIG_OPCODE_NRSQRT
= 56,
432 BRIG_OPCODE_NSIN
= 57,
433 BRIG_OPCODE_NSQRT
= 58,
434 BRIG_OPCODE_BITALIGN
= 59,
435 BRIG_OPCODE_BYTEALIGN
= 60,
436 BRIG_OPCODE_PACKCVT
= 61,
437 BRIG_OPCODE_UNPACKCVT
= 62,
438 BRIG_OPCODE_LERP
= 63,
439 BRIG_OPCODE_SAD
= 64,
440 BRIG_OPCODE_SADHI
= 65,
441 BRIG_OPCODE_SEGMENTP
= 66,
442 BRIG_OPCODE_FTOS
= 67,
443 BRIG_OPCODE_STOF
= 68,
444 BRIG_OPCODE_CMP
= 69,
445 BRIG_OPCODE_CVT
= 70,
448 BRIG_OPCODE_ATOMIC
= 73,
449 BRIG_OPCODE_ATOMICNORET
= 74,
450 BRIG_OPCODE_SIGNAL
= 75,
451 BRIG_OPCODE_SIGNALNORET
= 76,
452 BRIG_OPCODE_MEMFENCE
= 77,
453 BRIG_OPCODE_RDIMAGE
= 78,
454 BRIG_OPCODE_LDIMAGE
= 79,
455 BRIG_OPCODE_STIMAGE
= 80,
456 BRIG_OPCODE_IMAGEFENCE
= 81,
457 BRIG_OPCODE_QUERYIMAGE
= 82,
458 BRIG_OPCODE_QUERYSAMPLER
= 83,
459 BRIG_OPCODE_CBR
= 84,
461 BRIG_OPCODE_SBR
= 86,
462 BRIG_OPCODE_BARRIER
= 87,
463 BRIG_OPCODE_WAVEBARRIER
= 88,
464 BRIG_OPCODE_ARRIVEFBAR
= 89,
465 BRIG_OPCODE_INITFBAR
= 90,
466 BRIG_OPCODE_JOINFBAR
= 91,
467 BRIG_OPCODE_LEAVEFBAR
= 92,
468 BRIG_OPCODE_RELEASEFBAR
= 93,
469 BRIG_OPCODE_WAITFBAR
= 94,
470 BRIG_OPCODE_LDF
= 95,
471 BRIG_OPCODE_ACTIVELANECOUNT
= 96,
472 BRIG_OPCODE_ACTIVELANEID
= 97,
473 BRIG_OPCODE_ACTIVELANEMASK
= 98,
474 BRIG_OPCODE_ACTIVELANEPERMUTE
= 99,
475 BRIG_OPCODE_CALL
= 100,
476 BRIG_OPCODE_SCALL
= 101,
477 BRIG_OPCODE_ICALL
= 102,
478 BRIG_OPCODE_RET
= 103,
479 BRIG_OPCODE_ALLOCA
= 104,
480 BRIG_OPCODE_CURRENTWORKGROUPSIZE
= 105,
481 BRIG_OPCODE_CURRENTWORKITEMFLATID
= 106,
482 BRIG_OPCODE_DIM
= 107,
483 BRIG_OPCODE_GRIDGROUPS
= 108,
484 BRIG_OPCODE_GRIDSIZE
= 109,
485 BRIG_OPCODE_PACKETCOMPLETIONSIG
= 110,
486 BRIG_OPCODE_PACKETID
= 111,
487 BRIG_OPCODE_WORKGROUPID
= 112,
488 BRIG_OPCODE_WORKGROUPSIZE
= 113,
489 BRIG_OPCODE_WORKITEMABSID
= 114,
490 BRIG_OPCODE_WORKITEMFLATABSID
= 115,
491 BRIG_OPCODE_WORKITEMFLATID
= 116,
492 BRIG_OPCODE_WORKITEMID
= 117,
493 BRIG_OPCODE_CLEARDETECTEXCEPT
= 118,
494 BRIG_OPCODE_GETDETECTEXCEPT
= 119,
495 BRIG_OPCODE_SETDETECTEXCEPT
= 120,
496 BRIG_OPCODE_ADDQUEUEWRITEINDEX
= 121,
497 BRIG_OPCODE_CASQUEUEWRITEINDEX
= 122,
498 BRIG_OPCODE_LDQUEUEREADINDEX
= 123,
499 BRIG_OPCODE_LDQUEUEWRITEINDEX
= 124,
500 BRIG_OPCODE_STQUEUEREADINDEX
= 125,
501 BRIG_OPCODE_STQUEUEWRITEINDEX
= 126,
502 BRIG_OPCODE_CLOCK
= 127,
503 BRIG_OPCODE_CUID
= 128,
504 BRIG_OPCODE_DEBUGTRAP
= 129,
505 BRIG_OPCODE_GROUPBASEPTR
= 130,
506 BRIG_OPCODE_KERNARGBASEPTR
= 131,
507 BRIG_OPCODE_LANEID
= 132,
508 BRIG_OPCODE_MAXCUID
= 133,
509 BRIG_OPCODE_MAXWAVEID
= 134,
510 BRIG_OPCODE_NULLPTR
= 135,
511 BRIG_OPCODE_WAVEID
= 136,
512 BRIG_OPCODE_FIRST_USER_DEFINED
= 32768
515 typedef uint8_t BrigPack8_t
;
529 BRIG_PACK_SSSAT
= 10,
534 typedef uint8_t BrigProfile8_t
;
538 BRIG_PROFILE_BASE
= 0,
539 BRIG_PROFILE_FULL
= 1
542 typedef uint16_t BrigRegisterKind16_t
;
544 enum BrigRegisterKind
546 BRIG_REGISTER_KIND_CONTROL
= 0,
547 BRIG_REGISTER_KIND_SINGLE
= 1,
548 BRIG_REGISTER_KIND_DOUBLE
= 2,
549 BRIG_REGISTER_KIND_QUAD
= 3
552 typedef uint8_t BrigRound8_t
;
557 BRIG_ROUND_FLOAT_DEFAULT
= 1,
558 BRIG_ROUND_FLOAT_NEAR_EVEN
= 2,
559 BRIG_ROUND_FLOAT_ZERO
= 3,
560 BRIG_ROUND_FLOAT_PLUS_INFINITY
= 4,
561 BRIG_ROUND_FLOAT_MINUS_INFINITY
= 5,
562 BRIG_ROUND_INTEGER_NEAR_EVEN
= 6,
563 BRIG_ROUND_INTEGER_ZERO
= 7,
564 BRIG_ROUND_INTEGER_PLUS_INFINITY
= 8,
565 BRIG_ROUND_INTEGER_MINUS_INFINITY
= 9,
566 BRIG_ROUND_INTEGER_NEAR_EVEN_SAT
= 10,
567 BRIG_ROUND_INTEGER_ZERO_SAT
= 11,
568 BRIG_ROUND_INTEGER_PLUS_INFINITY_SAT
= 12,
569 BRIG_ROUND_INTEGER_MINUS_INFINITY_SAT
= 13,
570 BRIG_ROUND_INTEGER_SIGNALING_NEAR_EVEN
= 14,
571 BRIG_ROUND_INTEGER_SIGNALING_ZERO
= 15,
572 BRIG_ROUND_INTEGER_SIGNALING_PLUS_INFINITY
= 16,
573 BRIG_ROUND_INTEGER_SIGNALING_MINUS_INFINITY
= 17,
574 BRIG_ROUND_INTEGER_SIGNALING_NEAR_EVEN_SAT
= 18,
575 BRIG_ROUND_INTEGER_SIGNALING_ZERO_SAT
= 19,
576 BRIG_ROUND_INTEGER_SIGNALING_PLUS_INFINITY_SAT
= 20,
577 BRIG_ROUND_INTEGER_SIGNALING_MINUS_INFINITY_SAT
= 21
580 typedef uint8_t BrigSamplerAddressing8_t
;
582 enum BrigSamplerAddressing
584 BRIG_ADDRESSING_UNDEFINED
= 0,
585 BRIG_ADDRESSING_CLAMP_TO_EDGE
= 1,
586 BRIG_ADDRESSING_CLAMP_TO_BORDER
= 2,
587 BRIG_ADDRESSING_REPEAT
= 3,
588 BRIG_ADDRESSING_MIRRORED_REPEAT
= 4,
589 BRIG_ADDRESSING_FIRST_USER_DEFINED
= 128
592 typedef uint8_t BrigSamplerCoordNormalization8_t
;
594 enum BrigSamplerCoordNormalization
596 BRIG_COORD_UNNORMALIZED
= 0,
597 BRIG_COORD_NORMALIZED
= 1
600 typedef uint8_t BrigSamplerFilter8_t
;
602 enum BrigSamplerFilter
604 BRIG_FILTER_NEAREST
= 0,
605 BRIG_FILTER_LINEAR
= 1,
606 BRIG_FILTER_FIRST_USER_DEFINED
= 128
609 typedef uint8_t BrigSamplerQuery8_t
;
611 enum BrigSamplerQuery
613 BRIG_SAMPLER_QUERY_ADDRESSING
= 0,
614 BRIG_SAMPLER_QUERY_COORD
= 1,
615 BRIG_SAMPLER_QUERY_FILTER
= 2
618 typedef uint32_t BrigSectionIndex32_t
;
620 enum BrigSectionIndex
622 BRIG_SECTION_INDEX_DATA
= 0,
623 BRIG_SECTION_INDEX_CODE
= 1,
624 BRIG_SECTION_INDEX_OPERAND
= 2,
625 BRIG_SECTION_INDEX_BEGIN_IMPLEMENTATION_DEFINED
= 3
628 struct BrigSectionHeader
631 uint32_t headerByteCount
;
636 typedef uint8_t BrigSegCvtModifier8_t
;
638 enum BrigSegCvtModifierMask
640 BRIG_SEG_CVT_NONULL
= 1
643 typedef uint8_t BrigSegment8_t
;
647 BRIG_SEGMENT_NONE
= 0,
648 BRIG_SEGMENT_FLAT
= 1,
649 BRIG_SEGMENT_GLOBAL
= 2,
650 BRIG_SEGMENT_READONLY
= 3,
651 BRIG_SEGMENT_KERNARG
= 4,
652 BRIG_SEGMENT_GROUP
= 5,
653 BRIG_SEGMENT_PRIVATE
= 6,
654 BRIG_SEGMENT_SPILL
= 7,
655 BRIG_SEGMENT_ARG
= 8,
656 BRIG_SEGMENT_FIRST_USER_DEFINED
= 128
661 BRIG_TYPE_BASE_SIZE
= 5,
662 BRIG_TYPE_PACK_SIZE
= 2,
663 BRIG_TYPE_ARRAY_SIZE
= 1,
665 BRIG_TYPE_BASE_SHIFT
= 0,
666 BRIG_TYPE_PACK_SHIFT
= BRIG_TYPE_BASE_SHIFT
+ BRIG_TYPE_BASE_SIZE
,
667 BRIG_TYPE_ARRAY_SHIFT
= BRIG_TYPE_PACK_SHIFT
+ BRIG_TYPE_PACK_SIZE
,
669 BRIG_TYPE_BASE_MASK
= ((1 << BRIG_TYPE_BASE_SIZE
) - 1)
670 << BRIG_TYPE_BASE_SHIFT
,
671 BRIG_TYPE_PACK_MASK
= ((1 << BRIG_TYPE_PACK_SIZE
) - 1)
672 << BRIG_TYPE_PACK_SHIFT
,
673 BRIG_TYPE_ARRAY_MASK
= ((1 << BRIG_TYPE_ARRAY_SIZE
) - 1)
674 << BRIG_TYPE_ARRAY_SHIFT
,
676 BRIG_TYPE_PACK_NONE
= 0 << BRIG_TYPE_PACK_SHIFT
,
677 BRIG_TYPE_PACK_32
= 1 << BRIG_TYPE_PACK_SHIFT
,
678 BRIG_TYPE_PACK_64
= 2 << BRIG_TYPE_PACK_SHIFT
,
679 BRIG_TYPE_PACK_128
= 3 << BRIG_TYPE_PACK_SHIFT
,
681 BRIG_TYPE_ARRAY
= 1 << BRIG_TYPE_ARRAY_SHIFT
684 typedef uint16_t BrigType16_t
;
712 BRIG_TYPE_ROIMG
= 19,
713 BRIG_TYPE_WOIMG
= 20,
714 BRIG_TYPE_RWIMG
= 21,
716 BRIG_TYPE_SIG32
= 22,
717 BRIG_TYPE_SIG64
= 23,
719 BRIG_TYPE_U8X4
= BRIG_TYPE_U8
| BRIG_TYPE_PACK_32
,
720 BRIG_TYPE_U8X8
= BRIG_TYPE_U8
| BRIG_TYPE_PACK_64
,
721 BRIG_TYPE_U8X16
= BRIG_TYPE_U8
| BRIG_TYPE_PACK_128
,
723 BRIG_TYPE_U16X2
= BRIG_TYPE_U16
| BRIG_TYPE_PACK_32
,
724 BRIG_TYPE_U16X4
= BRIG_TYPE_U16
| BRIG_TYPE_PACK_64
,
725 BRIG_TYPE_U16X8
= BRIG_TYPE_U16
| BRIG_TYPE_PACK_128
,
727 BRIG_TYPE_U32X2
= BRIG_TYPE_U32
| BRIG_TYPE_PACK_64
,
728 BRIG_TYPE_U32X4
= BRIG_TYPE_U32
| BRIG_TYPE_PACK_128
,
730 BRIG_TYPE_U64X2
= BRIG_TYPE_U64
| BRIG_TYPE_PACK_128
,
732 BRIG_TYPE_S8X4
= BRIG_TYPE_S8
| BRIG_TYPE_PACK_32
,
733 BRIG_TYPE_S8X8
= BRIG_TYPE_S8
| BRIG_TYPE_PACK_64
,
734 BRIG_TYPE_S8X16
= BRIG_TYPE_S8
| BRIG_TYPE_PACK_128
,
736 BRIG_TYPE_S16X2
= BRIG_TYPE_S16
| BRIG_TYPE_PACK_32
,
737 BRIG_TYPE_S16X4
= BRIG_TYPE_S16
| BRIG_TYPE_PACK_64
,
738 BRIG_TYPE_S16X8
= BRIG_TYPE_S16
| BRIG_TYPE_PACK_128
,
740 BRIG_TYPE_S32X2
= BRIG_TYPE_S32
| BRIG_TYPE_PACK_64
,
741 BRIG_TYPE_S32X4
= BRIG_TYPE_S32
| BRIG_TYPE_PACK_128
,
743 BRIG_TYPE_S64X2
= BRIG_TYPE_S64
| BRIG_TYPE_PACK_128
,
745 BRIG_TYPE_F16X2
= BRIG_TYPE_F16
| BRIG_TYPE_PACK_32
,
746 BRIG_TYPE_F16X4
= BRIG_TYPE_F16
| BRIG_TYPE_PACK_64
,
747 BRIG_TYPE_F16X8
= BRIG_TYPE_F16
| BRIG_TYPE_PACK_128
,
749 BRIG_TYPE_F32X2
= BRIG_TYPE_F32
| BRIG_TYPE_PACK_64
,
750 BRIG_TYPE_F32X4
= BRIG_TYPE_F32
| BRIG_TYPE_PACK_128
,
752 BRIG_TYPE_F64X2
= BRIG_TYPE_F64
| BRIG_TYPE_PACK_128
,
754 BRIG_TYPE_U8_ARRAY
= BRIG_TYPE_U8
| BRIG_TYPE_ARRAY
,
755 BRIG_TYPE_U16_ARRAY
= BRIG_TYPE_U16
| BRIG_TYPE_ARRAY
,
756 BRIG_TYPE_U32_ARRAY
= BRIG_TYPE_U32
| BRIG_TYPE_ARRAY
,
757 BRIG_TYPE_U64_ARRAY
= BRIG_TYPE_U64
| BRIG_TYPE_ARRAY
,
759 BRIG_TYPE_S8_ARRAY
= BRIG_TYPE_S8
| BRIG_TYPE_ARRAY
,
760 BRIG_TYPE_S16_ARRAY
= BRIG_TYPE_S16
| BRIG_TYPE_ARRAY
,
761 BRIG_TYPE_S32_ARRAY
= BRIG_TYPE_S32
| BRIG_TYPE_ARRAY
,
762 BRIG_TYPE_S64_ARRAY
= BRIG_TYPE_S64
| BRIG_TYPE_ARRAY
,
764 BRIG_TYPE_F16_ARRAY
= BRIG_TYPE_F16
| BRIG_TYPE_ARRAY
,
765 BRIG_TYPE_F32_ARRAY
= BRIG_TYPE_F32
| BRIG_TYPE_ARRAY
,
766 BRIG_TYPE_F64_ARRAY
= BRIG_TYPE_F64
| BRIG_TYPE_ARRAY
,
768 BRIG_TYPE_B8_ARRAY
= BRIG_TYPE_B8
| BRIG_TYPE_ARRAY
,
769 BRIG_TYPE_B16_ARRAY
= BRIG_TYPE_B16
| BRIG_TYPE_ARRAY
,
770 BRIG_TYPE_B32_ARRAY
= BRIG_TYPE_B32
| BRIG_TYPE_ARRAY
,
771 BRIG_TYPE_B64_ARRAY
= BRIG_TYPE_B64
| BRIG_TYPE_ARRAY
,
772 BRIG_TYPE_B128_ARRAY
= BRIG_TYPE_B128
| BRIG_TYPE_ARRAY
,
774 BRIG_TYPE_SAMP_ARRAY
= BRIG_TYPE_SAMP
| BRIG_TYPE_ARRAY
,
775 BRIG_TYPE_ROIMG_ARRAY
= BRIG_TYPE_ROIMG
| BRIG_TYPE_ARRAY
,
776 BRIG_TYPE_WOIMG_ARRAY
= BRIG_TYPE_WOIMG
| BRIG_TYPE_ARRAY
,
777 BRIG_TYPE_RWIMG_ARRAY
= BRIG_TYPE_RWIMG
| BRIG_TYPE_ARRAY
,
779 BRIG_TYPE_SIG32_ARRAY
= BRIG_TYPE_SIG32
| BRIG_TYPE_ARRAY
,
780 BRIG_TYPE_SIG64_ARRAY
= BRIG_TYPE_SIG64
| BRIG_TYPE_ARRAY
,
782 BRIG_TYPE_U8X4_ARRAY
= BRIG_TYPE_U8X4
| BRIG_TYPE_ARRAY
,
783 BRIG_TYPE_U8X8_ARRAY
= BRIG_TYPE_U8X8
| BRIG_TYPE_ARRAY
,
784 BRIG_TYPE_U8X16_ARRAY
= BRIG_TYPE_U8X16
| BRIG_TYPE_ARRAY
,
786 BRIG_TYPE_U16X2_ARRAY
= BRIG_TYPE_U16X2
| BRIG_TYPE_ARRAY
,
787 BRIG_TYPE_U16X4_ARRAY
= BRIG_TYPE_U16X4
| BRIG_TYPE_ARRAY
,
788 BRIG_TYPE_U16X8_ARRAY
= BRIG_TYPE_U16X8
| BRIG_TYPE_ARRAY
,
790 BRIG_TYPE_U32X2_ARRAY
= BRIG_TYPE_U32X2
| BRIG_TYPE_ARRAY
,
791 BRIG_TYPE_U32X4_ARRAY
= BRIG_TYPE_U32X4
| BRIG_TYPE_ARRAY
,
793 BRIG_TYPE_U64X2_ARRAY
= BRIG_TYPE_U64X2
| BRIG_TYPE_ARRAY
,
795 BRIG_TYPE_S8X4_ARRAY
= BRIG_TYPE_S8X4
| BRIG_TYPE_ARRAY
,
796 BRIG_TYPE_S8X8_ARRAY
= BRIG_TYPE_S8X8
| BRIG_TYPE_ARRAY
,
797 BRIG_TYPE_S8X16_ARRAY
= BRIG_TYPE_S8X16
| BRIG_TYPE_ARRAY
,
799 BRIG_TYPE_S16X2_ARRAY
= BRIG_TYPE_S16X2
| BRIG_TYPE_ARRAY
,
800 BRIG_TYPE_S16X4_ARRAY
= BRIG_TYPE_S16X4
| BRIG_TYPE_ARRAY
,
801 BRIG_TYPE_S16X8_ARRAY
= BRIG_TYPE_S16X8
| BRIG_TYPE_ARRAY
,
803 BRIG_TYPE_S32X2_ARRAY
= BRIG_TYPE_S32X2
| BRIG_TYPE_ARRAY
,
804 BRIG_TYPE_S32X4_ARRAY
= BRIG_TYPE_S32X4
| BRIG_TYPE_ARRAY
,
806 BRIG_TYPE_S64X2_ARRAY
= BRIG_TYPE_S64X2
| BRIG_TYPE_ARRAY
,
808 BRIG_TYPE_F16X2_ARRAY
= BRIG_TYPE_F16X2
| BRIG_TYPE_ARRAY
,
809 BRIG_TYPE_F16X4_ARRAY
= BRIG_TYPE_F16X4
| BRIG_TYPE_ARRAY
,
810 BRIG_TYPE_F16X8_ARRAY
= BRIG_TYPE_F16X8
| BRIG_TYPE_ARRAY
,
812 BRIG_TYPE_F32X2_ARRAY
= BRIG_TYPE_F32X2
| BRIG_TYPE_ARRAY
,
813 BRIG_TYPE_F32X4_ARRAY
= BRIG_TYPE_F32X4
| BRIG_TYPE_ARRAY
,
815 BRIG_TYPE_F64X2_ARRAY
= BRIG_TYPE_F64X2
| BRIG_TYPE_ARRAY
824 typedef uint8_t BrigVariableModifier8_t
;
826 enum BrigVariableModifierMask
828 BRIG_VARIABLE_DEFINITION
= 1,
829 BRIG_VARIABLE_CONST
= 2
834 BRIG_VERSION_HSAIL_MAJOR
= 1,
835 BRIG_VERSION_HSAIL_MINOR
= 0,
836 BRIG_VERSION_BRIG_MAJOR
= 1,
837 BRIG_VERSION_BRIG_MINOR
= 0
840 typedef uint8_t BrigWidth8_t
;
855 BRIG_WIDTH_1024
= 11,
856 BRIG_WIDTH_2048
= 12,
857 BRIG_WIDTH_4096
= 13,
858 BRIG_WIDTH_8192
= 14,
859 BRIG_WIDTH_16384
= 15,
860 BRIG_WIDTH_32768
= 16,
861 BRIG_WIDTH_65536
= 17,
862 BRIG_WIDTH_131072
= 18,
863 BRIG_WIDTH_262144
= 19,
864 BRIG_WIDTH_524288
= 20,
865 BRIG_WIDTH_1048576
= 21,
866 BRIG_WIDTH_2097152
= 22,
867 BRIG_WIDTH_4194304
= 23,
868 BRIG_WIDTH_8388608
= 24,
869 BRIG_WIDTH_16777216
= 25,
870 BRIG_WIDTH_33554432
= 26,
871 BRIG_WIDTH_67108864
= 27,
872 BRIG_WIDTH_134217728
= 28,
873 BRIG_WIDTH_268435456
= 29,
874 BRIG_WIDTH_536870912
= 30,
875 BRIG_WIDTH_1073741824
= 31,
876 BRIG_WIDTH_2147483648
= 32,
877 BRIG_WIDTH_WAVESIZE
= 33,
887 struct BrigDirectiveArgBlock
892 struct BrigDirectiveComment
895 BrigDataOffsetString32_t name
;
898 struct BrigDirectiveControl
901 BrigControlDirective16_t control
;
903 BrigDataOffsetOperandList32_t operands
;
906 struct BrigDirectiveExecutable
909 BrigDataOffsetString32_t name
;
910 uint16_t outArgCount
;
912 BrigCodeOffset32_t firstInArg
;
913 BrigCodeOffset32_t firstCodeBlockEntry
;
914 BrigCodeOffset32_t nextModuleEntry
;
915 BrigExecutableModifier8_t modifier
;
916 BrigLinkage8_t linkage
;
920 struct BrigDirectiveExtension
923 BrigDataOffsetString32_t name
;
926 struct BrigDirectiveFbarrier
929 BrigDataOffsetString32_t name
;
930 BrigVariableModifier8_t modifier
;
931 BrigLinkage8_t linkage
;
935 struct BrigDirectiveLabel
938 BrigDataOffsetString32_t name
;
941 struct BrigDirectiveLoc
944 BrigDataOffsetString32_t filename
;
949 struct BrigDirectiveModule
952 BrigDataOffsetString32_t name
;
953 BrigVersion32_t hsailMajor
;
954 BrigVersion32_t hsailMinor
;
955 BrigProfile8_t profile
;
956 BrigMachineModel8_t machineModel
;
957 BrigRound8_t defaultFloatRound
;
961 struct BrigDirectiveNone
966 struct BrigDirectivePragma
969 BrigDataOffsetOperandList32_t operands
;
972 struct BrigDirectiveVariable
975 BrigDataOffsetString32_t name
;
976 BrigOperandOffset32_t init
;
978 BrigSegment8_t segment
;
979 BrigAlignment8_t align
;
981 BrigVariableModifier8_t modifier
;
982 BrigLinkage8_t linkage
;
983 BrigAllocation8_t allocation
;
990 BrigOpcode16_t opcode
;
992 BrigDataOffsetOperandList32_t operands
;
998 BrigSegment8_t segment
;
1002 struct BrigInstAtomic
1005 BrigSegment8_t segment
;
1006 BrigMemoryOrder8_t memoryOrder
;
1007 BrigMemoryScope8_t memoryScope
;
1008 BrigAtomicOperation8_t atomicOperation
;
1010 uint8_t reserved
[3];
1013 struct BrigInstBasic
1022 uint8_t reserved
[3];
1028 BrigType16_t sourceType
;
1029 BrigAluModifier8_t modifier
;
1030 BrigCompareOperation8_t compare
;
1032 uint8_t reserved
[3];
1038 BrigType16_t sourceType
;
1039 BrigAluModifier8_t modifier
;
1043 struct BrigInstImage
1046 BrigType16_t imageType
;
1047 BrigType16_t coordType
;
1048 BrigImageGeometry8_t geometry
;
1056 BrigType16_t sourceType
;
1064 BrigSegment8_t segment
;
1065 BrigAlignment8_t align
;
1068 BrigMemoryModifier8_t modifier
;
1069 uint8_t reserved
[3];
1072 struct BrigInstMemFence
1075 BrigMemoryOrder8_t memoryOrder
;
1076 BrigMemoryScope8_t globalSegmentMemoryScope
;
1077 BrigMemoryScope8_t groupSegmentMemoryScope
;
1078 BrigMemoryScope8_t imageSegmentMemoryScope
;
1084 BrigAluModifier8_t modifier
;
1090 struct BrigInstQueryImage
1093 BrigType16_t imageType
;
1094 BrigImageGeometry8_t geometry
;
1095 BrigImageQuery8_t query
;
1098 struct BrigInstQuerySampler
1101 BrigSamplerQuery8_t query
;
1102 uint8_t reserved
[3];
1105 struct BrigInstQueue
1108 BrigSegment8_t segment
;
1109 BrigMemoryOrder8_t memoryOrder
;
1116 BrigSegment8_t segment
;
1117 uint8_t reserved
[3];
1120 struct BrigInstSegCvt
1123 BrigType16_t sourceType
;
1124 BrigSegment8_t segment
;
1125 BrigSegCvtModifier8_t modifier
;
1128 struct BrigInstSignal
1131 BrigType16_t signalType
;
1132 BrigMemoryOrder8_t memoryOrder
;
1133 BrigAtomicOperation8_t signalOperation
;
1136 struct BrigInstSourceType
1139 BrigType16_t sourceType
;
1143 struct BrigOperandAddress
1146 BrigCodeOffset32_t symbol
;
1147 BrigOperandOffset32_t reg
;
1151 struct BrigOperandAlign
1154 BrigAlignment8_t align
;
1155 uint8_t reserved
[3];
1158 struct BrigOperandCodeList
1161 BrigDataOffsetCodeList32_t elements
;
1164 struct BrigOperandCodeRef
1167 BrigCodeOffset32_t ref
;
1170 struct BrigOperandConstantBytes
1175 BrigDataOffsetString32_t bytes
;
1178 struct BrigOperandConstantImage
1182 BrigImageGeometry8_t geometry
;
1183 BrigImageChannelOrder8_t channelOrder
;
1184 BrigImageChannelType8_t channelType
;
1185 uint8_t reserved
[3];
1192 struct BrigOperandConstantOperandList
1197 BrigDataOffsetOperandList32_t elements
;
1200 struct BrigOperandConstantSampler
1204 BrigSamplerCoordNormalization8_t coord
;
1205 BrigSamplerFilter8_t filter
;
1206 BrigSamplerAddressing8_t addressing
;
1207 uint8_t reserved
[3];
1210 struct BrigOperandOperandList
1213 BrigDataOffsetOperandList32_t elements
;
1216 struct BrigOperandRegister
1219 BrigRegisterKind16_t regKind
;
1223 struct BrigOperandString
1226 BrigDataOffsetString32_t string
;
1229 struct BrigOperandWavesize
1234 #endif /* HSA_BRIG_FORMAT_H */