1 /*========================== begin_copyright_notice ============================
2 
3 Copyright (C) 2017-2021 Intel Corporation
4 
5 SPDX-License-Identifier: MIT
6 
7 ============================= end_copyright_notice ===========================*/
8 
9 #pragma once
10 #include "Compiler/CodeGenPublic.h"
11 #include "visaBuilder_interface.h"
12 #include "../../inc/common/UFO/portable_compiler.h"
13 
14 namespace USC
15 {
16     struct SShaderStageBTLayout;
17 }
18 
19 namespace llvm
20 {
21     class Function;
22 }
23 
24 namespace IGC
25 {
26 
27     enum e_mask : unsigned char
28     {
29         EMASK_Q1,
30         EMASK_Q2,
31         EMASK_Q3,
32         EMASK_Q4,
33         EMASK_H1,
34         EMASK_H2,
35     };
36 
37     enum e_varType : unsigned char
38     {
39         EVARTYPE_GENERAL,
40         EVARTYPE_ADDRESS,
41         EVARTYPE_PREDICATE,
42         EVARTYPE_SURFACE,
43         EVARTYPE_SAMPLER
44     };
45 
46     enum e_alignment : unsigned char
47     {
48         // In the increasing alignment order, except AUTO
49         // (AUTO: naturally aligned)
50         EALIGN_BYTE,
51         EALIGN_WORD,
52         EALIGN_DWORD,
53         EALIGN_QWORD,
54         EALIGN_OWORD,
55         EALIGN_HWORD,
56         EALIGN_32WORD,
57         EALIGN_64WORD,
58         EALIGN_AUTO
59     };
60 
61 #define EALIGN_GRF EALIGN_HWORD
62 #define EALIGN_2GRF EALIGN_32WORD
63 
64     // XMACRO defining the CISA opCode
65     // need to move to the CISA encoding file when breaking down code
66 #define DECLARE_CISA_OPCODE(opCode, name, visaname) \
67     opCode,
68     enum e_opcode
69     {
70 #include "isaDef.h"
71     };
72 #undef DECLARE_CISA_OPCODE
73 
74 #define DECLARE_CISA_OPCODE(opCode, name, visaname) \
75     visaname,
76     __attr_unused static ISA_Opcode ConvertOpcode[] =
77     {
78     #include "isaDef.h"
79     };
80 #undef DECLARE_CISA_OPCODE
81 
82     enum e_modifier : unsigned char
83     {
84         EMOD_NONE,
85         EMOD_SAT,
86         EMOD_ABS,
87         EMOD_NEG,
88         EMOD_NEGABS,
89         EMOD_NOT,
90     };
91 
92     enum e_predMode
93     {
94         EPRED_NORMAL,
95         EPRED_ALL,
96         EPRED_ANY,
97     };
98 
99     enum e_instType : unsigned char
100     {
101         EINSTTYPE_INVALID,
102         EINSTTYPE_ALU,
103         EINSTTYPE_BRANCH,
104         EINSTTYPE_URBWRITE,
105         EINSTTYPE_SEND,
106         EINSTTYPE_RENDERTARGETWRITE,
107         EINSTTYPE_SAMPLE,
108         EINSTTYPE_LD,
109         EINSTTYPE_INFO,
110         EINSTTYPE_GATHER4,
111         EINSTTYPE_TYPED4_READ,
112         EINSTTYPE_OWLOAD,
113         EINSTTYPE_GATHER,
114         EINSTTYPE_SCATTER,
115         EINSTTYPE_SCATTER4,
116         EINSTTYPE_TYPED4_WRITE,
117         EINSTTYPE_EOT,
118         EINSTTYPE_ADDRADD,
119         EINSTTYPE_LDMS,
120         EINSTTYPE_BARRIER,
121         EINSTTYPE_FENCE,
122     };
123 
124     enum e_predicate : unsigned char
125     {
126         EPREDICATE_EQ,
127         EPREDICATE_NE,
128         EPREDICATE_GT,
129         EPREDICATE_GE,
130         EPREDICATE_LT,
131         EPREDICATE_LE,
132     };
133 
134     enum e_predefSurface : unsigned char
135     {
136         ESURFACE_NORMAL,
137         ESURFACE_SLM,
138         ESURFACE_STATELESS,
139         ESURFACE_BINDLESS,
140         ESURFACE_SSHBINDLESS,
141         ESURFACE_SCRATCH
142     };
143 
144     enum e_predefSampler : unsigned char
145     {
146         ESAMPLER_NORMAL,
147         ESAMPLER_BINDLESS,
148     };
149 
150     enum e_barrierKind : unsigned char
151     {
152         EBARRIER_NORMAL,  // default (signal+wait)
153         EBARRIER_SIGNAL,
154         EBARRIER_WAIT
155     };
156 
157     enum e_instance : unsigned char
158     {
159         EINSTANCE_UNSPECIFIED,
160         EINSTANCE_FIRST_HALF,
161         EINSTANCE_SECOND_HALF
162     };
163 
164     class CVariable;
165 
166     struct ResourceDescriptor
167     {
168         CVariable* m_resource;
169         e_predefSurface m_surfaceType;
ResourceDescriptorResourceDescriptor170         ResourceDescriptor() : m_resource(nullptr), m_surfaceType(ESURFACE_NORMAL) {}
171     };
172 
173     struct SamplerDescriptor
174     {
175         CVariable* m_sampler;
176         e_predefSampler m_samplerType;
SamplerDescriptorSamplerDescriptor177         SamplerDescriptor() : m_sampler(nullptr), m_samplerType(ESAMPLER_NORMAL) {}
178     };
179 
180 }
181