aco: always use rtne for fquantize2f16

The SPIR-V spec says:

If Value is positive with a magnitude too large to represent as a
16-bit floating-point value, the result is positive infinity.
If Value is negative with a magnitude too large to represent as a
16-bit floating-point value, the result is negative infinity.

This is only the case for rtne v_cvt_f16_f32

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24617>
This commit is contained in:
Georg Lehmann 2023-08-10 20:55:04 +02:00 committed by Marge Bot
parent 144546f434
commit c4f356faf4

View file

@ -3375,7 +3375,11 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr)
}
case nir_op_fquantize2f16: {
Temp src = get_alu_src(ctx, instr->src[0]);
Temp f16 = bld.vop1(aco_opcode::v_cvt_f16_f32, bld.def(v2b), src);
Temp f16;
if (ctx->block->fp_mode.round16_64 != fp_round_ne)
f16 = bld.vop1(aco_opcode::p_cvt_f16_f32_rtne, bld.def(v2b), src);
else
f16 = bld.vop1(aco_opcode::v_cvt_f16_f32, bld.def(v2b), src);
Temp f32, cmp_res;
if (ctx->program->gfx_level >= GFX8) {