1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 20:22:30 +01:00

SPU: SPURS limiter algorithm update

This commit is contained in:
Elad Ashkenazi 2024-09-23 10:00:12 +03:00 committed by Elad
parent ad42a2b89a
commit 6995467ff6
2 changed files with 24 additions and 10 deletions

View File

@ -1823,23 +1823,33 @@ void spu_thread::cpu_task()
return fmt::format("%sSPU[0x%07x] Thread (%s) [0x%05x]", type >= spu_type::raw ? type == spu_type::isolated ? "Iso" : "Raw" : "", cpu->lv2_id, *name_cache.get(), cpu->pc); return fmt::format("%sSPU[0x%07x] Thread (%s) [0x%05x]", type >= spu_type::raw ? type == spu_type::isolated ? "Iso" : "Raw" : "", cpu->lv2_id, *name_cache.get(), cpu->pc);
}; };
if (!spurs_addr) constexpr u32 invalid_spurs = 0u - 0x80;
if (spurs_addr == 0)
{ {
// Evaluate it // Evaluate it
if (!group) if (!group)
{ {
spurs_addr = -0x80; // Some invalid non-0 address spurs_addr = invalid_spurs; // Some invalid non-0 address
} }
else else
{ {
const u32 arg = static_cast<u32>(group->args[index][1]); const u32 arg = static_cast<u32>(group->args[index][1]);
spurs_addr = group->name.ends_with("CellSpursKernelGroup"sv) && vm::check_addr(arg) ? arg : 0u - 0x80;
}
}
if (spurs_addr && group->max_run != 6) if (group->name.ends_with("CellSpursKernelGroup"sv) && vm::check_addr(arg))
{ {
group->spurs_running++; spurs_addr = arg;
if (group->max_run != group->max_num)
{
group->spurs_running++;
}
}
else
{
spurs_addr = invalid_spurs;
}
}
} }
if (jit) if (jit)
@ -1890,7 +1900,7 @@ void spu_thread::cpu_task()
allow_interrupts_in_cpu_work = false; allow_interrupts_in_cpu_work = false;
} }
if (spurs_addr && group->max_run != 6) if (spurs_addr != invalid_spurs && group->max_run != group->max_num)
{ {
if (group->spurs_running.exchange(0)) if (group->spurs_running.exchange(0))
{ {
@ -4887,6 +4897,7 @@ bool spu_thread::process_mfc_cmd()
if (do_putllc(ch_mfc_cmd)) if (do_putllc(ch_mfc_cmd))
{ {
ch_atomic_stat.set_value(MFC_PUTLLC_SUCCESS); ch_atomic_stat.set_value(MFC_PUTLLC_SUCCESS);
spurs_waited = false;
} }
else else
{ {
@ -5482,10 +5493,12 @@ s64 spu_thread::get_ch_value(u32 ch)
case SPU_RdEventStat: case SPU_RdEventStat:
{ {
const bool is_spurs_task_wait = pc == 0x11a8 && group->max_run != 6 && spurs_addr; const bool is_spurs_task_wait = pc == 0x11a8 && group->max_run != group->max_num && spurs_addr == raddr && !spurs_waited;
if (is_spurs_task_wait) if (is_spurs_task_wait)
{ {
spurs_waited = true;
const u32 prev_running = group->spurs_running.fetch_op([](u32& x) const u32 prev_running = group->spurs_running.fetch_op([](u32& x)
{ {
if (x) if (x)

View File

@ -767,6 +767,7 @@ public:
const u32 option; // sys_spu_thread_initialize option const u32 option; // sys_spu_thread_initialize option
const u32 lv2_id; // The actual id that is used by syscalls const u32 lv2_id; // The actual id that is used by syscalls
u32 spurs_addr = 0; u32 spurs_addr = 0;
bool spurs_waited = false;
spu_thread* next_cpu{}; // LV2 thread queues' node link spu_thread* next_cpu{}; // LV2 thread queues' node link