mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
tu/autotune: Only lock RPs sustain certain mode for 30s
Many games have short periods where a certain mode might win consistently but this trend doesn't hold after that. Only allowing locking to occur on RPs where a certain mode consistently stays winning for 30s allows us to partially mitigate these bad locks. Signed-off-by: Dhruv Mark Collins <mark@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37802>
This commit is contained in:
parent
c725f2aea3
commit
da089bf741
1 changed files with 13 additions and 1 deletions
|
|
@ -1059,6 +1059,9 @@ struct tu_autotune::rp_history {
|
|||
bool locked = false; /* If true, the probability will no longer be updated. */
|
||||
uint64_t seed[2] { 0x3bffb83978e24f88, 0x9238d5d56c71cd35 };
|
||||
|
||||
bool is_sysmem_winning = false;
|
||||
uint64_t winning_since_ts = 0;
|
||||
|
||||
public:
|
||||
profiled_algo(uint64_t hash)
|
||||
{
|
||||
|
|
@ -1125,6 +1128,15 @@ struct tu_autotune::rp_history {
|
|||
constexpr uint32_t MIN_LOCK_DURATION_COUNT = 15;
|
||||
constexpr uint64_t MIN_LOCK_THRESHOLD = GPU_TICKS_PER_US * 1'000; /* 1ms */
|
||||
constexpr uint32_t LOCK_PERCENT_DIFF = 30;
|
||||
constexpr uint64_t LOCK_TIME_WINDOW_NS = 30'000'000'000; /* 30s */
|
||||
|
||||
uint64_t now = os_time_get_nano();
|
||||
bool current_sysmem_winning = avg_sysmem < avg_gmem;
|
||||
|
||||
if (winning_since_ts == 0 || current_sysmem_winning != is_sysmem_winning) {
|
||||
winning_since_ts = now;
|
||||
is_sysmem_winning = current_sysmem_winning;
|
||||
}
|
||||
|
||||
bool has_resolved = sysmem_prob == SLOW_MAX_PROBABILITY || sysmem_prob == SLOW_MIN_PROBABILITY;
|
||||
bool enough_samples =
|
||||
|
|
@ -1134,7 +1146,7 @@ struct tu_autotune::rp_history {
|
|||
uint64_t percent_diff = (100 * (max_avg - min_avg)) / min_avg;
|
||||
|
||||
if (has_resolved && enough_samples && max_avg >= MIN_LOCK_THRESHOLD &&
|
||||
percent_diff >= LOCK_PERCENT_DIFF) {
|
||||
percent_diff >= LOCK_PERCENT_DIFF && (now - winning_since_ts) >= LOCK_TIME_WINDOW_NS) {
|
||||
if (avg_gmem < avg_sysmem)
|
||||
sysmem_prob = 0;
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue