zink: keep ffma_weak and use GLSLstd450Fma for it

This pushes the decision down to Vulkan drivers and they can do whatever
they think is best.

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41684>
This commit is contained in:
Karol Herbst 2026-05-19 18:56:32 +02:00 committed by Marge Bot
parent 326d7eaa48
commit 2146e09962
2 changed files with 13 additions and 0 deletions

View file

@ -2290,6 +2290,13 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
break; break;
} }
case nir_op_ffma_weak: {
assert(nir_op_infos[alu->op].num_inputs == 3);
result = emit_builtin_triop(ctx, GLSLstd450Fma, dest_type,
src[0], src[1], src[2]);
break;
}
default: default:
fprintf(stderr, "emit_alu: not implemented (%s)\n", fprintf(stderr, "emit_alu: not implemented (%s)\n",
nir_op_infos[alu->op].name); nir_op_infos[alu->op].name);

View file

@ -1304,6 +1304,7 @@ zink_screen_init_compiler(struct zink_screen *screen)
.lower_mul_2x32_64 = true, .lower_mul_2x32_64 = true,
.support_16bit_alu = true, /* not quite what it sounds like */ .support_16bit_alu = true, /* not quite what it sounds like */
.max_unroll_iterations = 0, .max_unroll_iterations = 0,
.float_mul_add32 = nir_float_muladd_support_keep_weak_ffma,
}; };
screen->nir_options = default_options; screen->nir_options = default_options;
@ -1318,8 +1319,13 @@ zink_screen_init_compiler(struct zink_screen *screen)
* stop Vulkan drivers from unrolling the loops. * stop Vulkan drivers from unrolling the loops.
*/ */
screen->nir_options.max_unroll_iterations_fp64 = 32; screen->nir_options.max_unroll_iterations_fp64 = 32;
} else {
screen->nir_options.float_mul_add64 |= nir_float_muladd_support_keep_weak_ffma;
} }
if (screen->base.caps.fp16)
screen->nir_options.float_mul_add16 |= nir_float_muladd_support_keep_weak_ffma;
/* XXX: do any drivers need different estimates? */ /* XXX: do any drivers need different estimates? */
screen->nir_options.varying_expression_max_cost = amd_varying_expression_max_cost; screen->nir_options.varying_expression_max_cost = amd_varying_expression_max_cost;