pan/bi: Lower ffract in bifrost_nir_algebraic on v11+

On v11+, because FROUND.v2f16 is gone we end up with precision issues.
We now lower ffract in bifrost_nir_algebraic instead of during common
algebraic to ensure lower_bit_size has been performed.

This fixes
"dEQP-GLES3.functional.shaders.builtin_functions.common.fract.vec2_lowp_vertex"
and
"dEQP-GLES31.functional.shaders.builtin_functions.common.fract.vec2_lowp_compute".

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Backport-to: 25.1
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34970>
(cherry picked from commit 60b131a712)
This commit is contained in:
Mary Guillemard 2025-05-14 11:16:28 +02:00 committed by Eric Engestrom
parent 360d2958af
commit dd47ebcc19
6 changed files with 7 additions and 10 deletions

View file

@ -1794,7 +1794,7 @@
"description": "pan/bi: Lower ffract in bifrost_nir_algebraic on v11+",
"nominated": true,
"nomination_type": 4,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -5,7 +5,3 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-refcount-multithread,Cras
dEQP-VK.pipeline.fast_linked_library.misc.interpolate_at_sample_no_sample_shading,Crash
dEQP-VK.glsl.loops.special.do_while_dynamic_iterations.dowhile_trap_vertex,Crash
# Seems to be a precision issues because of floor fp16 being dropped since v11 (and the conversion done as a result)
dEQP-GLES3.functional.shaders.builtin_functions.common.fract.vec2_lowp_vertex,Fail
dEQP-GLES31.functional.shaders.builtin_functions.common.fract.vec2_lowp_compute,Fail

View file

@ -3,7 +3,3 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-refcount-multithread,Cras
# CTS bug, tries to use vkCmdSetPatchControlPointsEXT when we don't have that
dEQP-VK.pipeline.fast_linked_library.misc.interpolate_at_sample_no_sample_shading,Crash
# Seems to be a precision issues because of floor fp16 being dropped since v11 (and the conversion done as a result)
dEQP-GLES3.functional.shaders.builtin_functions.common.fract.vec2_lowp_vertex,Fail
dEQP-GLES31.functional.shaders.builtin_functions.common.fract.vec2_lowp_compute,Fail

View file

@ -5025,6 +5025,7 @@ bi_lower_bit_size(const nir_instr *instr, void *data)
case nir_op_fround_even:
case nir_op_fceil:
case nir_op_ffloor:
case nir_op_ffract:
case nir_op_ftrunc:
case nir_op_frexp_sig:
case nir_op_frexp_exp:

View file

@ -94,7 +94,7 @@ void bifrost_compile_shader_nir(nir_shader *nir,
.lower_flrp16 = true, \
.lower_flrp32 = true, \
.lower_flrp64 = true, \
.lower_ffract = true, \
.lower_ffract = arch < 11, \
.lower_fmod = true, \
.lower_fdiv = true, \
.lower_isign = true, \

View file

@ -100,6 +100,10 @@ algebraic_late = [
# On v11+, F16_TO_S32/F16_TO_U32 is gone but we still have F32_TO_S32/F32_TO_U32
(('f2i32', 'a@16'), ('f2i32', ('f2f32', a)), 'gpu_arch >= 11'),
(('f2u32', 'a@16'), ('f2u32', ('f2f32', a)), 'gpu_arch >= 11'),
# On v11+, because FROUND.v2f16 is gone we end up with precision issues.
# We lower ffract here instead to ensure lower_bit_size has been performed.
(('ffract', a), ('fadd', a, ('fneg', ('ffloor', a))), 'gpu_arch >= 11'),
]
# On v11+, ICMP_OR.v4u8 was removed