vtn/opencl: Handle OpenCLstd_F{Min,Max}_common

Normal fmin doesn't make any promises about NaN, common additionally
doesn't make any promises about infinities. Would be nice to hook that
up to codegen but lowering them to normal works for now.

Cc: mesa-stable
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34941>
(cherry picked from commit 4b1c824b67)
This commit is contained in:
Adam Jackson 2025-05-22 16:08:23 -04:00 committed by Eric Engestrom
parent a23171c02b
commit 2942d3714e
2 changed files with 6 additions and 1 deletions

View file

@ -474,7 +474,7 @@
"description": "vtn/opencl: Handle OpenCLstd_F{Min,Max}_common",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -267,6 +267,9 @@ nir_alu_op_for_opencl_opcode(struct vtn_builder *b,
case OpenCLstd_Half_recip: return nir_op_frcp;
/* uhm... */
case OpenCLstd_UAbs: return nir_op_mov;
// we could do better
case OpenCLstd_FMin_common: return nir_op_fmin;
case OpenCLstd_FMax_common: return nir_op_fmax;
default:
vtn_fail("No NIR equivalent");
}
@ -968,6 +971,8 @@ vtn_handle_opencl_instruction(struct vtn_builder *b, SpvOp ext_opcode,
case OpenCLstd_Rint:
case OpenCLstd_Half_divide:
case OpenCLstd_Half_recip:
case OpenCLstd_FMin_common:
case OpenCLstd_FMax_common:
handle_instr(b, ext_opcode, w + 5, count - 5, w + 1, handle_alu);
return true;
case OpenCLstd_SAbs_diff: