On 05/12/2018 19:35, Connor Abbott wrote: > All the current lowerings produce their result using a floating-point > multiply or add, so denorms should already be flushed (e.g. > nir_op_frcp), or they never produce a denorm (e.g. nir_op_ftrunc), so > I don't think this is necessary.
This fix is for nir_op_fsqrt, where we have this code: if (sqrt) { /* Here, the special cases we need to handle are * 0 -> 0 and * +inf -> +inf */ res = nir_bcsel(b, nir_ior(b, nir_feq(b, src, nir_imm_double(b, 0.0)), nir_feq(b, src, nir_imm_double(b, INFINITY))), src, res); } Notice that we can return 'src', which is not flushed. We fail 3 tests because of this. If you agree, I will fix it here instead for all the double lowerings. Sam > On Wed, Dec 5, 2018 at 4:56 PM Samuel Iglesias Gonsálvez > <sigles...@igalia.com> wrote: >> >> Signed-off-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com> >> --- >> src/compiler/nir/nir_lower_double_ops.c | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/src/compiler/nir/nir_lower_double_ops.c >> b/src/compiler/nir/nir_lower_double_ops.c >> index b3543bc6963..97b825d2fdb 100644 >> --- a/src/compiler/nir/nir_lower_double_ops.c >> +++ b/src/compiler/nir/nir_lower_double_ops.c >> @@ -558,6 +558,18 @@ lower_doubles_instr(nir_alu_instr *instr, >> nir_lower_doubles_options options) >> unreachable("unhandled opcode"); >> } >> >> + bool denorm_flush_to_zero = >> + bld.shader->info.shader_float_controls_execution_mode & >> SHADER_DENORM_FLUSH_TO_ZERO_FP64; >> + if (denorm_flush_to_zero) { >> + /* TODO: add support for flushing negative denorms to -0.0 */ >> + /* Flush to zero if the result value is a denorm */ >> + result = nir_bcsel(&bld, >> + nir_flt(&bld, nir_fabs(&bld, result), >> + nir_imm_double(&bld, >> 2.22507385850720138309023271733e-308)), >> + nir_imm_double(&bld, 0.0), >> + result); >> + } >> + >> nir_ssa_def_rewrite_uses(&instr->dest.dest.ssa, nir_src_for_ssa(result)); >> nir_instr_remove(&instr->instr); >> return true; >> -- >> 2.19.1 >> >> _______________________________________________ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev >
signature.asc
Description: OpenPGP digital signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev