vtn/opencl: flush denorms for cbrt()

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

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/39828>
This commit is contained in:
Karol Herbst 2026-02-10 02:03:24 +01:00 committed by Marge Bot
parent 890ff49038
commit dc8a39037b
2 changed files with 8 additions and 1 deletions

View file

@ -584,7 +584,7 @@
"description": "vtn/opencl: flush denorms for cbrt()",
"nominated": false,
"nomination_type": 0,
"resolution": 4,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -725,6 +725,13 @@ 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) {
ret = nir_fcanonicalize(nb, ret);
}
return ret;
}