mesa/src/asahi/compiler
Alyssa Rosenzweig 3a0d1f83d5 agx: Stop bit-inexact conversion propagation
Despite being mathematically equivalent, the following code sequences are not
bit-identical under IEEE 754 rules due to differing internal precision:

   fadd16 r0l, r2, 0.0              z = f2f16 x
   fadd16 r1h, r0l, r0h             w = fadd z, y

versus

   fadd32 r1h, r2, r0h              f2f16(w) = fadd x, f2f32(y)

This is probably fine under GL's relaxed floating point precision rules, but
it's definitely not ok with the more strict OpenCL or Vulkan. It also is a
potential problem with GL invariance rules, if we get different results for the
same shader depending whether we did a monolithic compile or a fast link. The
place for doing inexact transformations is NIR, when we have the information
available to do so correctly. By the time we get to the backend, everything we
do needs to be bit-exact to preserve sanity.

Fixes dEQP-GLES2.functional.shaders.algorithm.rgb_to_hsl_vertex. We believe that
this is a CTS bug, but it's a useful one since it uncovered a serious driver bug
that would bite us in the much less friendly Vulkan (or god forbid OpenCL) CTS
later. It also seems like a magnet for GL app bugs, the fp16 support we do now
is uncovering bad enough bugs as it is.

shader-db results are pretty abysmal, though :|

total instructions in shared programs: 1537964 -> 1571328 (2.17%)
instructions in affected programs: 670231 -> 703595 (4.98%)

total bytes in shared programs: 10533984 -> 10732316 (1.88%)
bytes in affected programs: 4662414 -> 4860746 (4.25%)

total halfregs in shared programs: 483448 -> 474541 (-1.84%)
halfregs in affected programs: 58867 -> 49960 (-15.13%)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
..
test agx: Stop bit-inexact conversion propagation 2023-06-07 03:21:49 +00:00
agx_builder.h.py asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_compile.c agx: Emit shader info late 2023-06-07 03:21:49 +00:00
agx_compile.h asahi,agx: Call lower_discard_zs_emit in the driver 2023-06-07 03:21:49 +00:00
agx_compiler.h agx: Model interpolation for iter instructions 2023-06-07 03:21:49 +00:00
agx_dce.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_debug.h asahi: Fix disk cache disable with AGX_MESA_DEBUG 2023-05-07 09:00:40 -04:00
agx_insert_waits.c agx: Don't wait at the end of the shader 2023-05-07 09:05:39 -04:00
agx_internal_formats.h agx: Add agx_internal_format_supports_mask helper 2023-02-21 08:10:15 +00:00
agx_ir.c agx: Factor out allows_16bit_immediate check 2023-03-05 09:27:02 +00:00
agx_liveness.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_lower_64bit.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_lower_parallel_copy.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_lower_pseudo.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_lower_uniform_sources.c agx: Model interpolation for iter instructions 2023-06-07 03:21:49 +00:00
agx_minifloat.h asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_nir.h agx: Optimize multiplies 2023-05-11 09:23:23 -04:00
agx_nir_algebraic.py agx: Optimize multiplies 2023-05-11 09:23:23 -04:00
agx_nir_lower_address.c agx/lower_address: Match multiplies, not only shifts 2023-05-07 09:10:36 -04:00
agx_nir_lower_discard_zs_emit.c agx: Lower discard in NIR 2023-06-07 03:21:49 +00:00
agx_nir_lower_frag_sidefx.c agx: Fix clang-formatting 2023-03-10 06:33:01 +00:00
agx_nir_lower_load_mask.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
agx_nir_lower_sample_mask.c agx: Lower discard in NIR 2023-06-07 03:21:49 +00:00
agx_nir_lower_shared_bitsize.c agx: Lower legacy atomics sooner 2023-05-16 22:36:21 +00:00
agx_nir_lower_texture.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
agx_nir_lower_ubo.c agx: Use load_global_constant for UBO lowering 2023-01-11 20:36:51 +00:00
agx_nir_opt_preamble.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_opcodes.c.py asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_opcodes.h.py asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_opcodes.py agx: Model interpolation for iter instructions 2023-06-07 03:21:49 +00:00
agx_opt_cse.c agx: Split iter and iterproj instructions 2023-06-07 03:21:49 +00:00
agx_optimizer.c agx: Stop bit-inexact conversion propagation 2023-06-07 03:21:49 +00:00
agx_pack.c agx: Model interpolation for iter instructions 2023-06-07 03:21:49 +00:00
agx_performance.c agx: Add helper for calculating occupancy 2023-04-07 03:23:03 +00:00
agx_print.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_register_allocate.c agx: Split iter and iterproj instructions 2023-06-07 03:21:49 +00:00
agx_validate.c agx: Validate that collect sources are the same size 2023-05-07 09:10:36 -04:00
meson.build agx: Lower discard in NIR 2023-06-07 03:21:49 +00:00