aco: deduplicate instr_class definition
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25943>
This commit is contained in:
@@ -112,31 +112,6 @@ enum class Format : uint16_t {
|
||||
DPP8 = 1 << 15,
|
||||
};
|
||||
|
||||
enum class instr_class : uint8_t {
|
||||
valu32 = 0,
|
||||
valu_convert32 = 1,
|
||||
valu64 = 2,
|
||||
valu_quarter_rate32 = 3,
|
||||
valu_fma = 4,
|
||||
valu_transcendental32 = 5,
|
||||
valu_double = 6,
|
||||
valu_double_add = 7,
|
||||
valu_double_convert = 8,
|
||||
valu_double_transcendental = 9,
|
||||
salu = 10,
|
||||
smem = 11,
|
||||
barrier = 12,
|
||||
branch = 13,
|
||||
sendmsg = 14,
|
||||
ds = 15,
|
||||
exp = 16,
|
||||
vmem = 17,
|
||||
waitcnt = 18,
|
||||
other = 19,
|
||||
wmma = 20,
|
||||
count,
|
||||
};
|
||||
|
||||
enum storage_class : uint8_t {
|
||||
storage_none = 0x0, /* no synchronization and can be reordered around aliasing stores */
|
||||
storage_buffer = 0x1, /* SSBOs and global memory */
|
||||
|
@@ -28,27 +28,27 @@ import sys
|
||||
from enum import Enum
|
||||
|
||||
class InstrClass(Enum):
|
||||
Valu32 = 0
|
||||
ValuConvert32 = 1
|
||||
Valu64 = 2
|
||||
ValuQuarterRate32 = 3
|
||||
ValuFma = 4
|
||||
ValuTranscendental32 = 5
|
||||
ValuDouble = 6
|
||||
ValuDoubleAdd = 7
|
||||
ValuDoubleConvert = 8
|
||||
ValuDoubleTranscendental = 9
|
||||
Salu = 10
|
||||
SMem = 11
|
||||
Barrier = 12
|
||||
Branch = 13
|
||||
Sendmsg = 14
|
||||
DS = 15
|
||||
Export = 16
|
||||
VMem = 17
|
||||
Waitcnt = 18
|
||||
Other = 19
|
||||
WMMA = 20
|
||||
Valu32 = "valu32"
|
||||
ValuConvert32 = "valu_convert32"
|
||||
Valu64 = "valu64"
|
||||
ValuQuarterRate32 = "valu_quarter_rate32"
|
||||
ValuFma = "valu_fma"
|
||||
ValuTranscendental32 = "valu_transcendental32"
|
||||
ValuDouble = "valu_double"
|
||||
ValuDoubleAdd = "valu_double_add"
|
||||
ValuDoubleConvert = "valu_double_convert"
|
||||
ValuDoubleTranscendental = "valu_double_transcendental"
|
||||
WMMA = "wmma"
|
||||
Salu = "salu"
|
||||
SMem = "smem"
|
||||
Barrier = "barrier"
|
||||
Branch = "branch"
|
||||
Sendmsg = "sendmsg"
|
||||
DS = "ds"
|
||||
Export = "exp"
|
||||
VMem = "vmem"
|
||||
Waitcnt = "waitcnt"
|
||||
Other = "other"
|
||||
|
||||
class Format(Enum):
|
||||
PSEUDO = 0
|
||||
|
@@ -77,7 +77,7 @@ extern const aco::Info instr_info = {
|
||||
},
|
||||
{
|
||||
% for name in opcode_names:
|
||||
(instr_class)${opcodes[name].cls.value},
|
||||
instr_class::${opcodes[name].cls.value},
|
||||
% endfor
|
||||
},
|
||||
};
|
||||
|
@@ -32,6 +32,13 @@ template = """\
|
||||
|
||||
namespace aco {
|
||||
|
||||
enum class instr_class : uint8_t {
|
||||
% for name in InstrClass:
|
||||
${name.value},
|
||||
% endfor
|
||||
count,
|
||||
};
|
||||
|
||||
<% opcode_names = sorted(opcodes.keys()) %>
|
||||
|
||||
enum class aco_opcode : uint16_t {
|
||||
@@ -45,7 +52,7 @@ enum class aco_opcode : uint16_t {
|
||||
}
|
||||
#endif /* _ACO_OPCODES_ */"""
|
||||
|
||||
from aco_opcodes import opcodes
|
||||
from aco_opcodes import opcodes, InstrClass
|
||||
from mako.template import Template
|
||||
|
||||
print(Template(template).render(opcodes=opcodes))
|
||||
print(Template(template).render(opcodes=opcodes, InstrClass=InstrClass))
|
||||
|
Reference in New Issue
Block a user