nir+vtn: vec8+vec16 support
This introduces new vec8 and vec16 instructions (which are the only instructions taking more than 4 sources), in order to construct 8 and 16 component vectors. In order to avoid fixing up the non-autogenerated nir_build_alu() sites and making them pass 16 src args for the benefit of the two instructions that take more than 4 srcs (ie vec8 and vec16), nir_build_alu() is has nir_build_alu_tail() split out and re-used by nir_build_alu2() (which is used for the > 4 src args case). v2 (Karol Herbst): use nir_build_alu2 for vec8 and vec16 use python's array multiplication syntax add nir_op_vec helper simplify nir_vec nir_build_alu_tail -> nir_builder_alu_instr_finish_and_insert use nir_build_alu for opcodes with <= 4 sources v3 (Karol Herbst): fix nir_serialize v4 (Dave Airlie): fix serialization of glsl_type handle vec8/16 in lowering of bools v5 (Karol Herbst): fix load store vectorizer Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -31,14 +31,22 @@ def src_decl_list(num_srcs):
|
||||
return ', '.join('nir_ssa_def *src' + str(i) for i in range(num_srcs))
|
||||
|
||||
def src_list(num_srcs):
|
||||
return ', '.join('src' + str(i) if i < num_srcs else 'NULL' for i in range(4))
|
||||
if num_srcs <= 4:
|
||||
return ', '.join('src' + str(i) if i < num_srcs else 'NULL' for i in range(4))
|
||||
else:
|
||||
return ', '.join('src' + str(i) for i in range(num_srcs))
|
||||
%>
|
||||
|
||||
% for name, opcode in sorted(opcodes.items()):
|
||||
static inline nir_ssa_def *
|
||||
nir_${name}(nir_builder *build, ${src_decl_list(opcode.num_inputs)})
|
||||
{
|
||||
% if opcode.num_inputs <= 4:
|
||||
return nir_build_alu(build, nir_op_${name}, ${src_list(opcode.num_inputs)});
|
||||
% else:
|
||||
nir_ssa_def *srcs[${opcode.num_inputs}] = {${src_list(opcode.num_inputs)}};
|
||||
return nir_build_alu_src_arr(build, nir_op_${name}, srcs);
|
||||
% endif
|
||||
}
|
||||
% endfor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user