pan/bi: Allow specializing bifrost_nir_options by arch

We need different settings for Bifrost and Valhall. Keeping everything static
simplifies lifetimes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20906>
This commit is contained in:
Alyssa Rosenzweig
2023-02-06 10:49:52 -05:00
committed by Marge Bot
parent 8db30010dc
commit 540d556a8f
2 changed files with 64 additions and 62 deletions
+63 -61
View File
@@ -33,67 +33,69 @@ void bifrost_compile_shader_nir(nir_shader *nir,
struct util_dynarray *binary,
struct pan_shader_info *info);
static const nir_shader_compiler_options bifrost_nir_options = {
.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_find_lsb = true,
.lower_ifind_msb = true,
.lower_fdph = true,
.lower_fsqrt = true,
#define DEFINE_OPTIONS(arch) \
static const nir_shader_compiler_options bifrost_nir_options_v##arch = { \
.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_find_lsb = true, \
.lower_ifind_msb = true, \
.lower_fdph = true, \
.lower_fsqrt = true, \
\
.lower_fsign = true, \
\
.lower_bitfield_insert_to_shifts = true, \
.lower_bitfield_extract_to_shifts = true, \
.lower_insert_byte = true, \
.lower_rotate = true, \
\
.lower_pack_half_2x16 = true, \
.lower_pack_unorm_2x16 = true, \
.lower_pack_snorm_2x16 = true, \
.lower_pack_unorm_4x8 = true, \
.lower_pack_snorm_4x8 = true, \
.lower_unpack_half_2x16 = true, \
.lower_unpack_unorm_2x16 = true, \
.lower_unpack_snorm_2x16 = true, \
.lower_unpack_unorm_4x8 = true, \
.lower_unpack_snorm_4x8 = true, \
.lower_pack_split = true, \
\
.lower_doubles_options = \
nir_lower_dmod, /* TODO: Don't lower supported 64-bit operations */ \
.lower_int64_options = ~0, /* TODO: Use IMULD on v7 */ \
.lower_mul_high = true, \
.lower_fisnormal = true, \
.lower_uadd_carry = true, \
.lower_usub_borrow = true, \
\
.has_fsub = true, \
.has_isub = true, \
.vectorize_io = true, \
.vectorize_vec2_16bit = true, \
.fuse_ffma16 = true, \
.fuse_ffma32 = true, \
.fuse_ffma64 = true, \
.use_interpolated_input_intrinsics = true, \
\
.lower_uniforms_to_ubo = true, \
\
.has_cs_global_id = true, \
.lower_cs_local_index_to_id = true, \
.max_unroll_iterations = 32, \
.force_indirect_unrolling = \
(nir_var_shader_in | nir_var_shader_out | nir_var_function_temp), \
.force_indirect_unrolling_sampler = true, \
\
.use_scoped_barrier = true, \
};
.lower_fsign = true,
.lower_bitfield_insert_to_shifts = true,
.lower_bitfield_extract_to_shifts = true,
.lower_insert_byte = true,
.lower_rotate = true,
.lower_pack_half_2x16 = true,
.lower_pack_unorm_2x16 = true,
.lower_pack_snorm_2x16 = true,
.lower_pack_unorm_4x8 = true,
.lower_pack_snorm_4x8 = true,
.lower_unpack_half_2x16 = true,
.lower_unpack_unorm_2x16 = true,
.lower_unpack_snorm_2x16 = true,
.lower_unpack_unorm_4x8 = true,
.lower_unpack_snorm_4x8 = true,
.lower_pack_split = true,
.lower_doubles_options = nir_lower_dmod,
/* TODO: Don't lower supported 64-bit operations */
.lower_int64_options = ~0,
/* TODO: Use IMULD on v7 */
.lower_mul_high = true,
.lower_fisnormal = true,
.lower_uadd_carry = true,
.lower_usub_borrow = true,
.has_fsub = true,
.has_isub = true,
.vectorize_io = true,
.vectorize_vec2_16bit = true,
.fuse_ffma16 = true,
.fuse_ffma32 = true,
.fuse_ffma64 = true,
.use_interpolated_input_intrinsics = true,
.lower_uniforms_to_ubo = true,
.has_cs_global_id = true,
.lower_cs_local_index_to_id = true,
.max_unroll_iterations = 32,
.force_indirect_unrolling =
(nir_var_shader_in | nir_var_shader_out | nir_var_function_temp),
.force_indirect_unrolling_sampler = true,
.use_scoped_barrier = true,
};
DEFINE_OPTIONS(6);
#endif
+1 -1
View File
@@ -36,7 +36,7 @@ const nir_shader_compiler_options *
GENX(pan_shader_get_compiler_options)(void)
{
#if PAN_ARCH >= 6
return &bifrost_nir_options;
return &bifrost_nir_options_v6;
#else
return &midgard_nir_options;
#endif