Skip to content

Commit

Permalink
Second performance test
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jun 26, 2023
1 parent 14cfcee commit 4915dd4
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions rpcs3/Emu/Cell/PPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3957,43 +3957,49 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
// Prevent watchdog thread from terminating
g_watchdog_hold_ctr++;

named_thread_group threads(fmt::format("PPUW.%u.", ++g_fxo->get<thread_index_allocator>().index), thread_count, [&]()
{
// Set low priority
thread_ctrl::scoped_priority low_prio(-1);

#ifdef __APPLE__
pthread_jit_write_protect_np(false);
#endif
for (u32 i = work_cv++; i < workload.size(); i = work_cv++, g_progr_pdone++)
const auto compile_func = [&]()
{
if (Emu.IsStopped())
#ifdef __APPLE__
pthread_jit_write_protect_np(false);
#endif
for (u32 i = work_cv++; i < workload.size(); i = work_cv++, g_progr_pdone++)
{
continue;
}
if (Emu.IsStopped())
{
continue;
}

// Keep allocating workload
const auto& [obj_name, part] = std::as_const(workload)[i];
// Keep allocating workload
const auto& [obj_name, part] = std::as_const(workload)[i];

// Allocate "core"
std::lock_guard jlock(g_fxo->get<jit_core_allocator>().sem);
// Allocate "core"
std::lock_guard jlock(g_fxo->get<jit_core_allocator>().sem);

if (Emu.IsStopped())
{
continue;
}
if (Emu.IsStopped())
{
continue;
}

ppu_log.warning("LLVM: Compiling module %s%s", cache_path, obj_name);
ppu_log.warning("LLVM: Compiling module %s%s", cache_path, obj_name);

// Use another JIT instance
jit_compiler jit2({}, g_cfg.core.llvm_cpu, 0x1);
ppu_initialize2(jit2, part, cache_path, obj_name);
// Use another JIT instance
jit_compiler jit2({}, g_cfg.core.llvm_cpu, 0x1);
ppu_initialize2(jit2, part, cache_path, obj_name);

ppu_log.success("LLVM: Compiled module %s", obj_name);
}
});
ppu_log.success("LLVM: Compiled module %s", obj_name);
}
};

// Lock unlock
g_fxo->get<jit_core_allocator>().sem.lock();
g_fxo->get<jit_core_allocator>().sem.unlock();

threads.join();
named_thread_group threads(fmt::format("PPUW.%u.", ++g_fxo->get<thread_index_allocator>().index), thread_count - 1, compile_func);
compile_func();

threads.join();
}

g_watchdog_hold_ctr--;

Expand Down

0 comments on commit 4915dd4

Please sign in to comment.