mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-23 23:48:18 +02:00
agx: port over to nir_op_ffma
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41165>
This commit is contained in:
parent
5eb7d7d63b
commit
59d994c8ca
5 changed files with 9 additions and 5 deletions
|
|
@ -1906,6 +1906,7 @@ agx_emit_alu(agx_builder *b, nir_alu_instr *instr)
|
|||
else
|
||||
return agx_fmul_to(b, dst, s0, s1);
|
||||
|
||||
case nir_op_ffma:
|
||||
case nir_op_ffma_old:
|
||||
if (instr->def.bit_size == 16)
|
||||
return agx_hfma_to(b, dst, s0, s1, s2);
|
||||
|
|
@ -3559,7 +3560,7 @@ libagx_frcp(nir_builder *b, nir_def *x)
|
|||
* = fma(fma(-x, u, 1), u, u)
|
||||
*/
|
||||
nir_def *one = nir_imm_float(b, 1.0);
|
||||
nir_def *u_2 = nir_ffma_old(b, nir_ffma_old(b, nir_fneg(b, x), u, one), u, u);
|
||||
nir_def *u_2 = nir_ffma(b, nir_ffma(b, nir_fneg(b, x), u, one), u, u);
|
||||
|
||||
/* If the original value was infinite, frcp will generate the correct zero.
|
||||
* However, the Newton-Raphson step would multiply 0 * Inf and get a NaN. So
|
||||
|
|
|
|||
|
|
@ -350,6 +350,8 @@ static const nir_shader_compiler_options agx_nir_options = {
|
|||
.lower_fdiv = true,
|
||||
.fuse_ffma16 = true,
|
||||
.fuse_ffma32 = true,
|
||||
.float_mul_add16 = nir_float_muladd_support_has_ffma | nir_float_muladd_support_fuse,
|
||||
.float_mul_add32 = nir_float_muladd_support_has_ffma | nir_float_muladd_support_fuse,
|
||||
.lower_flrp16 = true,
|
||||
.lower_flrp32 = true,
|
||||
.lower_fpow = true,
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ interpolate_at_offset(nir_builder *b, nir_def *cf, nir_def *offset,
|
|||
nir_def *pos = nir_fadd(b, center, nir_f2f32(b, offset));
|
||||
|
||||
/* Interpolate with the given coefficients */
|
||||
nir_def *interp = nir_ffma_old(b, nir_channel(b, pos, 1), nir_channel(b, cf, 1),
|
||||
nir_channel(b, cf, 2));
|
||||
nir_def *interp = nir_ffma_weak(b, nir_channel(b, pos, 1), nir_channel(b, cf, 1),
|
||||
nir_channel(b, cf, 2));
|
||||
|
||||
interp = nir_ffma_old(b, nir_channel(b, pos, 0), nir_channel(b, cf, 0), interp);
|
||||
interp = nir_ffma_weak(b, nir_channel(b, pos, 0), nir_channel(b, cf, 0), interp);
|
||||
|
||||
/* Divide by RHW. This load will be lowered recursively. */
|
||||
if (perspective) {
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ alu_cost(nir_alu_instr *alu)
|
|||
case nir_op_f2f16_rtne:
|
||||
case nir_op_fadd:
|
||||
case nir_op_fmul:
|
||||
case nir_op_ffma:
|
||||
case nir_op_ffma_old:
|
||||
case nir_op_iadd:
|
||||
case nir_op_inot:
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ asahi_blit_compute_shader(struct pipe_context *ctx, struct asahi_blit_key *key)
|
|||
{
|
||||
/* For pixels within the copy area, texture from the source */
|
||||
nir_def *coords_el_2d =
|
||||
nir_ffma_old(b, nir_u2f32(b, logical_id_el_2d), trans_scale, trans_offs);
|
||||
nir_ffma_weak(b, nir_u2f32(b, logical_id_el_2d), trans_scale, trans_offs);
|
||||
|
||||
nir_def *coords_el_nd = coords_el_2d;
|
||||
if (layer) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue