From faf3a93e8fe9bf94ff3200dca9427d8d05c95f2f Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Mon, 9 Feb 2026 21:08:05 +0100 Subject: [PATCH] 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: 9da2d218041 ("vtn: implement default fp_math_ctrl without using execution mode") Reviewed-by: Alyssa Rosenzweig Tested-by: Alyssa Rosenzweig Part-of: --- src/compiler/spirv/spirv_to_nir.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 34c96cfeb5f..9964121f40a 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -5301,6 +5301,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) { + *vtn_fp_math_ctrl_for_base_type(b, GLSL_TYPE_FLOAT16) |= nir_fp_preserve_sz_inf_nan; + *vtn_fp_math_ctrl_for_base_type(b, GLSL_TYPE_FLOAT) |= nir_fp_preserve_sz_inf_nan; + *vtn_fp_math_ctrl_for_base_type(b, GLSL_TYPE_DOUBLE) |= nir_fp_preserve_sz_inf_nan; + } } static bool