Mesa (main): freedreno/ir3: tidy up duplication of common nir options

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jun 4 16:47:32 UTC 2022


Module: Mesa
Branch: main
Commit: 34e868d882c572fae8393fb005f93e86bb6ea3f5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=34e868d882c572fae8393fb005f93e86bb6ea3f5

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Wed May 18 16:00:42 2022 +1000

freedreno/ir3: tidy up duplication of common nir options

Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

---

 src/freedreno/ir3/ir3_compiler.c | 139 ++++++++++++++-------------------------
 1 file changed, 49 insertions(+), 90 deletions(-)

diff --git a/src/freedreno/ir3/ir3_compiler.c b/src/freedreno/ir3/ir3_compiler.c
index 508be6ebd13..db0b62b7b4b 100644
--- a/src/freedreno/ir3/ir3_compiler.c
+++ b/src/freedreno/ir3/ir3_compiler.c
@@ -70,110 +70,71 @@ ir3_compiler_destroy(struct ir3_compiler *compiler)
    ralloc_free(compiler);
 }
 
+#define COMMON_OPTIONS                                                        \
+   .lower_fpow = true,                                                        \
+   .lower_scmp = true,                                                        \
+   .lower_flrp16 = true,                                                      \
+   .lower_flrp32 = true,                                                      \
+   .lower_flrp64 = true,                                                      \
+   .lower_ffract = true,                                                      \
+   .lower_fmod = true,                                                        \
+   .lower_fdiv = true,                                                        \
+   .lower_isign = true,                                                       \
+   .lower_ldexp = true,                                                       \
+   .lower_uadd_carry = true,                                                  \
+   .lower_usub_borrow = true,                                                 \
+   .lower_mul_high = true,                                                    \
+   .lower_mul_2x32_64 = true,                                                 \
+   .fuse_ffma16 = true,                                                       \
+   .fuse_ffma32 = true,                                                       \
+   .fuse_ffma64 = true,                                                       \
+   .vertex_id_zero_based = false,                                             \
+   .lower_extract_byte = true,                                                \
+   .lower_extract_word = true,                                                \
+   .lower_insert_byte = true,                                                 \
+   .lower_insert_word = true,                                                 \
+   .lower_helper_invocation = true,                                           \
+   .lower_bitfield_insert_to_shifts = true,                                   \
+   .lower_bitfield_extract_to_shifts = true,                                  \
+   .lower_pack_half_2x16 = true,                                              \
+   .lower_pack_snorm_4x8 = true,                                              \
+   .lower_pack_snorm_2x16 = true,                                             \
+   .lower_pack_unorm_4x8 = true,                                              \
+   .lower_pack_unorm_2x16 = true,                                             \
+   .lower_unpack_half_2x16 = true,                                            \
+   .lower_unpack_snorm_4x8 = true,                                            \
+   .lower_unpack_snorm_2x16 = true,                                           \
+   .lower_unpack_unorm_4x8 = true,                                            \
+   .lower_unpack_unorm_2x16 = true,                                           \
+   .lower_pack_split = true,                                                  \
+   .use_interpolated_input_intrinsics = true,                                 \
+   .lower_rotate = true,                                                      \
+   .lower_to_scalar = true,                                                   \
+   .has_imul24 = true,                                                        \
+   .has_fsub = true,                                                          \
+   .has_isub = true,                                                          \
+   .force_indirect_unrolling_sampler = true,                                  \
+   .lower_uniforms_to_ubo = true,                                             \
+   .use_scoped_barrier = true
+
 static const nir_shader_compiler_options nir_options = {
-   .lower_fpow = true,
-   .lower_scmp = true,
-   .lower_flrp16 = true,
-   .lower_flrp32 = true,
-   .lower_flrp64 = true,
-   .lower_ffract = true,
-   .lower_fmod = true,
-   .lower_fdiv = true,
-   .lower_isign = true,
-   .lower_ldexp = true,
-   .lower_uadd_carry = true,
-   .lower_usub_borrow = true,
-   .lower_mul_high = true,
-   .lower_mul_2x32_64 = true,
-   .fuse_ffma16 = true,
-   .fuse_ffma32 = true,
-   .fuse_ffma64 = true,
-   .vertex_id_zero_based = true,
-   .lower_extract_byte = true,
-   .lower_extract_word = true,
-   .lower_insert_byte = true,
-   .lower_insert_word = true,
-   .lower_helper_invocation = true,
-   .lower_bitfield_insert_to_shifts = true,
-   .lower_bitfield_extract_to_shifts = true,
-   .lower_pack_half_2x16 = true,
-   .lower_pack_snorm_4x8 = true,
-   .lower_pack_snorm_2x16 = true,
-   .lower_pack_unorm_4x8 = true,
-   .lower_pack_unorm_2x16 = true,
-   .lower_unpack_half_2x16 = true,
-   .lower_unpack_snorm_4x8 = true,
-   .lower_unpack_snorm_2x16 = true,
-   .lower_unpack_unorm_4x8 = true,
-   .lower_unpack_unorm_2x16 = true,
-   .lower_pack_split = true,
-   .use_interpolated_input_intrinsics = true,
-   .lower_rotate = true,
-   .lower_to_scalar = true,
-   .has_imul24 = true,
-   .has_fsub = true,
-   .has_isub = true,
+   COMMON_OPTIONS,
    .lower_wpos_pntc = true,
    .lower_cs_local_index_to_id = true,
-   .force_indirect_unrolling_sampler = true,
 
    /* Only needed for the spirv_to_nir() pass done in ir3_cmdline.c
     * but that should be harmless for GL since 64b is not
     * supported there.
     */
    .lower_int64_options = (nir_lower_int64_options)~0,
-   .lower_uniforms_to_ubo = true,
-   .use_scoped_barrier = true,
 };
 
 /* we don't want to lower vertex_id to _zero_based on newer gpus: */
 static const nir_shader_compiler_options nir_options_a6xx = {
-   .lower_fpow = true,
-   .lower_scmp = true,
-   .lower_flrp16 = true,
-   .lower_flrp32 = true,
-   .lower_flrp64 = true,
-   .lower_ffract = true,
-   .lower_fmod = true,
-   .lower_fdiv = true,
-   .lower_isign = true,
-   .lower_ldexp = true,
-   .lower_uadd_carry = true,
-   .lower_usub_borrow = true,
-   .lower_mul_high = true,
-   .lower_mul_2x32_64 = true,
-   .fuse_ffma16 = true,
-   .fuse_ffma32 = true,
-   .fuse_ffma64 = true,
-   .vertex_id_zero_based = false,
-   .lower_extract_byte = true,
-   .lower_extract_word = true,
-   .lower_insert_byte = true,
-   .lower_insert_word = true,
-   .lower_helper_invocation = true,
-   .lower_bitfield_insert_to_shifts = true,
-   .lower_bitfield_extract_to_shifts = true,
-   .lower_pack_half_2x16 = true,
-   .lower_pack_snorm_4x8 = true,
-   .lower_pack_snorm_2x16 = true,
-   .lower_pack_unorm_4x8 = true,
-   .lower_pack_unorm_2x16 = true,
-   .lower_unpack_half_2x16 = true,
-   .lower_unpack_snorm_4x8 = true,
-   .lower_unpack_snorm_2x16 = true,
-   .lower_unpack_unorm_4x8 = true,
-   .lower_unpack_unorm_2x16 = true,
-   .lower_pack_split = true,
-   .use_interpolated_input_intrinsics = true,
-   .lower_rotate = true,
+   COMMON_OPTIONS,
    .vectorize_io = true,
-   .lower_to_scalar = true,
-   .has_imul24 = true,
-   .has_fsub = true,
-   .has_isub = true,
    .max_unroll_iterations = 32,
    .force_indirect_unrolling = nir_var_all,
-   .force_indirect_unrolling_sampler = true,
    .lower_wpos_pntc = true,
    .lower_cs_local_index_to_id = true,
 
@@ -182,9 +143,7 @@ static const nir_shader_compiler_options nir_options_a6xx = {
     * supported there.
     */
    .lower_int64_options = (nir_lower_int64_options)~0,
-   .lower_uniforms_to_ubo = true,
    .lower_device_index_to_zero = true,
-   .use_scoped_barrier = true,
    .has_udot_4x8 = true,
    .has_sudot_4x8 = true,
 };



More information about the mesa-commit mailing list