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 <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24707>
This commit is contained in:
Kenneth Graunke
2023-08-14 19:35:32 -07:00
committed by Marge Bot
parent 7eba19245d
commit 2dd56921c9

View File

@@ -6749,10 +6749,11 @@ fs_visitor::allocate_registers(bool allow_spilling)
}; };
static const char *scheduler_mode_name[] = { static const char *scheduler_mode_name[] = {
"top-down", [SCHEDULE_PRE] = "top-down",
"non-lifo", [SCHEDULE_PRE_NON_LIFO] = "non-lifo",
"none", [SCHEDULE_PRE_LIFO] = "lifo",
"lifo" [SCHEDULE_POST] = "post",
[SCHEDULE_NONE] = "none",
}; };
compact_virtual_grfs(); compact_virtual_grfs();
@@ -6783,6 +6784,8 @@ fs_visitor::allocate_registers(bool allow_spilling)
* performance but increasing likelihood of allocating. * performance but increasing likelihood of allocating.
*/ */
for (unsigned i = 0; i < ARRAY_SIZE(pre_modes); i++) { for (unsigned i = 0; i < ARRAY_SIZE(pre_modes); i++) {
enum instruction_scheduler_mode sched_mode = pre_modes[i];
if (i > 0) { if (i > 0) {
/* Unless we're the first pass, reset back to the original order */ /* Unless we're the first pass, reset back to the original order */
ip = 0; ip = 0;
@@ -6798,8 +6801,8 @@ fs_visitor::allocate_registers(bool allow_spilling)
invalidate_analysis(DEPENDENCY_INSTRUCTIONS); invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
} }
schedule_instructions(pre_modes[i]); schedule_instructions(sched_mode);
this->shader_stats.scheduler_mode = scheduler_mode_name[i]; this->shader_stats.scheduler_mode = scheduler_mode_name[sched_mode];
if (0) { if (0) {
assign_regs_trivial(); assign_regs_trivial();