From: Georg Lehmann Date: Thu, 10 Aug 2023 18:55:04 +0000 (+0200) Subject: aco: always use rtne for fquantize2f16 X-Git-Tag: upstream/23.3.3~3491 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c4f356faf490cb7d4ba63470e1240e92b8317742;p=platform%2Fupstream%2Fmesa.git 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 Part-of: --- diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 12c9588..f4bcadd 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -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) {