aco: select float8 to fp32 conversions

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35434>
This commit is contained in:
Georg Lehmann 2025-04-09 14:26:16 +02:00 committed by Marge Bot
parent 19ca4be6b0
commit 001cd632ee
3 changed files with 28 additions and 0 deletions

View file

@ -717,6 +717,8 @@ get_gfx11_true16_mask(aco_opcode op)
case aco_opcode::v_and_b16:
case aco_opcode::v_or_b16:
case aco_opcode::v_xor_b16: return 0x3 | 0x8;
case aco_opcode::v_cvt_pk_f32_fp8:
case aco_opcode::v_cvt_pk_f32_bf8:
case aco_opcode::v_cvt_f32_f16:
case aco_opcode::v_cvt_i32_i16:
case aco_opcode::v_cvt_u32_u16: return 0x1;

View file

@ -420,6 +420,8 @@ init_context(isel_context* ctx, nir_shader* shader)
case nir_op_f2e4m3fn_satfn:
case nir_op_f2e5m2:
case nir_op_f2e5m2_sat:
case nir_op_e4m3fn2f:
case nir_op_e5m22f:
case nir_op_fmulz:
case nir_op_ffmaz:
case nir_op_f2f64:

View file

@ -2596,6 +2596,30 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr)
emit_split_vector(ctx, dst, 2);
break;
}
case nir_op_e4m3fn2f: {
if (instr->def.num_components == 2) {
Temp src = get_alu_src(ctx, instr->src[0], 2);
bld.vop1(aco_opcode::v_cvt_pk_f32_fp8, Definition(dst), src);
emit_split_vector(ctx, dst, 2);
} else {
Temp src = get_alu_src(ctx, instr->src[0]);
assert(instr->def.num_components == 1);
bld.vop1(aco_opcode::v_cvt_f32_fp8, Definition(dst), src);
}
break;
}
case nir_op_e5m22f: {
if (instr->def.num_components == 2) {
Temp src = get_alu_src(ctx, instr->src[0], 2);
bld.vop1(aco_opcode::v_cvt_pk_f32_bf8, Definition(dst), src);
emit_split_vector(ctx, dst, 2);
} else {
Temp src = get_alu_src(ctx, instr->src[0]);
assert(instr->def.num_components == 1);
bld.vop1(aco_opcode::v_cvt_f32_bf8, Definition(dst), src);
}
break;
}
case nir_op_i2f16: {
Temp src = get_alu_src(ctx, instr->src[0]);
const unsigned input_size = instr->src[0].src.ssa->bit_size;