<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Oct 12, 2017 at 11:38 AM, Jose Maria Casanova Crespo <span dir="ltr"><<a href="mailto:jmcasanova@igalia.com" target="_blank">jmcasanova@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Alejandro Piñeiro <<a href="mailto:apinheiro@igalia.com">apinheiro@igalia.com</a>><br>
<br>
By default we don't set the rounding mode. We only set<br>
round-to-near-even or round-to-zero mode if explicitly set from nir.<br>
<br>
v2: Use a single SHADER_OPCODE_RND_MODE opcode taking an immediate<br>
with the rounding mode (Curro)<br>
<br>
Signed-off-by: Jose Maria Casanova Crespo <<a href="mailto:jmcasanova@igalia.com">jmcasanova@igalia.com</a>><br>
Signed-off-by: Alejandro Piñeiro <<a href="mailto:apinheiro@igalia.com">apinheiro@igalia.com</a>><br>
---<br>
src/intel/compiler/brw_fs_nir.<wbr>cpp | 8 ++++++++<br>
1 file changed, 8 insertions(+)<br>
<br>
diff --git a/src/intel/compiler/brw_fs_<wbr>nir.cpp b/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
index 6908c7ea02..b356836e80 100644<br>
--- a/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
+++ b/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
@@ -693,6 +693,14 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
inst->saturate = instr->dest.saturate;<br>
break;<br>
<br>
+ case nir_op_f2f16_rtne:<br>
+ case nir_op_f2f16_rtz:<br>
+ if (instr->op == nir_op_f2f16_rtz)<br>
+ bld.emit(SHADER_OPCODE_RND_<wbr>MODE, bld.null_reg_ud(), brw_imm_d(BRW_RND_MODE_RTZ));<br>
+ else if (instr->op == nir_op_f2f16_rtne)<br>
+ bld.emit(SHADER_OPCODE_RND_<wbr>MODE, bld.null_reg_ud(), brw_imm_d(BRW_RND_MODE_RTNE));<br>
+ /* fallthrough */<br></blockquote><div><br></div><div>It might look a little nicer (though it's more lines of code) to have a little brw_from_nir_rounding_mode helper and then we could have just the one emit call. I don't care too much though.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
/* In theory, it would be better to use BRW_OPCODE_F32TO16. Depending<br>
* on the HW gen, it is a special hw opcode or just a MOV, and<br>
* brw_F32TO16 (at brw_eu_emit) would do the work to chose.<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.6<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>