aco: add Info::{operand_size,definition_size}

No shader-db changes.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5040>
This commit is contained in:
Rhys Perry
2020-05-18 15:37:33 +01:00
committed by Marge Bot
parent 62ea429a99
commit 207c35cbe8
3 changed files with 44 additions and 0 deletions
+3
View File
@@ -1566,6 +1566,9 @@ typedef struct {
const std::bitset<static_cast<int>(aco_opcode::num_opcodes)> is_atomic;
const char *name[static_cast<int>(aco_opcode::num_opcodes)];
const aco::Format format[static_cast<int>(aco_opcode::num_opcodes)];
/* sizes used for input/output modifiers and constants */
const unsigned operand_size[static_cast<int>(aco_opcode::num_opcodes)];
const unsigned definition_size[static_cast<int>(aco_opcode::num_opcodes)];
} Info;
extern const Info instr_info;
+31
View File
@@ -191,6 +191,37 @@ class Opcode(object):
self.is_atomic = "1" if is_atomic else "0"
self.format = format
parts = name.replace('_e64', '').rsplit('_', 2)
op_dtype = parts[-1]
def_dtype = parts[-2] if len(parts) > 1 else parts[-1]
dtype_sizes = {'{}{}'.format(prefix, size) : size for prefix in 'biuf' for size in [64, 32, 24, 16]}
self.operand_size = dtype_sizes.get(op_dtype, 0)
self.definition_size = dtype_sizes.get(def_dtype, self.operand_size)
# exceptions
if self.operand_size == 24:
self.operand_size = 32
elif name in ['s_sext_i32_i8', 's_sext_i32_i16', 'v_msad_u8', 'v_cvt_pk_u16_u32', 'v_cvt_pk_i16_i32']:
self.operand_size = 32
elif name in ['v_qsad_pk_u16_u8', 'v_mqsad_pk_u16_u8', 'v_mqsad_u32_u8']:
self.definition_size = 0
self.operand_size = 0
elif name in ['v_mad_u64_u32', 'v_mad_i64_i32']:
self.operand_size = 0
elif name.replace('_e64', '') in ['v_lshrrev_b16', 'v_ashrrev_i16', 'v_lshlrev_b16']:
# v_lshlrev_b16 tested on GFX10 with 1/2 PI inline constant
self.operand_size = 32
elif '_pk_' in name or name in ['v_lerp_u8', 'v_sad_u8', 'v_sad_u16',
'v_cvt_f32_ubyte0', 'v_cvt_f32_ubyte1',
'v_cvt_f32_ubyte2', 'v_cvt_f32_ubyte3']:
self.operand_size = 32
self.definition_size = 32
elif '_pknorm_' in name:
self.definition_size = 32
elif format == Format.PSEUDO_REDUCTION:
# 64-bit reductions can have a larger definition size, but get_subdword_definition_info() handles that
self.definition_size = 32
# global dictionary of opcodes
opcodes = {}
+10
View File
@@ -65,6 +65,16 @@ extern const aco::Info instr_info = {
aco::Format::${str(opcodes[name].format.name)},
% endfor
},
.operand_size = {
% for name in opcode_names:
${opcodes[name].operand_size},
% endfor
},
.definition_size = {
% for name in opcode_names:
${opcodes[name].definition_size},
% endfor
},
};
}