nir: always emit ddx intrinsics
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31014>
This commit is contained in:
@@ -101,7 +101,6 @@ void ac_set_nir_options(struct radeon_info *info, bool use_llvm,
|
||||
nir_io_prefer_scalar_fs_inputs |
|
||||
nir_io_mix_convergent_flat_with_interpolated |
|
||||
nir_io_vectorizer_ignores_types;
|
||||
options->has_ddx_intrinsics = true;
|
||||
options->scalarize_ddx = true;
|
||||
options->skip_lower_packing_ops =
|
||||
BITFIELD_BIT(nir_lower_packing_op_unpack_64_2x32) |
|
||||
|
@@ -316,6 +316,5 @@ static const nir_shader_compiler_options agx_nir_options = {
|
||||
.lower_fquantize2f16 = true,
|
||||
.compact_arrays = true,
|
||||
.discard_is_demote = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
.scalarize_ddx = true,
|
||||
};
|
||||
|
@@ -230,7 +230,6 @@ v3dv_pipeline_get_nir_options(const struct v3d_device_info *devinfo)
|
||||
.divergence_analysis_options =
|
||||
nir_divergence_multiple_workgroup_per_compute_subgroup,
|
||||
.discard_is_demote = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
.scalarize_ddx = true,
|
||||
};
|
||||
|
||||
|
@@ -1998,26 +1998,21 @@ nir_tex_src_for_ssa(nir_tex_src_type src_type, nir_def *def)
|
||||
#undef nir_ddy_coarse
|
||||
|
||||
static inline nir_def *
|
||||
nir_build_deriv(nir_builder *b, nir_def *x, nir_op alu, nir_intrinsic_op intrin)
|
||||
nir_build_deriv(nir_builder *b, nir_def *x, nir_intrinsic_op intrin)
|
||||
{
|
||||
/* Otherwise, build the derivative instruction: either intrinsic or ALU. */
|
||||
if (b->shader->options->has_ddx_intrinsics) {
|
||||
if (b->shader->options->scalarize_ddx && x->num_components > 1) {
|
||||
nir_def *res[NIR_MAX_VEC_COMPONENTS] = { NULL };
|
||||
if (b->shader->options->scalarize_ddx && x->num_components > 1) {
|
||||
nir_def *res[NIR_MAX_VEC_COMPONENTS] = { NULL };
|
||||
|
||||
for (unsigned i = 0; i < x->num_components; ++i) {
|
||||
res[i] = _nir_build_ddx(b, x->bit_size, nir_channel(b, x, i));
|
||||
nir_instr_as_intrinsic(res[i]->parent_instr)->intrinsic = intrin;
|
||||
}
|
||||
|
||||
return nir_vec(b, res, x->num_components);
|
||||
} else {
|
||||
nir_def *res = _nir_build_ddx(b, x->bit_size, x);
|
||||
nir_instr_as_intrinsic(res->parent_instr)->intrinsic = intrin;
|
||||
return res;
|
||||
for (unsigned i = 0; i < x->num_components; ++i) {
|
||||
res[i] = _nir_build_ddx(b, x->bit_size, nir_channel(b, x, i));
|
||||
nir_instr_as_intrinsic(res[i]->parent_instr)->intrinsic = intrin;
|
||||
}
|
||||
|
||||
return nir_vec(b, res, x->num_components);
|
||||
} else {
|
||||
return nir_build_alu1(b, alu, x);
|
||||
nir_def *res = _nir_build_ddx(b, x->bit_size, x);
|
||||
nir_instr_as_intrinsic(res->parent_instr)->intrinsic = intrin;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2025,7 +2020,7 @@ nir_build_deriv(nir_builder *b, nir_def *x, nir_op alu, nir_intrinsic_op intrin)
|
||||
static inline nir_def * \
|
||||
nir_##op(nir_builder *build, nir_def *src0) \
|
||||
{ \
|
||||
return nir_build_deriv(build, src0, nir_op_f##op, nir_intrinsic_##op); \
|
||||
return nir_build_deriv(build, src0, nir_intrinsic_##op); \
|
||||
}
|
||||
|
||||
DEF_DERIV(ddx)
|
||||
|
@@ -112,7 +112,6 @@ static const nir_shader_compiler_options ir3_base_options = {
|
||||
.lower_doubles_options = (nir_lower_doubles_options)~0,
|
||||
|
||||
.divergence_analysis_options = nir_divergence_uniform_load_tears,
|
||||
.has_ddx_intrinsics = true,
|
||||
.scalarize_ddx = true,
|
||||
};
|
||||
|
||||
|
@@ -4087,7 +4087,6 @@ static const nir_shader_compiler_options nir_to_tgsi_compiler_options = {
|
||||
* workgroup id.
|
||||
*/
|
||||
.lower_cs_local_index_to_id = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
};
|
||||
|
||||
/* Returns a default compiler options for drivers with only nir-to-tgsi-based
|
||||
|
@@ -78,7 +78,6 @@ etna_compiler_create(const char *renderer, const struct etna_core_info *info)
|
||||
.lower_ufind_msb = true,
|
||||
.has_uclz = true,
|
||||
.no_integers = info->halti < 2,
|
||||
.has_ddx_intrinsics = true,
|
||||
};
|
||||
|
||||
compiler->regs = etna_ra_setup(compiler);
|
||||
|
@@ -126,7 +126,6 @@ static const nir_shader_compiler_options i915_compiler_options = {
|
||||
.max_unroll_iterations = 32,
|
||||
.no_integers = true,
|
||||
.has_fused_comp_and_csel = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
};
|
||||
|
||||
static const struct nir_shader_compiler_options gallivm_nir_options = {
|
||||
|
@@ -87,7 +87,6 @@ static const nir_shader_compiler_options fs_nir_options = {
|
||||
.force_indirect_unrolling_sampler = true,
|
||||
.lower_varying_from_uniform = true,
|
||||
.max_unroll_iterations = 32,
|
||||
.has_ddx_intrinsics = true,
|
||||
.no_integers = true,
|
||||
};
|
||||
|
||||
|
@@ -673,7 +673,6 @@ static const struct nir_shader_compiler_options gallivm_nir_options = {
|
||||
.lower_fisnormal = true,
|
||||
.lower_fquantize2f16 = true,
|
||||
.driver_functions = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
.scalarize_ddx = true,
|
||||
};
|
||||
|
||||
|
@@ -482,7 +482,6 @@ static const nir_shader_compiler_options nv30_base_compiler_options = {
|
||||
.no_integers = true,
|
||||
|
||||
.use_interpolated_input_intrinsics = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
};
|
||||
|
||||
static const void *
|
||||
|
@@ -488,8 +488,7 @@ static int r300_get_video_param(struct pipe_screen *screen,
|
||||
.lower_uniforms_to_ubo = true, \
|
||||
.lower_vector_cmp = true, \
|
||||
.no_integers = true, \
|
||||
.use_interpolated_input_intrinsics = true, \
|
||||
.has_ddx_intrinsics = true
|
||||
.use_interpolated_input_intrinsics = true
|
||||
|
||||
static const nir_shader_compiler_options r500_vs_compiler_options = {
|
||||
COMMON_NIR_OPTIONS,
|
||||
|
@@ -1404,7 +1404,6 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
|
||||
.lower_uniforms_to_ubo = true,
|
||||
.lower_image_offset_to_range_base = 1,
|
||||
.vectorize_tess_levels = 1,
|
||||
.has_ddx_intrinsics = true,
|
||||
};
|
||||
|
||||
rscreen->nir_options = nir_options;
|
||||
|
@@ -95,7 +95,6 @@ static const nir_shader_compiler_options sp_compiler_options = {
|
||||
* workgroup id.
|
||||
*/
|
||||
.lower_cs_local_index_to_id = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
};
|
||||
|
||||
static const void *
|
||||
|
@@ -717,8 +717,7 @@ vgpu10_get_shader_param(struct pipe_screen *screen,
|
||||
.lower_vector_cmp = true, \
|
||||
.lower_cs_local_index_to_id = true, \
|
||||
.max_unroll_iterations = 32, \
|
||||
.use_interpolated_input_intrinsics = true, \
|
||||
.has_ddx_intrinsics = true
|
||||
.use_interpolated_input_intrinsics = true
|
||||
|
||||
#define VGPU10_OPTIONS \
|
||||
.lower_doubles_options = nir_lower_dfloor | nir_lower_dsign | nir_lower_dceil | nir_lower_dtrunc | nir_lower_dround_even, \
|
||||
|
@@ -763,7 +763,6 @@ v3d_screen_get_compiler_options(struct pipe_screen *pscreen,
|
||||
*/
|
||||
.max_unroll_iterations = 16,
|
||||
.force_indirect_unrolling_sampler = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
.scalarize_ddx = true,
|
||||
};
|
||||
|
||||
|
@@ -2184,7 +2184,6 @@ static const nir_shader_compiler_options nir_options = {
|
||||
.lower_mul_high = true,
|
||||
.max_unroll_iterations = 32,
|
||||
.force_indirect_unrolling = (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp),
|
||||
.has_ddx_intrinsics = true,
|
||||
.scalarize_ddx = true,
|
||||
};
|
||||
|
||||
|
@@ -1384,7 +1384,6 @@ zink_screen_init_compiler(struct zink_screen *screen)
|
||||
.support_indirect_outputs = BITFIELD_MASK(MESA_SHADER_COMPUTE),
|
||||
.max_unroll_iterations = 0,
|
||||
.use_interpolated_input_intrinsics = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
};
|
||||
|
||||
screen->nir_options = default_options;
|
||||
|
@@ -79,7 +79,6 @@ const struct nir_shader_compiler_options brw_scalar_nir_options = {
|
||||
.vectorize_io = true,
|
||||
.vectorize_tess_levels = true,
|
||||
.vertex_id_zero_based = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
.scalarize_ddx = true,
|
||||
};
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
.vectorize_io = true, \
|
||||
.vectorize_tess_levels = true, \
|
||||
.use_interpolated_input_intrinsics = true, \
|
||||
.has_ddx_intrinsics = true, \
|
||||
.scalarize_ddx = true, \
|
||||
.lower_insert_byte = true, \
|
||||
.lower_insert_word = true, \
|
||||
|
@@ -161,7 +161,6 @@ nir_options = {
|
||||
.support_16bit_alu = true,
|
||||
.preserve_mediump = true,
|
||||
.discard_is_demote = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
.scalarize_ddx = true,
|
||||
};
|
||||
|
||||
|
@@ -163,7 +163,6 @@ fn nir_options(dev: &nv_device_info) -> nir_shader_compiler_options {
|
||||
op.discard_is_demote = true;
|
||||
|
||||
op.max_unroll_iterations = 32;
|
||||
op.has_ddx_intrinsics = true;
|
||||
op.scalarize_ddx = true;
|
||||
|
||||
op
|
||||
|
@@ -100,7 +100,6 @@ void bifrost_compile_shader_nir(nir_shader *nir,
|
||||
.force_indirect_unrolling = \
|
||||
(nir_var_shader_in | nir_var_shader_out | nir_var_function_temp), \
|
||||
.force_indirect_unrolling_sampler = true, \
|
||||
.has_ddx_intrinsics = true, \
|
||||
.scalarize_ddx = true, \
|
||||
};
|
||||
|
||||
|
@@ -106,7 +106,6 @@ static const nir_shader_compiler_options midgard_nir_options = {
|
||||
.force_indirect_unrolling =
|
||||
(nir_var_shader_in | nir_var_shader_out | nir_var_function_temp),
|
||||
.force_indirect_unrolling_sampler = true,
|
||||
.has_ddx_intrinsics = true,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user