vtn/opencl: flush denorms for cbrt()

libclc doesn't so we have to. fixes math_brutefore cbrt on Iris.

This uses an exact fmul 1.0 instead of fcanonlize, because the latter got
added with 26.0.

Co-authored-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
(cherry picked from commit af954427bf)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39969>
This commit is contained in:
Karol Herbst 2026-02-10 02:03:24 +01:00
parent 6d1c919fc4
commit 6971c8e2eb

View file

@ -725,6 +725,16 @@ handle_special(struct vtn_builder *b, uint32_t opcode,
if (!ret)
vtn_fail("No NIR equivalent");
/* libclc's cbrt() implementation fails to flush subnormal numbers to zero
* even when flush-to-zero is required. Manually flush its output.
*/
if (opcode == OpenCLstd_Cbrt) {
const bool save_exact = nb->exact;
nb->exact = true;
ret = nir_fmul_imm(nb, ret, 1.0);
nb->exact = save_exact;
}
return ret;
}