nir: validate new float_mul_add options

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41165>
This commit is contained in:
Karol Herbst 2026-05-04 15:27:34 +02:00 committed by Marge Bot
parent 32e91a7467
commit 7ce841cb71

View file

@ -2299,6 +2299,29 @@ validate_function(nir_function *func, validate_state *state)
}
}
static void
validate_float_mul_add(nir_float_muladd_support muladd_support, validate_state *state)
{
if (muladd_support & nir_float_muladd_support_fuse) {
validate_assert(state, muladd_support &
(nir_float_muladd_support_has_ffma | nir_float_muladd_support_has_fmad));
}
if (muladd_support & nir_float_muladd_support_prefers_split)
validate_assert(state, muladd_support & nir_float_muladd_support_has_ffma);
}
static void
validate_options(const nir_shader_compiler_options *options, validate_state *state)
{
if (!options)
return;
validate_float_mul_add(options->float_mul_add16, state);
validate_float_mul_add(options->float_mul_add32, state);
validate_float_mul_add(options->float_mul_add64, state);
}
static void
init_validate_state(validate_state *state)
{
@ -2403,6 +2426,8 @@ nir_validate_shader(nir_shader *shader, const char *when)
valid_modes |= nir_var_mem_node_payload |
nir_var_mem_node_payload_in;
validate_options(shader->options, &state);
exec_list_validate(&shader->variables);
nir_foreach_variable_in_shader(var, shader)
validate_var_decl(var, valid_modes, &state);