diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index 95cea1b7168..21cad796814 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -2290,6 +2290,13 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu) 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: fprintf(stderr, "emit_alu: not implemented (%s)\n", nir_op_infos[alu->op].name); diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 17e8b9a5ffc..45da5317670 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -1304,6 +1304,7 @@ zink_screen_init_compiler(struct zink_screen *screen) .lower_mul_2x32_64 = true, .support_16bit_alu = true, /* not quite what it sounds like */ .max_unroll_iterations = 0, + .float_mul_add32 = nir_float_muladd_support_keep_weak_ffma, }; screen->nir_options = default_options; @@ -1318,8 +1319,13 @@ zink_screen_init_compiler(struct zink_screen *screen) * stop Vulkan drivers from unrolling the loops. */ 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? */ screen->nir_options.varying_expression_max_cost = amd_varying_expression_max_cost;