1 /* HSA BRIG (binary representation of HSAIL) 1.0.1 representation description.
2    Copyright (C) 2016-2018 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 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/>.
19 
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/).
23 
24 HTML version is provided on the following link:
25 http://www.hsafoundation.com/html/Content/PRM/Topics/PRM_title_page.htm */
26 
27 #ifndef HSA_BRIG_FORMAT_H
28 #define HSA_BRIG_FORMAT_H
29 
30 struct BrigModuleHeader;
31 typedef uint16_t BrigKind16_t;
32 typedef uint32_t BrigVersion32_t;
33 
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;
42 
43 enum BrigAlignment
44 {
45   BRIG_ALIGNMENT_NONE = 0,
46   BRIG_ALIGNMENT_1 = 1,
47   BRIG_ALIGNMENT_2 = 2,
48   BRIG_ALIGNMENT_4 = 3,
49   BRIG_ALIGNMENT_8 = 4,
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
55 };
56 
57 typedef uint8_t BrigAllocation8_t;
58 
59 enum BrigAllocation
60 {
61   BRIG_ALLOCATION_NONE = 0,
62   BRIG_ALLOCATION_PROGRAM = 1,
63   BRIG_ALLOCATION_AGENT = 2,
64   BRIG_ALLOCATION_AUTOMATIC = 3
65 };
66 
67 typedef uint8_t BrigAluModifier8_t;
68 
69 enum BrigAluModifierMask
70 {
71   BRIG_ALU_FTZ = 1
72 };
73 
74 typedef uint8_t BrigAtomicOperation8_t;
75 
76 enum BrigAtomicOperation
77 {
78   BRIG_ATOMIC_ADD = 0,
79   BRIG_ATOMIC_AND = 1,
80   BRIG_ATOMIC_CAS = 2,
81   BRIG_ATOMIC_EXCH = 3,
82   BRIG_ATOMIC_LD = 4,
83   BRIG_ATOMIC_MAX = 5,
84   BRIG_ATOMIC_MIN = 6,
85   BRIG_ATOMIC_OR = 7,
86   BRIG_ATOMIC_ST = 8,
87   BRIG_ATOMIC_SUB = 9,
88   BRIG_ATOMIC_WRAPDEC = 10,
89   BRIG_ATOMIC_WRAPINC = 11,
90   BRIG_ATOMIC_XOR = 12,
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
99 };
100 
101 struct BrigBase
102 {
103   uint16_t byteCount;
104   BrigKind16_t kind;
105 };
106 
107 typedef uint8_t BrigCompareOperation8_t;
108 
109 enum BrigCompareOperation
110 {
111   BRIG_COMPARE_EQ = 0,
112   BRIG_COMPARE_NE = 1,
113   BRIG_COMPARE_LT = 2,
114   BRIG_COMPARE_LE = 3,
115   BRIG_COMPARE_GT = 4,
116   BRIG_COMPARE_GE = 5,
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
139 };
140 
141 typedef uint16_t BrigControlDirective16_t;
142 
143 enum BrigControlDirective
144 {
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
155 };
156 
157 typedef uint32_t BrigExceptions32_t;
158 
159 enum BrigExceptionsMask
160 {
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
167 };
168 
169 typedef uint8_t BrigExecutableModifier8_t;
170 
171 enum BrigExecutableModifierMask
172 {
173   BRIG_EXECUTABLE_DEFINITION = 1
174 };
175 
176 typedef uint8_t BrigImageChannelOrder8_t;
177 
178 enum BrigImageChannelOrder
179 {
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
201 };
202 
203 typedef uint8_t BrigImageChannelType8_t;
204 
205 enum BrigImageChannelType
206 {
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
224 };
225 
226 typedef uint8_t BrigImageGeometry8_t;
227 
228 enum BrigImageGeometry
229 {
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
239 };
240 
241 typedef uint8_t BrigImageQuery8_t;
242 
243 enum BrigImageQuery
244 {
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
251 };
252 
253 enum BrigKind
254 {
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
308 };
309 
310 typedef uint8_t BrigLinkage8_t;
311 
312 enum BrigLinkage
313 {
314   BRIG_LINKAGE_NONE = 0,
315   BRIG_LINKAGE_PROGRAM = 1,
316   BRIG_LINKAGE_MODULE = 2,
317   BRIG_LINKAGE_FUNCTION = 3,
318   BRIG_LINKAGE_ARG = 4
319 };
320 
321 typedef uint8_t BrigMachineModel8_t;
322 
323 enum BrigMachineModel
324 {
325   BRIG_MACHINE_SMALL = 0,
326   BRIG_MACHINE_LARGE = 1
327 };
328 
329 typedef uint8_t BrigMemoryModifier8_t;
330 
331 enum BrigMemoryModifierMask
332 {
333   BRIG_MEMORY_CONST = 1
334 };
335 
336 typedef uint8_t BrigMemoryOrder8_t;
337 
338 enum BrigMemoryOrder
339 {
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
345 };
346 
347 typedef uint8_t BrigMemoryScope8_t;
348 
349 enum BrigMemoryScope
350 {
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
357 };
358 
359 struct BrigModuleHeader
360 {
361   char identification[8];
362   BrigVersion32_t brigMajor;
363   BrigVersion32_t brigMinor;
364   uint64_t byteCount;
365   uint8_t hash[64];
366   uint32_t reserved;
367   uint32_t sectionCount;
368   uint64_t sectionIndex;
369 };
370 
371 typedef uint16_t BrigOpcode16_t;
372 
373 enum BrigOpcode
374 {
375   BRIG_OPCODE_NOP = 0,
376   BRIG_OPCODE_ABS = 1,
377   BRIG_OPCODE_ADD = 2,
378   BRIG_OPCODE_BORROW = 3,
379   BRIG_OPCODE_CARRY = 4,
380   BRIG_OPCODE_CEIL = 5,
381   BRIG_OPCODE_COPYSIGN = 6,
382   BRIG_OPCODE_DIV = 7,
383   BRIG_OPCODE_FLOOR = 8,
384   BRIG_OPCODE_FMA = 9,
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,
405   BRIG_OPCODE_OR = 30,
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,
446   BRIG_OPCODE_LD = 71,
447   BRIG_OPCODE_ST = 72,
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,
460   BRIG_OPCODE_BR = 85,
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
513 };
514 
515 typedef uint8_t BrigPack8_t;
516 
517 enum BrigPack
518 {
519   BRIG_PACK_NONE = 0,
520   BRIG_PACK_PP = 1,
521   BRIG_PACK_PS = 2,
522   BRIG_PACK_SP = 3,
523   BRIG_PACK_SS = 4,
524   BRIG_PACK_S = 5,
525   BRIG_PACK_P = 6,
526   BRIG_PACK_PPSAT = 7,
527   BRIG_PACK_PSSAT = 8,
528   BRIG_PACK_SPSAT = 9,
529   BRIG_PACK_SSSAT = 10,
530   BRIG_PACK_SSAT = 11,
531   BRIG_PACK_PSAT = 12
532 };
533 
534 typedef uint8_t BrigProfile8_t;
535 
536 enum BrigProfile
537 {
538   BRIG_PROFILE_BASE = 0,
539   BRIG_PROFILE_FULL = 1
540 };
541 
542 typedef uint16_t BrigRegisterKind16_t;
543 
544 enum BrigRegisterKind
545 {
546   BRIG_REGISTER_KIND_CONTROL = 0,
547   BRIG_REGISTER_KIND_SINGLE = 1,
548   BRIG_REGISTER_KIND_DOUBLE = 2,
549   BRIG_REGISTER_KIND_QUAD = 3
550 };
551 
552 typedef uint8_t BrigRound8_t;
553 
554 enum BrigRound
555 {
556   BRIG_ROUND_NONE = 0,
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
578 };
579 
580 typedef uint8_t BrigSamplerAddressing8_t;
581 
582 enum BrigSamplerAddressing
583 {
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
590 };
591 
592 typedef uint8_t BrigSamplerCoordNormalization8_t;
593 
594 enum BrigSamplerCoordNormalization
595 {
596   BRIG_COORD_UNNORMALIZED = 0,
597   BRIG_COORD_NORMALIZED = 1
598 };
599 
600 typedef uint8_t BrigSamplerFilter8_t;
601 
602 enum BrigSamplerFilter
603 {
604   BRIG_FILTER_NEAREST = 0,
605   BRIG_FILTER_LINEAR = 1,
606   BRIG_FILTER_FIRST_USER_DEFINED = 128
607 };
608 
609 typedef uint8_t BrigSamplerQuery8_t;
610 
611 enum BrigSamplerQuery
612 {
613   BRIG_SAMPLER_QUERY_ADDRESSING = 0,
614   BRIG_SAMPLER_QUERY_COORD = 1,
615   BRIG_SAMPLER_QUERY_FILTER = 2
616 };
617 
618 typedef uint32_t BrigSectionIndex32_t;
619 
620 enum BrigSectionIndex
621 {
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
626 };
627 
628 struct BrigSectionHeader
629 {
630   uint64_t byteCount;
631   uint32_t headerByteCount;
632   uint32_t nameLength;
633   uint8_t name[1];
634 };
635 
636 typedef uint8_t BrigSegCvtModifier8_t;
637 
638 enum BrigSegCvtModifierMask
639 {
640   BRIG_SEG_CVT_NONULL = 1
641 };
642 
643 typedef uint8_t BrigSegment8_t;
644 
645 enum BrigSegment
646 {
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
657 };
658 
659 enum
660 {
661   BRIG_TYPE_BASE_SIZE = 5,
662   BRIG_TYPE_PACK_SIZE = 2,
663   BRIG_TYPE_ARRAY_SIZE = 1,
664 
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,
668 
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,
675 
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,
680 
681   BRIG_TYPE_ARRAY = 1 << BRIG_TYPE_ARRAY_SHIFT
682 };
683 
684 typedef uint16_t BrigType16_t;
685 
686 enum BrigType
687 {
688   BRIG_TYPE_NONE = 0,
689 
690   BRIG_TYPE_U8 = 1,
691   BRIG_TYPE_U16 = 2,
692   BRIG_TYPE_U32 = 3,
693   BRIG_TYPE_U64 = 4,
694 
695   BRIG_TYPE_S8 = 5,
696   BRIG_TYPE_S16 = 6,
697   BRIG_TYPE_S32 = 7,
698   BRIG_TYPE_S64 = 8,
699 
700   BRIG_TYPE_F16 = 9,
701   BRIG_TYPE_F32 = 10,
702   BRIG_TYPE_F64 = 11,
703 
704   BRIG_TYPE_B1 = 12,
705   BRIG_TYPE_B8 = 13,
706   BRIG_TYPE_B16 = 14,
707   BRIG_TYPE_B32 = 15,
708   BRIG_TYPE_B64 = 16,
709   BRIG_TYPE_B128 = 17,
710 
711   BRIG_TYPE_SAMP = 18,
712   BRIG_TYPE_ROIMG = 19,
713   BRIG_TYPE_WOIMG = 20,
714   BRIG_TYPE_RWIMG = 21,
715 
716   BRIG_TYPE_SIG32 = 22,
717   BRIG_TYPE_SIG64 = 23,
718 
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,
722 
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,
726 
727   BRIG_TYPE_U32X2 = BRIG_TYPE_U32 | BRIG_TYPE_PACK_64,
728   BRIG_TYPE_U32X4 = BRIG_TYPE_U32 | BRIG_TYPE_PACK_128,
729 
730   BRIG_TYPE_U64X2 = BRIG_TYPE_U64 | BRIG_TYPE_PACK_128,
731 
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,
735 
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,
739 
740   BRIG_TYPE_S32X2 = BRIG_TYPE_S32 | BRIG_TYPE_PACK_64,
741   BRIG_TYPE_S32X4 = BRIG_TYPE_S32 | BRIG_TYPE_PACK_128,
742 
743   BRIG_TYPE_S64X2 = BRIG_TYPE_S64 | BRIG_TYPE_PACK_128,
744 
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,
748 
749   BRIG_TYPE_F32X2 = BRIG_TYPE_F32 | BRIG_TYPE_PACK_64,
750   BRIG_TYPE_F32X4 = BRIG_TYPE_F32 | BRIG_TYPE_PACK_128,
751 
752   BRIG_TYPE_F64X2 = BRIG_TYPE_F64 | BRIG_TYPE_PACK_128,
753 
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,
758 
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,
763 
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,
767 
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,
773 
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,
778 
779   BRIG_TYPE_SIG32_ARRAY = BRIG_TYPE_SIG32 | BRIG_TYPE_ARRAY,
780   BRIG_TYPE_SIG64_ARRAY = BRIG_TYPE_SIG64 | BRIG_TYPE_ARRAY,
781 
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,
785 
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,
789 
790   BRIG_TYPE_U32X2_ARRAY = BRIG_TYPE_U32X2 | BRIG_TYPE_ARRAY,
791   BRIG_TYPE_U32X4_ARRAY = BRIG_TYPE_U32X4 | BRIG_TYPE_ARRAY,
792 
793   BRIG_TYPE_U64X2_ARRAY = BRIG_TYPE_U64X2 | BRIG_TYPE_ARRAY,
794 
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,
798 
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,
802 
803   BRIG_TYPE_S32X2_ARRAY = BRIG_TYPE_S32X2 | BRIG_TYPE_ARRAY,
804   BRIG_TYPE_S32X4_ARRAY = BRIG_TYPE_S32X4 | BRIG_TYPE_ARRAY,
805 
806   BRIG_TYPE_S64X2_ARRAY = BRIG_TYPE_S64X2 | BRIG_TYPE_ARRAY,
807 
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,
811 
812   BRIG_TYPE_F32X2_ARRAY = BRIG_TYPE_F32X2 | BRIG_TYPE_ARRAY,
813   BRIG_TYPE_F32X4_ARRAY = BRIG_TYPE_F32X4 | BRIG_TYPE_ARRAY,
814 
815   BRIG_TYPE_F64X2_ARRAY = BRIG_TYPE_F64X2 | BRIG_TYPE_ARRAY
816 };
817 
818 struct BrigUInt64
819 {
820   uint32_t lo;
821   uint32_t hi;
822 };
823 
824 typedef uint8_t BrigVariableModifier8_t;
825 
826 enum BrigVariableModifierMask
827 {
828   BRIG_VARIABLE_DEFINITION = 1,
829   BRIG_VARIABLE_CONST = 2
830 };
831 
832 enum BrigVersion
833 {
834   BRIG_VERSION_HSAIL_MAJOR = 1,
835   BRIG_VERSION_HSAIL_MINOR = 0,
836   BRIG_VERSION_BRIG_MAJOR = 1,
837   BRIG_VERSION_BRIG_MINOR = 0
838 };
839 
840 typedef uint8_t BrigWidth8_t;
841 
842 enum BrigWidth
843 {
844   BRIG_WIDTH_NONE = 0,
845   BRIG_WIDTH_1 = 1,
846   BRIG_WIDTH_2 = 2,
847   BRIG_WIDTH_4 = 3,
848   BRIG_WIDTH_8 = 4,
849   BRIG_WIDTH_16 = 5,
850   BRIG_WIDTH_32 = 6,
851   BRIG_WIDTH_64 = 7,
852   BRIG_WIDTH_128 = 8,
853   BRIG_WIDTH_256 = 9,
854   BRIG_WIDTH_512 = 10,
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,
878   BRIG_WIDTH_ALL = 34
879 };
880 
881 struct BrigData
882 {
883   uint32_t byteCount;
884   uint8_t bytes[1];
885 };
886 
887 struct BrigDirectiveArgBlock
888 {
889   BrigBase base;
890 };
891 
892 struct BrigDirectiveComment
893 {
894   BrigBase base;
895   BrigDataOffsetString32_t name;
896 };
897 
898 struct BrigDirectiveControl
899 {
900   BrigBase base;
901   BrigControlDirective16_t control;
902   uint16_t reserved;
903   BrigDataOffsetOperandList32_t operands;
904 };
905 
906 struct BrigDirectiveExecutable
907 {
908   BrigBase base;
909   BrigDataOffsetString32_t name;
910   uint16_t outArgCount;
911   uint16_t inArgCount;
912   BrigCodeOffset32_t firstInArg;
913   BrigCodeOffset32_t firstCodeBlockEntry;
914   BrigCodeOffset32_t nextModuleEntry;
915   BrigExecutableModifier8_t modifier;
916   BrigLinkage8_t linkage;
917   uint16_t reserved;
918 };
919 
920 struct BrigDirectiveExtension
921 {
922   BrigBase base;
923   BrigDataOffsetString32_t name;
924 };
925 
926 struct BrigDirectiveFbarrier
927 {
928   BrigBase base;
929   BrigDataOffsetString32_t name;
930   BrigVariableModifier8_t modifier;
931   BrigLinkage8_t linkage;
932   uint16_t reserved;
933 };
934 
935 struct BrigDirectiveLabel
936 {
937   BrigBase base;
938   BrigDataOffsetString32_t name;
939 };
940 
941 struct BrigDirectiveLoc
942 {
943   BrigBase base;
944   BrigDataOffsetString32_t filename;
945   uint32_t line;
946   uint32_t column;
947 };
948 
949 struct BrigDirectiveModule
950 {
951   BrigBase base;
952   BrigDataOffsetString32_t name;
953   BrigVersion32_t hsailMajor;
954   BrigVersion32_t hsailMinor;
955   BrigProfile8_t profile;
956   BrigMachineModel8_t machineModel;
957   BrigRound8_t defaultFloatRound;
958   uint8_t reserved;
959 };
960 
961 struct BrigDirectiveNone
962 {
963   BrigBase base;
964 };
965 
966 struct BrigDirectivePragma
967 {
968   BrigBase base;
969   BrigDataOffsetOperandList32_t operands;
970 };
971 
972 struct BrigDirectiveVariable
973 {
974   BrigBase base;
975   BrigDataOffsetString32_t name;
976   BrigOperandOffset32_t init;
977   BrigType16_t type;
978   BrigSegment8_t segment;
979   BrigAlignment8_t align;
980   BrigUInt64 dim;
981   BrigVariableModifier8_t modifier;
982   BrigLinkage8_t linkage;
983   BrigAllocation8_t allocation;
984   uint8_t reserved;
985 };
986 
987 struct BrigInstBase
988 {
989   BrigBase base;
990   BrigOpcode16_t opcode;
991   BrigType16_t type;
992   BrigDataOffsetOperandList32_t operands;
993 };
994 
995 struct BrigInstAddr
996 {
997   BrigInstBase base;
998   BrigSegment8_t segment;
999   uint8_t reserved[3];
1000 };
1001 
1002 struct BrigInstAtomic
1003 {
1004   BrigInstBase base;
1005   BrigSegment8_t segment;
1006   BrigMemoryOrder8_t memoryOrder;
1007   BrigMemoryScope8_t memoryScope;
1008   BrigAtomicOperation8_t atomicOperation;
1009   uint8_t equivClass;
1010   uint8_t reserved[3];
1011 };
1012 
1013 struct BrigInstBasic
1014 {
1015   BrigInstBase base;
1016 };
1017 
1018 struct BrigInstBr
1019 {
1020   BrigInstBase base;
1021   BrigWidth8_t width;
1022   uint8_t reserved[3];
1023 };
1024 
1025 struct BrigInstCmp
1026 {
1027   BrigInstBase base;
1028   BrigType16_t sourceType;
1029   BrigAluModifier8_t modifier;
1030   BrigCompareOperation8_t compare;
1031   BrigPack8_t pack;
1032   uint8_t reserved[3];
1033 };
1034 
1035 struct BrigInstCvt
1036 {
1037   BrigInstBase base;
1038   BrigType16_t sourceType;
1039   BrigAluModifier8_t modifier;
1040   BrigRound8_t round;
1041 };
1042 
1043 struct BrigInstImage
1044 {
1045   BrigInstBase base;
1046   BrigType16_t imageType;
1047   BrigType16_t coordType;
1048   BrigImageGeometry8_t geometry;
1049   uint8_t equivClass;
1050   uint16_t reserved;
1051 };
1052 
1053 struct BrigInstLane
1054 {
1055   BrigInstBase base;
1056   BrigType16_t sourceType;
1057   BrigWidth8_t width;
1058   uint8_t reserved;
1059 };
1060 
1061 struct BrigInstMem
1062 {
1063   BrigInstBase base;
1064   BrigSegment8_t segment;
1065   BrigAlignment8_t align;
1066   uint8_t equivClass;
1067   BrigWidth8_t width;
1068   BrigMemoryModifier8_t modifier;
1069   uint8_t reserved[3];
1070 };
1071 
1072 struct BrigInstMemFence
1073 {
1074   BrigInstBase base;
1075   BrigMemoryOrder8_t memoryOrder;
1076   BrigMemoryScope8_t globalSegmentMemoryScope;
1077   BrigMemoryScope8_t groupSegmentMemoryScope;
1078   BrigMemoryScope8_t imageSegmentMemoryScope;
1079 };
1080 
1081 struct BrigInstMod
1082 {
1083   BrigInstBase base;
1084   BrigAluModifier8_t modifier;
1085   BrigRound8_t round;
1086   BrigPack8_t pack;
1087   uint8_t reserved;
1088 };
1089 
1090 struct BrigInstQueryImage
1091 {
1092   BrigInstBase base;
1093   BrigType16_t imageType;
1094   BrigImageGeometry8_t geometry;
1095   BrigImageQuery8_t query;
1096 };
1097 
1098 struct BrigInstQuerySampler
1099 {
1100   BrigInstBase base;
1101   BrigSamplerQuery8_t query;
1102   uint8_t reserved[3];
1103 };
1104 
1105 struct BrigInstQueue
1106 {
1107   BrigInstBase base;
1108   BrigSegment8_t segment;
1109   BrigMemoryOrder8_t memoryOrder;
1110   uint16_t reserved;
1111 };
1112 
1113 struct BrigInstSeg
1114 {
1115   BrigInstBase base;
1116   BrigSegment8_t segment;
1117   uint8_t reserved[3];
1118 };
1119 
1120 struct BrigInstSegCvt
1121 {
1122   BrigInstBase base;
1123   BrigType16_t sourceType;
1124   BrigSegment8_t segment;
1125   BrigSegCvtModifier8_t modifier;
1126 };
1127 
1128 struct BrigInstSignal
1129 {
1130   BrigInstBase base;
1131   BrigType16_t signalType;
1132   BrigMemoryOrder8_t memoryOrder;
1133   BrigAtomicOperation8_t signalOperation;
1134 };
1135 
1136 struct BrigInstSourceType
1137 {
1138   BrigInstBase base;
1139   BrigType16_t sourceType;
1140   uint16_t reserved;
1141 };
1142 
1143 struct BrigOperandAddress
1144 {
1145   BrigBase base;
1146   BrigCodeOffset32_t symbol;
1147   BrigOperandOffset32_t reg;
1148   BrigUInt64 offset;
1149 };
1150 
1151 struct BrigOperandAlign
1152 {
1153   BrigBase base;
1154   BrigAlignment8_t align;
1155   uint8_t reserved[3];
1156 };
1157 
1158 struct BrigOperandCodeList
1159 {
1160   BrigBase base;
1161   BrigDataOffsetCodeList32_t elements;
1162 };
1163 
1164 struct BrigOperandCodeRef
1165 {
1166   BrigBase base;
1167   BrigCodeOffset32_t ref;
1168 };
1169 
1170 struct BrigOperandConstantBytes
1171 {
1172   BrigBase base;
1173   BrigType16_t type;
1174   uint16_t reserved;
1175   BrigDataOffsetString32_t bytes;
1176 };
1177 
1178 struct BrigOperandConstantImage
1179 {
1180   BrigBase base;
1181   BrigType16_t type;
1182   BrigImageGeometry8_t geometry;
1183   BrigImageChannelOrder8_t channelOrder;
1184   BrigImageChannelType8_t channelType;
1185   uint8_t reserved[3];
1186   BrigUInt64 width;
1187   BrigUInt64 height;
1188   BrigUInt64 depth;
1189   BrigUInt64 array;
1190 };
1191 
1192 struct BrigOperandConstantOperandList
1193 {
1194   BrigBase base;
1195   BrigType16_t type;
1196   uint16_t reserved;
1197   BrigDataOffsetOperandList32_t elements;
1198 };
1199 
1200 struct BrigOperandConstantSampler
1201 {
1202   BrigBase base;
1203   BrigType16_t type;
1204   BrigSamplerCoordNormalization8_t coord;
1205   BrigSamplerFilter8_t filter;
1206   BrigSamplerAddressing8_t addressing;
1207   uint8_t reserved[3];
1208 };
1209 
1210 struct BrigOperandOperandList
1211 {
1212   BrigBase base;
1213   BrigDataOffsetOperandList32_t elements;
1214 };
1215 
1216 struct BrigOperandRegister
1217 {
1218   BrigBase base;
1219   BrigRegisterKind16_t regKind;
1220   uint16_t regNum;
1221 };
1222 
1223 struct BrigOperandString
1224 {
1225   BrigBase base;
1226   BrigDataOffsetString32_t string;
1227 };
1228 
1229 struct BrigOperandWavesize
1230 {
1231   BrigBase base;
1232 };
1233 
1234 #endif /* HSA_BRIG_FORMAT_H */
1235