From cc404d45ff4fa7947cffdc75da0d2b773902a1e4 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Fri, 17 May 2024 18:14:19 +0200 Subject: [PATCH] aco: remove perfwarn This didn't do anything useful. Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/README.md | 1 - src/amd/compiler/aco_interface.cpp | 2 +- src/amd/compiler/aco_ir.cpp | 1 - src/amd/compiler/aco_ir.h | 10 -------- src/amd/compiler/aco_optimizer.cpp | 40 ------------------------------ src/amd/compiler/aco_shader_info.h | 1 - src/amd/compiler/aco_validate.cpp | 10 -------- src/amd/vulkan/radv_shader.c | 1 - 8 files changed, 1 insertion(+), 65 deletions(-) diff --git a/src/amd/compiler/README.md b/src/amd/compiler/README.md index 6dac15be3e6..0456b8a9ed7 100644 --- a/src/amd/compiler/README.md +++ b/src/amd/compiler/README.md @@ -249,7 +249,6 @@ We also have `ACO_DEBUG` options: * `validateir` - Validate the ACO IR between compilation stages. By default, enabled in debug builds and disabled in release builds. * `validatera` - Perform a RA (register allocation) validation. -* `perfwarn` - Warn when sub-optimal instructions are found. * `force-waitcnt` - Forces ACO to emit a wait state after each instruction when there is something to wait for. Harms performance. * `novn` - Disables the ACO value numbering stage. * `noopt` - Disables the ACO optimizer. diff --git a/src/amd/compiler/aco_interface.cpp b/src/amd/compiler/aco_interface.cpp index a1d747c71f6..12253f7f397 100644 --- a/src/amd/compiler/aco_interface.cpp +++ b/src/amd/compiler/aco_interface.cpp @@ -404,7 +404,7 @@ aco_get_codegen_flags() init(); /* Exclude flags which don't affect code generation. */ uint64_t exclude = - DEBUG_VALIDATE_IR | DEBUG_VALIDATE_RA | DEBUG_PERFWARN | DEBUG_PERF_INFO | DEBUG_LIVE_INFO; + DEBUG_VALIDATE_IR | DEBUG_VALIDATE_RA | DEBUG_PERF_INFO | DEBUG_LIVE_INFO; return debug_flags & ~exclude; } diff --git a/src/amd/compiler/aco_ir.cpp b/src/amd/compiler/aco_ir.cpp index a987bfa33ad..8400a5dc6df 100644 --- a/src/amd/compiler/aco_ir.cpp +++ b/src/amd/compiler/aco_ir.cpp @@ -22,7 +22,6 @@ static const struct debug_control aco_debug_options[] = { {"validateir", DEBUG_VALIDATE_IR}, {"validatera", DEBUG_VALIDATE_RA}, {"novalidateir", DEBUG_NO_VALIDATE_IR}, - {"perfwarn", DEBUG_PERFWARN}, {"force-waitcnt", DEBUG_FORCE_WAITCNT}, {"force-waitdeps", DEBUG_FORCE_WAITDEPS}, {"novn", DEBUG_NO_VN}, diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 527ee8abb8d..fb62821398b 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -30,7 +30,6 @@ extern uint64_t debug_flags; enum { DEBUG_VALIDATE_IR = 0x1, DEBUG_VALIDATE_RA = 0x2, - DEBUG_PERFWARN = 0x4, DEBUG_FORCE_WAITCNT = 0x8, DEBUG_NO_VN = 0x10, DEBUG_NO_OPT = 0x20, @@ -2200,13 +2199,6 @@ bool print_asm(Program* program, std::vector& binary, unsigned exec_si bool validate_ir(Program* program); bool validate_cfg(Program* program); bool validate_ra(Program* program); -#ifndef NDEBUG -void perfwarn(Program* program, bool cond, const char* msg, Instruction* instr = NULL); -#else -#define perfwarn(program, cond, msg, ...) \ - do { \ - } while (0) -#endif void collect_presched_stats(Program* program); void collect_preasm_stats(Program* program); @@ -2237,10 +2229,8 @@ void aco_print_program(const Program* program, FILE* output, unsigned flags = 0) void aco_print_program(const Program* program, FILE* output, const live& live_vars, unsigned flags = 0); -void _aco_perfwarn(Program* program, const char* file, unsigned line, const char* fmt, ...); void _aco_err(Program* program, const char* file, unsigned line, const char* fmt, ...); -#define aco_perfwarn(program, ...) _aco_perfwarn(program, __FILE__, __LINE__, __VA_ARGS__) #define aco_err(program, ...) _aco_err(program, __FILE__, __LINE__, __VA_ARGS__) int get_op_fixed_to_def(Instruction* instr); diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 4832781e188..e5dea2dfa2b 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -16,30 +16,6 @@ namespace aco { -#ifndef NDEBUG -void -perfwarn(Program* program, bool cond, const char* msg, Instruction* instr) -{ - if (cond) { - char* out; - size_t outsize; - struct u_memstream mem; - u_memstream_open(&mem, &out, &outsize); - FILE* const memf = u_memstream_get(&mem); - - fprintf(memf, "%s: ", msg); - aco_print_instr(program->gfx_level, instr, memf); - u_memstream_close(&mem); - - aco_perfwarn(program, out); - free(out); - - if (debug_flags & DEBUG_PERFWARN) - exit(1); - } -} -#endif - /** * The optimizer works in 4 phases: * (1) The first pass collects information for each ssa-def, @@ -1324,20 +1300,6 @@ detect_clamp(Instruction* instr, unsigned* clamped_idx) void label_instruction(opt_ctx& ctx, aco_ptr& instr) { - if (instr->isSALU() || instr->isVALU() || instr->isPseudo()) { - ASSERTED bool all_const = false; - for (Operand& op : instr->operands) - all_const = - all_const && (!op.isTemp() || ctx.info[op.tempId()].is_constant_or_literal(32)); - perfwarn(ctx.program, all_const, "All instruction operands are constant", instr.get()); - - ASSERTED bool is_copy = instr->opcode == aco_opcode::s_mov_b32 || - instr->opcode == aco_opcode::s_mov_b64 || - instr->opcode == aco_opcode::v_mov_b32; - perfwarn(ctx.program, is_copy && !instr->usesModifiers(), "Use p_parallelcopy instead", - instr.get()); - } - if (instr->isSMEM()) smem_combine(ctx, instr); @@ -1442,8 +1404,6 @@ label_instruction(opt_ctx& ctx, aco_ptr& instr) if (info.is_constant(bits) && alu_can_accept_constant(instr, i) && (!instr->isSDWA() || ctx.program->gfx_level >= GFX9) && (!instr->isDPP() || i != 1)) { Operand op = get_constant_op(ctx, info, bits); - perfwarn(ctx.program, instr->opcode == aco_opcode::v_cndmask_b32 && i == 2, - "v_cndmask_b32 with a constant selector", instr.get()); if (i == 0 || instr->isSDWA() || instr->opcode == aco_opcode::v_readlane_b32 || instr->opcode == aco_opcode::v_writelane_b32) { instr->format = withoutDPP(instr->format); diff --git a/src/amd/compiler/aco_shader_info.h b/src/amd/compiler/aco_shader_info.h index ccd882b05f3..1cc2bc11db4 100644 --- a/src/amd/compiler/aco_shader_info.h +++ b/src/amd/compiler/aco_shader_info.h @@ -141,7 +141,6 @@ struct aco_shader_info { }; enum aco_compiler_debug_level { - ACO_COMPILER_DEBUG_LEVEL_PERFWARN, ACO_COMPILER_DEBUG_LEVEL_ERROR, }; diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index e91c8642944..dd65110b237 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -39,16 +39,6 @@ aco_log(Program* program, enum aco_compiler_debug_level level, const char* prefi ralloc_free(msg); } -void -_aco_perfwarn(Program* program, const char* file, unsigned line, const char* fmt, ...) -{ - va_list args; - - va_start(args, fmt); - aco_log(program, ACO_COMPILER_DEBUG_LEVEL_PERFWARN, "ACO PERFWARN:\n", file, line, fmt, args); - va_end(args); -} - void _aco_err(Program* program, const char* file, unsigned line, const char* fmt, ...) { diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index fa9cee8f845..4af7d0b5887 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -269,7 +269,6 @@ radv_compiler_debug(void *private_data, enum aco_compiler_debug_level level, con struct radv_instance *instance = radv_physical_device_instance(pdev); static const VkDebugReportFlagsEXT vk_flags[] = { - [ACO_COMPILER_DEBUG_LEVEL_PERFWARN] = VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, [ACO_COMPILER_DEBUG_LEVEL_ERROR] = VK_DEBUG_REPORT_ERROR_BIT_EXT, };