| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2020-2021 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
////////////////////////////////////////////////////////////////////////// |
| 10 |
// Creates an enumerated list of ops via macro callback. |
| 11 |
// This keeps the op table stable as we add and remove elements |
| 12 |
// |
| 13 |
// Formally, this is transposing the Expression Problem: |
| 14 |
// + adding new variants is easy (1 line) |
| 15 |
// - adding new attributes/properties requires potentially |
| 16 |
// modifying multiple variants (macro cleverness with defaults reduces |
| 17 |
// some of that sting) |
| 18 |
#ifndef DEFINE_SEND_OP |
| 19 |
#error "DEFINE_SEND_OP(ENUM, MNMEONIC, DESCRIPTION, ATTRS) not defined" |
| 20 |
// #define DEFINE_SEND_OP(E, M, D, A) |
| 21 |
#endif |
| 22 |
|
| 23 |
#ifndef ATTRS_NONE |
| 24 |
// in case of recursive additions |
| 25 |
#define ATTRS_NONE iga::SendOpDefinition::Attr::NONE |
| 26 |
#define ATTRS_SCALARADDR iga::SendOpDefinition::Attr::IS_SCALAR_ADDR |
| 27 |
#define ATTRS_CMASK iga::SendOpDefinition::Attr::HAS_CMASK |
| 28 |
#define ATTRS_ATOMIC_UNR \ |
| 29 |
iga::SendOpDefinition::Attr::GROUP_ATOMIC | \ |
| 30 |
iga::SendOpDefinition::Attr::ATOMIC_UNARY |
| 31 |
#define ATTRS_ATOMIC_BIN \ |
| 32 |
iga::SendOpDefinition::Attr::GROUP_ATOMIC | \ |
| 33 |
iga::SendOpDefinition::Attr::ATOMIC_BINARY |
| 34 |
#define ATTRS_ATOMIC_TER \ |
| 35 |
iga::SendOpDefinition::Attr::GROUP_ATOMIC | \ |
| 36 |
iga::SendOpDefinition::Attr::ATOMIC_TERNARY |
| 37 |
#define ATTRS_GATHER4 iga::SendOpDefinition::Attr::GATHER4 |
| 38 |
#endif |
| 39 |
|
| 40 |
#ifndef DEFINE_LOAD_OP |
| 41 |
// users can override this if needed |
| 42 |
#define DEFINE_LOAD_OP(E, M, D, A) \ |
| 43 |
DEFINE_SEND_OP(E, M, D, (A) | iga::SendOpDefinition::Attr::GROUP_LOAD) |
| 44 |
#endif |
| 45 |
#ifndef DEFINE_STORE_OP |
| 46 |
#define DEFINE_STORE_OP(E, M, D, A) \ |
| 47 |
DEFINE_SEND_OP(E, M, D, (A) | iga::SendOpDefinition::Attr::GROUP_STORE) |
| 48 |
#endif |
| 49 |
#ifndef DEFINE_ATOMIC_UNARY_OP |
| 50 |
#define DEFINE_ATOMIC_UNARY_OP(E, M, D) \ |
| 51 |
DEFINE_SEND_OP(E, M, D, ATTRS_ATOMIC_UNR) |
| 52 |
#endif |
| 53 |
#ifndef DEFINE_ATOMIC_BINARY_OP |
| 54 |
#define DEFINE_ATOMIC_BINARY_OP(E, M, D) \ |
| 55 |
DEFINE_SEND_OP(E, M, D, ATTRS_ATOMIC_BIN) |
| 56 |
#endif |
| 57 |
#ifndef DEFINE_ATOMIC_TERNARY_OP |
| 58 |
#define DEFINE_ATOMIC_TERNARY_OP(E, M, D) \ |
| 59 |
DEFINE_SEND_OP(E, M, D, ATTRS_ATOMIC_TER) |
| 60 |
#endif |
| 61 |
#ifndef DEFINE_SAMPLE_OP |
| 62 |
#define DEFINE_SAMPLE_OP(E, M, D, A) \ |
| 63 |
DEFINE_SEND_OP(E, M, D, (A) | iga::SendOpDefinition::Attr::GROUP_SAMPLE) |
| 64 |
#endif |
| 65 |
#ifndef DEFINE_OTHER_OP |
| 66 |
#define DEFINE_OTHER_OP(E, M, D, A) \ |
| 67 |
DEFINE_SEND_OP(E, M, D, (A) | iga::SendOpDefinition::Attr::GROUP_OTHER) |
| 68 |
#endif |
| 69 |
|
| 70 |
DEFINE_LOAD_OP(LOAD, "load", "load", ATTRS_NONE) |
| 71 |
DEFINE_LOAD_OP(LOAD_STRIDED, "load_strided", "load strided", |
| 72 |
ATTRS_SCALARADDR) // AKA load_block |
| 73 |
DEFINE_LOAD_OP(LOAD_QUAD, "load_quad", "load quad", |
| 74 |
ATTRS_CMASK) // AKA load_cmask |
| 75 |
DEFINE_LOAD_OP(LOAD_QUAD_MSRT, "load_quad_msrt", |
| 76 |
"load quad from multi-sample render target", |
| 77 |
ATTRS_CMASK) |
| 78 |
DEFINE_LOAD_OP(LOAD_STATUS, "load_status", "load status", ATTRS_NONE) |
| 79 |
DEFINE_LOAD_OP(LOAD_QUAD_STATUS, "load_quad_status", |
| 80 |
"load quad status (aka cmask)", ATTRS_CMASK) |
| 81 |
DEFINE_LOAD_OP(LOAD_BLOCK2D, "load_block2d", "load array of 2d blocks", |
| 82 |
ATTRS_SCALARADDR) |
| 83 |
DEFINE_STORE_OP(STORE, "store", "store", ATTRS_NONE) |
| 84 |
DEFINE_STORE_OP(STORE_STRIDED, "store_strided", "store strided", |
| 85 |
ATTRS_SCALARADDR) // AKA store_block |
| 86 |
DEFINE_STORE_OP(STORE_QUAD, "store_quad", "store quad", |
| 87 |
ATTRS_CMASK) // AKA store_cmask |
| 88 |
DEFINE_STORE_OP(STORE_QUAD_MSRT, "store_quad_msrt", |
| 89 |
"store quad to multi-sample render target", ATTRS_CMASK) |
| 90 |
DEFINE_STORE_OP(STORE_BLOCK2D, "store_block2d", "store 2d block", |
| 91 |
ATTRS_SCALARADDR) |
| 92 |
DEFINE_STORE_OP(STORE_UNCOMPRESSED, "store_uncompressed", "uncompressed store", |
| 93 |
ATTRS_NONE) |
| 94 |
DEFINE_STORE_OP(STORE_UNCOMPRESSED_QUAD, "store_uncompressed_quad", |
| 95 |
"uncompressed quad store", ATTRS_CMASK) |
| 96 |
DEFINE_ATOMIC_UNARY_OP(ATOMIC_LOAD, "atomic_load", "atomic load") |
| 97 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_STORE, "atomic_store", "atomic store") |
| 98 |
// |
| 99 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_AND, "atomic_and", "atomic logical AND") |
| 100 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_XOR, "atomic_xor", "atomic logical XOR") |
| 101 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_OR, "atomic_or", "atomic logical OR") |
| 102 |
// |
| 103 |
DEFINE_ATOMIC_UNARY_OP(ATOMIC_IINC, "atomic_iinc", "atomic integer increment") |
| 104 |
DEFINE_ATOMIC_UNARY_OP(ATOMIC_IDEC, "atomic_idec", "atomic integer decrement") |
| 105 |
DEFINE_ATOMIC_UNARY_OP(ATOMIC_IPDEC, "atomic_ipdec", |
| 106 |
"atomic integer pre-decrement") |
| 107 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_IADD, "atomic_iadd", "atomic integer add") |
| 108 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_ISUB, "atomic_isub", "atomic integer subtract") |
| 109 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_IRSUB, "atomic_irsub", |
| 110 |
"atomic integer reverse subtract") |
| 111 |
DEFINE_ATOMIC_TERNARY_OP(ATOMIC_ICAS, "atomic_icas", |
| 112 |
"atomic integer compare and swap") |
| 113 |
|
| 114 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_SMIN, "atomic_smin", "atomic signed minimum") |
| 115 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_SMAX, "atomic_smax", "atomic signed maximum") |
| 116 |
// |
| 117 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_UMIN, "atomic_umin", "atomic unsigned minimum") |
| 118 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_UMAX, "atomic_umax", "atomic unsigned maximum") |
| 119 |
// |
| 120 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_FADD, "atomic_fadd", "atomic floating-point add") |
| 121 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_FSUB, "atomic_fsub", |
| 122 |
"atomic floating-point subtract") |
| 123 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_FMIN, "atomic_fmin", |
| 124 |
"atomic floating-point minimum") |
| 125 |
DEFINE_ATOMIC_BINARY_OP(ATOMIC_FMAX, "atomic_fmax", |
| 126 |
"atomic floating-point maximum") |
| 127 |
DEFINE_ATOMIC_TERNARY_OP(ATOMIC_FCAS, "atomic_fcas", |
| 128 |
"atomic floating-point compare and swap") |
| 129 |
// |
| 130 |
// for now use DEFINE_OTHER_OP to prevent syntax |
| 131 |
DEFINE_OTHER_OP(ATOMIC_ACADD, "atomic_acadd", "atomic counter add", |
| 132 |
iga::SendOpDefinition::Attr::GROUP_ATOMIC | |
| 133 |
iga::SendOpDefinition::Attr::ATOMIC_BINARY) |
| 134 |
DEFINE_OTHER_OP(ATOMIC_ACSUB, "atomic_acsub", "atomic counter subtract", |
| 135 |
iga::SendOpDefinition::Attr::GROUP_ATOMIC | |
| 136 |
iga::SendOpDefinition::Attr::ATOMIC_BINARY) |
| 137 |
DEFINE_OTHER_OP(ATOMIC_ACSTORE, "atomic_acstore", "atomic counter store", |
| 138 |
iga::SendOpDefinition::Attr::GROUP_ATOMIC | |
| 139 |
iga::SendOpDefinition::Attr::ATOMIC_BINARY) |
| 140 |
// |
| 141 |
DEFINE_OTHER_OP(READ_STATE, "read_state", "read surface state", ATTRS_NONE) |
| 142 |
// |
| 143 |
DEFINE_OTHER_OP(FENCE, "fence", "fence", ATTRS_NONE) |
| 144 |
// |
| 145 |
DEFINE_OTHER_OP(SIGNAL_BARRIER, "signal_barrier", "signal barrier", ATTRS_NONE) |
| 146 |
DEFINE_OTHER_OP(SIGNAL_NAMED_BARRIER, "signal_named_barrier", "signal named barrier", |
| 147 |
ATTRS_NONE) |
| 148 |
DEFINE_OTHER_OP(SIGNAL_SYSTEM_ROUTINE_BARRIER, "system_routine_barrier", |
| 149 |
"system routine barrier", ATTRS_NONE) |
| 150 |
DEFINE_OTHER_OP(MONITOR, "monitor", "monitor event", ATTRS_NONE) |
| 151 |
DEFINE_OTHER_OP(UNMONITOR, "unmonitor", "unmonitor event", ATTRS_NONE) |
| 152 |
DEFINE_OTHER_OP(WAIT, "wait", "wait for event", ATTRS_NONE) |
| 153 |
DEFINE_OTHER_OP(SIGNAL, "signal", "signal event", ATTRS_NONE) |
| 154 |
DEFINE_OTHER_OP(EOT, "eot", "end of thread", ATTRS_NONE) |
| 155 |
DEFINE_OTHER_OP(EOTR, "eotr", "end of thread replay", ATTRS_NONE) |
| 156 |
// |
| 157 |
DEFINE_OTHER_OP(CCS_PC, "ccs_pc", "ccs page clear", ATTRS_NONE) |
| 158 |
DEFINE_OTHER_OP(CCS_PU, "ccs_pu", "ccs page uncompress", ATTRS_NONE) |
| 159 |
DEFINE_OTHER_OP(CCS_SC, "ccs_sc", "ccs sector clear", ATTRS_CMASK) |
| 160 |
DEFINE_OTHER_OP(CCS_SU, "ccs_su", "ccs sector uncompress", ATTRS_CMASK) |
| 161 |
// |
| 162 |
DEFINE_OTHER_OP(TRACE_RAY, "trace_ray", "trace ray", ATTRS_NONE) |
| 163 |
DEFINE_OTHER_OP(SPAWN, "spawn", "spawn thread", ATTRS_NONE) |
| 164 |
// |
| 165 |
DEFINE_SAMPLE_OP(SAMPLE, "sample", "sampler fetch", ATTRS_NONE) |
| 166 |
DEFINE_SAMPLE_OP(SAMPLE_B, "sample_b", "sample with bias", ATTRS_NONE) |
| 167 |
DEFINE_SAMPLE_OP(SAMPLE_L, "sample_l", "sample with LoD", ATTRS_NONE) |
| 168 |
DEFINE_SAMPLE_OP(SAMPLE_C, "sample_c", "sample with compare", ATTRS_NONE) |
| 169 |
DEFINE_SAMPLE_OP(SAMPLE_D, "sample_d", "sample with derivatives", ATTRS_NONE) |
| 170 |
DEFINE_SAMPLE_OP(SAMPLE_B_C, "sample_b_c", "sample with bias and compare", |
| 171 |
ATTRS_NONE) |
| 172 |
DEFINE_SAMPLE_OP(SAMPLE_L_C, "sample_l_c", |
| 173 |
"sample with LoD and compare", ATTRS_NONE) |
| 174 |
DEFINE_SAMPLE_OP(SAMPLE_D_C, "sample_d_c", |
| 175 |
"sampler with derivatives and compare", ATTRS_NONE) |
| 176 |
DEFINE_SAMPLE_OP(SAMPLE_LZ, "sample_lz", "sampler lz", ATTRS_NONE) |
| 177 |
DEFINE_SAMPLE_OP(SAMPLE_C_LZ, "sample_c_lz", |
| 178 |
"sampler with compare and lz", ATTRS_NONE) |
| 179 |
// |
| 180 |
DEFINE_SAMPLE_OP(LD, "ld", "sampler load", ATTRS_NONE) |
| 181 |
DEFINE_SAMPLE_OP(SAMPLE_LOD, "sample_lod", "sampler LoD", ATTRS_NONE) |
| 182 |
DEFINE_SAMPLE_OP(LD_LZ, "ld_lz", "sampler ld lz", ATTRS_NONE) |
| 183 |
DEFINE_SAMPLE_OP(SAMPLE_RESINFO, "resinfo", "sampler resolution info", |
| 184 |
ATTRS_NONE) |
| 185 |
DEFINE_SAMPLE_OP(SAMPLE_INFO, "sample_info", "sampler info", ATTRS_NONE) |
| 186 |
DEFINE_SAMPLE_OP(SAMPLE_KILLPIX, "sample_killpix", "sampler kill pixel", |
| 187 |
ATTRS_NONE) |
| 188 |
DEFINE_SAMPLE_OP(LD_2DMS_W, "ld_2dms_w", "ld mcs4", ATTRS_NONE) |
| 189 |
DEFINE_SAMPLE_OP(LD_MCS, "ld_mcs", "load MCS", ATTRS_NONE) |
| 190 |
DEFINE_SAMPLE_OP(SAMPLE_FLUSH, "sample_flush", "sampler flush", ATTRS_NONE) |
| 191 |
DEFINE_SAMPLE_OP(SAMPLE_MLOD, "sample_mlod", "sample with LoD", ATTRS_NONE) |
| 192 |
DEFINE_SAMPLE_OP(SAMPLE_C_MLOD, "sample_c_mlod", |
| 193 |
"sample with mlod and compare", ATTRS_NONE) |
| 194 |
DEFINE_SAMPLE_OP(SAMPLE_D_C_MLOD, "sample_d_c_mlod", |
| 195 |
"sampler with mlod, derivatives, and compare", ATTRS_NONE) |
| 196 |
// |
| 197 |
DEFINE_SAMPLE_OP(SAMPLE_PO, "sample_po", "sample with UVR offsets", ATTRS_NONE) |
| 198 |
DEFINE_SAMPLE_OP(SAMPLE_PO_B, "sample_po_b", "sample with UVR offsets and bias", |
| 199 |
ATTRS_NONE) |
| 200 |
DEFINE_SAMPLE_OP(SAMPLE_PO_L, "sample_po_l", "sample with pixel offset and LoD", |
| 201 |
ATTRS_NONE) |
| 202 |
DEFINE_SAMPLE_OP(SAMPLE_PO_C, "sample_po_c", |
| 203 |
"sample with UVR offsets and compare", ATTRS_NONE) |
| 204 |
DEFINE_SAMPLE_OP(SAMPLE_PO_D, "sample_po_d", |
| 205 |
"sample with derivatives and offsets", ATTRS_NONE) |
| 206 |
DEFINE_SAMPLE_OP(SAMPLE_PO_L_C, "sample_po_l_c", |
| 207 |
"sample with offsets, LoD, and compare", ATTRS_NONE) |
| 208 |
DEFINE_SAMPLE_OP(SAMPLE_PO_B_C, "sample_po_b_c", |
| 209 |
"sample with offsets", ATTRS_NONE) |
| 210 |
DEFINE_SAMPLE_OP(SAMPLE_PO_D_C, "sample_po_d_c", |
| 211 |
"sample with offsets", ATTRS_NONE) |
| 212 |
DEFINE_SAMPLE_OP(SAMPLE_PO_LZ, "sample_po_lz", "sampler lz with pos. offset", |
| 213 |
ATTRS_NONE) |
| 214 |
DEFINE_SAMPLE_OP(SAMPLE_PO_C_LZ, "sample_po_c_lz", |
| 215 |
"sampler pos. offset compare ld", ATTRS_NONE) |
| 216 |
// |
| 217 |
DEFINE_SAMPLE_OP(SAMPLE_LD_L, "sample_ld_l", "sampler ld LoD", ATTRS_NONE) |
| 218 |
// |
| 219 |
DEFINE_SAMPLE_OP(GATHER4, "gather4", "gather4", ATTRS_GATHER4) |
| 220 |
DEFINE_SAMPLE_OP(GATHER4_C, "gather4_c", "gather4 with compare", |
| 221 |
ATTRS_GATHER4) |
| 222 |
DEFINE_SAMPLE_OP(GATHER4_I, "gather4_i", "gather4 with index", ATTRS_GATHER4) |
| 223 |
DEFINE_SAMPLE_OP(GATHER4_I_C, "gather4_i_c", "gather4 with offsets and LoD", |
| 224 |
ATTRS_GATHER4) |
| 225 |
DEFINE_SAMPLE_OP(GATHER4_B, "gather4_b", "gather4 with bias", ATTRS_GATHER4) |
| 226 |
DEFINE_SAMPLE_OP(GATHER4_L, "gather4_l", "gather4 with LoD", ATTRS_GATHER4) |
| 227 |
DEFINE_SAMPLE_OP(GATHER4_L_C, "gather4_l_c", |
| 228 |
"gather4 with offsets and LoD, and compare", |
| 229 |
ATTRS_GATHER4) |
| 230 |
// |
| 231 |
DEFINE_SAMPLE_OP(GATHER4_PO, "gather4_po", "gather4 with offsets", |
| 232 |
ATTRS_GATHER4) |
| 233 |
DEFINE_SAMPLE_OP(GATHER4_PO_L, "gather4_po_l", "gather4 with offsets and LoD", |
| 234 |
ATTRS_GATHER4) |
| 235 |
DEFINE_SAMPLE_OP(GATHER4_PO_C, "gather4_po_c", "gather4 with offsets and compare", |
| 236 |
ATTRS_GATHER4) |
| 237 |
DEFINE_SAMPLE_OP(GATHER4_PO_B, "gather4_po_b", "gather4 with offsets and LoD", |
| 238 |
ATTRS_GATHER4) |
| 239 |
DEFINE_SAMPLE_OP(GATHER4_PO_I, "gather4_po_i", "gather4 with offsets and index", |
| 240 |
ATTRS_GATHER4) |
| 241 |
DEFINE_SAMPLE_OP(GATHER4_PO_I_C, "gather4_po_i_c", |
| 242 |
"gather4 with offsets, index, and compare", |
| 243 |
ATTRS_GATHER4) |
| 244 |
DEFINE_SAMPLE_OP(GATHER4_PO_L_C, "gather4_po_l_c", |
| 245 |
"gather4 with offsets, LoD and compare", |
| 246 |
ATTRS_GATHER4) |
| 247 |
// |
| 248 |
DEFINE_OTHER_OP(RENDER_READ, "render_read", "render read", ATTRS_NONE) |
| 249 |
DEFINE_OTHER_OP(RENDER_WRITE, "render_write", "render write", ATTRS_NONE) |
| 250 |
DEFINE_OTHER_OP(RENDER_DWRITE, "render_dual_write", "render dual write", |
| 251 |
ATTRS_NONE) |
| 252 |
|
| 253 |
DEFINE_OTHER_OP(SAVE_BARRIER, "save_barrier", "save barrier", ATTRS_NONE) |
| 254 |
DEFINE_OTHER_OP(RESTORE_BARRIER, "restore_barrier", "restore barrier", |
| 255 |
ATTRS_NONE) |
| 256 |
DEFINE_OTHER_OP(RESTORE_STACK, "restore_stack", "restore stack", ATTRS_NONE) |
| 257 |
// |
| 258 |
DEFINE_OTHER_OP(GET_WATCHPOINT, "get_watchpoint", "fetches a watchpoint", |
| 259 |
ATTRS_NONE) |
| 260 |
DEFINE_OTHER_OP(SET_WATCHPOINT, "set_watchpoint", "restores a watchpoint", |
| 261 |
ATTRS_NONE) |
| 262 |
// |
| 263 |
DEFINE_LOAD_OP(LOAD_ELEMENT, "load_element", "load element", ATTRS_CMASK) |
| 264 |
DEFINE_LOAD_OP(LOAD_ELEMENT_WITH_STATUS, "load_element_with_status", |
| 265 |
"load element with status", ATTRS_CMASK) |
| 266 |
DEFINE_OTHER_OP(EXTENDED_CACHE_CTRL, "extended_cache_control", |
| 267 |
"extended cache control", ATTRS_NONE) |
| 268 |
|
| 269 |
#undef ATTRS_NONE |
| 270 |
#undef ATTRS_SCALARADDR |
| 271 |
#undef ATTRS_CMASK |
| 272 |
#undef ATTRS_GATHER4 |