vtn: set default fp_math_ctrl values for kernels

The kernel capabilty has the `FPFastMathMode` decoration, but not the
`FPFastMathDefault` execution mode, so a SPIR-V module not using
`SPV_KHR_float_controls2` has no way of setting any defaults.

Fixes: 9da2d21804 ("vtn: implement default fp_math_ctrl without using execution mode")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Tested-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
(cherry picked from commit faf3a93e8f)

[Eric: adjusted commit because of missing 46a617884e, as suggested by the author
at https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39790#note_3325830]

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39828>
This commit is contained in:
Karol Herbst 2026-02-09 21:08:05 +01:00 committed by Marge Bot
parent b53dbb573a
commit acdbdcc53b
2 changed files with 7 additions and 1 deletions

View file

@ -534,7 +534,7 @@
"description": "vtn: set default fp_math_ctrl values for kernels",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "9da2d218041c1a9dd731c3f10ca4800c8b7c6773",
"notes": null

View file

@ -5248,6 +5248,12 @@ vtn_handle_entry_point(struct vtn_builder *b, const uint32_t *w,
b->interface_ids = vtn_alloc_array(b, uint32_t, b->interface_ids_count);
memcpy(b->interface_ids, &w[start], b->interface_ids_count * 4);
qsort(b->interface_ids, b->interface_ids_count, 4, cmp_uint32_t);
if (stage == MESA_SHADER_KERNEL) {
b->fp_math_ctrl_fp16 |= nir_fp_preserve_sz_inf_nan;
b->fp_math_ctrl_fp32 |= nir_fp_preserve_sz_inf_nan;
b->fp_math_ctrl_fp64 |= nir_fp_preserve_sz_inf_nan;
}
}
static bool