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[] = {
"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();