diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2023-09-09 03:25:44 -0700 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2024-03-19 00:40:52 +0000 |
commit | 8573e9bf472bb78af44514ae8941df155b919b4c (patch) | |
tree | d1f75e8c546e89159b3a6a2ac9e8031f2df7dbf7 | |
parent | 84e8a295a0979def2a73f17be63d78cb10fd4a6d (diff) |
These have been incredibly useful when debugging regressions and weird
behavior in the Intel backend when trying to spill multiple registers
before retrying allocation. With them, we can print out not only what
register was chosen, but the benefit and cost. Seeing lists of chosen
registers where the benefit/cost was not sorted, and poor options were
chosen before better ones, led me to investigate a number of issues.
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28257>
-rw-r--r-- | src/util/register_allocate.c | 12 | ||||
-rw-r--r-- | src/util/register_allocate.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c index e9e8b6e9150..7870050dd8d 100644 --- a/src/util/register_allocate.c +++ b/src/util/register_allocate.c @@ -1031,6 +1031,12 @@ ra_get_spill_benefit(struct ra_graph *g, unsigned int n) return benefit; } +float +ra_debug_get_spill_benefit(struct ra_graph *g, unsigned int n) +{ + return ra_get_spill_benefit(g, n); +} + /** * Returns a node number to be spilled according to the cost/benefit using * the pq test, or -1 if there are no spillable nodes. @@ -1077,3 +1083,9 @@ ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost) { g->nodes[n].spill_cost = cost; } + +float +ra_debug_get_node_spill_cost(struct ra_graph *g, unsigned int n) +{ + return g->nodes[n].spill_cost; +} diff --git a/src/util/register_allocate.h b/src/util/register_allocate.h index 34dcc09650e..f4e7b4174ca 100644 --- a/src/util/register_allocate.h +++ b/src/util/register_allocate.h @@ -133,6 +133,8 @@ void ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost); int ra_get_best_spill_node(struct ra_graph *g); /** @} */ +float ra_debug_get_node_spill_cost(struct ra_graph *g, unsigned int n); +float ra_debug_get_spill_benefit(struct ra_graph *g, unsigned int n); #ifdef __cplusplus } // extern "C" |