aco: remove per block inf/nan/sz control

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31172>
This commit is contained in:
Georg Lehmann 2024-09-13 20:19:44 +02:00 committed by Marge Bot
parent f1a09d1f40
commit 27cf11dc8a
4 changed files with 3 additions and 19 deletions

View file

@ -3658,7 +3658,7 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr)
tmp0->valu().abs[0] = true;
denorm_zero = tmp0->definitions[0].getTemp();
}
if (ctx->block->fp_mode.preserve_signed_zero_inf_nan32) {
if (nir_alu_instr_is_signed_zero_preserve(instr)) {
Temp copysign_0 =
bld.vop2(aco_opcode::v_mul_f32, bld.def(v1), Operand::zero(), as_vgpr(ctx, src));
bld.vop2(aco_opcode::v_cndmask_b32, Definition(dst), f32, copysign_0, denorm_zero);
@ -3681,7 +3681,7 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr)
Temp abs =
bld.sop2(aco_opcode::s_and_b32, bld.def(s1), bld.def(s1, scc), f32, abs_mask);
Operand sign;
if (ctx->block->fp_mode.preserve_signed_zero_inf_nan32) {
if (nir_alu_instr_is_signed_zero_preserve(instr)) {
sign =
bld.sop2(aco_opcode::s_andn2_b32, bld.def(s1), bld.def(s1, scc), f32, abs_mask);
} else {
@ -11495,12 +11495,6 @@ setup_fp_mode(isel_context* ctx, nir_shader* shader)
unsigned float_controls = shader->info.float_controls_execution_mode;
program->next_fp_mode.preserve_signed_zero_inf_nan32 =
float_controls & FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FP32;
program->next_fp_mode.preserve_signed_zero_inf_nan16_64 =
float_controls & (FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FP16 |
FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FP64);
program->next_fp_mode.must_flush_denorms32 =
float_controls & FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP32;
program->next_fp_mode.must_flush_denorms16_64 =

View file

@ -199,8 +199,6 @@ init_program(Program* program, Stage stage, const struct aco_shader_info* info,
program->progress = CompilationProgress::after_isel;
program->next_fp_mode.preserve_signed_zero_inf_nan32 = false;
program->next_fp_mode.preserve_signed_zero_inf_nan16_64 = false;
program->next_fp_mode.must_flush_denorms32 = false;
program->next_fp_mode.must_flush_denorms16_64 = false;
program->next_fp_mode.care_about_round32 = false;

View file

@ -151,9 +151,6 @@ struct float_mode {
};
uint8_t val = 0;
};
/* if false, optimizations which may remove infs/nan/-0.0 can be done */
bool preserve_signed_zero_inf_nan32 : 1;
bool preserve_signed_zero_inf_nan16_64 : 1;
/* if false, optimizations which may remove denormal flushing can be done */
bool must_flush_denorms32 : 1;
bool must_flush_denorms16_64 : 1;
@ -164,10 +161,7 @@ struct float_mode {
* current one instead. */
bool canReplace(float_mode other) const noexcept
{
return val == other.val &&
(preserve_signed_zero_inf_nan32 || !other.preserve_signed_zero_inf_nan32) &&
(preserve_signed_zero_inf_nan16_64 || !other.preserve_signed_zero_inf_nan16_64) &&
(must_flush_denorms32 || !other.must_flush_denorms32) &&
return val == other.val && (must_flush_denorms32 || !other.must_flush_denorms32) &&
(must_flush_denorms16_64 || !other.must_flush_denorms16_64) &&
(care_about_round32 || !other.care_about_round32) &&
(care_about_round16_64 || !other.care_about_round16_64);

View file

@ -222,8 +222,6 @@ BEGIN_TEST(optimize.output_modifiers)
//! /* logical preds: BB2, / linear preds: BB2, / kind: uniform, */
program->next_fp_mode.denorm32 = fp_denorm_keep;
program->next_fp_mode.denorm16_64 = fp_denorm_keep;
program->next_fp_mode.preserve_signed_zero_inf_nan32 = true;
program->next_fp_mode.preserve_signed_zero_inf_nan16_64 = true;
bld.reset(program->create_and_insert_block());
bld.is_sz_preserve = true;
program->blocks[2].linear_succs.push_back(3);