From 2dd56921c93332eec7a48159a22cfbe718a3f85f Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 14 Aug 2023 19:35:32 -0700 Subject: [PATCH] intel/fs: Index scheduler mode string table by mode enum pre_modes[] is an array with the modes ordered in our desired preference. scheduler_mode_name[] was also in that order, and the two had to be kept in sync. This is a little silly; we should just have a mode enum -> string table and look it up via the enum. Reviewed-by: Emma Anholt Part-of: --- src/intel/compiler/brw_fs.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index ad3f6ffa0b4..54d00936697 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -6749,10 +6749,11 @@ fs_visitor::allocate_registers(bool allow_spilling) }; static const char *scheduler_mode_name[] = { - "top-down", - "non-lifo", - "none", - "lifo" + [SCHEDULE_PRE] = "top-down", + [SCHEDULE_PRE_NON_LIFO] = "non-lifo", + [SCHEDULE_PRE_LIFO] = "lifo", + [SCHEDULE_POST] = "post", + [SCHEDULE_NONE] = "none", }; compact_virtual_grfs(); @@ -6783,6 +6784,8 @@ fs_visitor::allocate_registers(bool allow_spilling) * performance but increasing likelihood of allocating. */ for (unsigned i = 0; i < ARRAY_SIZE(pre_modes); i++) { + enum instruction_scheduler_mode sched_mode = pre_modes[i]; + if (i > 0) { /* Unless we're the first pass, reset back to the original order */ ip = 0; @@ -6798,8 +6801,8 @@ fs_visitor::allocate_registers(bool allow_spilling) invalidate_analysis(DEPENDENCY_INSTRUCTIONS); } - schedule_instructions(pre_modes[i]); - this->shader_stats.scheduler_mode = scheduler_mode_name[i]; + schedule_instructions(sched_mode); + this->shader_stats.scheduler_mode = scheduler_mode_name[sched_mode]; if (0) { assign_regs_trivial();