aboutsummaryrefslogtreecommitdiff
path: root/src/core/cpu_manager.cpp
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2026-02-01 01:54:59 +0100
committercrueter <crueter@eden-emu.dev>2026-02-01 01:54:59 +0100
commit1925726b96746bc436232b055ada641ea5f4d965 (patch)
tree6e6598f580bf83e19e574a9dfe54974df567b127 /src/core/cpu_manager.cpp
parentacf7deea957565937af43de66c7b86104553bc89 (diff)
[android, core] pin core threads to logical CPUs 0-3 (#3121)
this basically allows the threads to exist in these logical CPUs, undisturbed, and without trashing each other's cache this could improve performance, very tricky thing to pull off correctly, but again, this is mostly an experiment will mainly benefit: Linux, Android, FreeBSD, Windows (not ARM) Additionally, this means no context trashing :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3121 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/core/cpu_manager.cpp')
-rw-r--r--src/core/cpu_manager.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index 1a80fcfaa4..10fdcdf8a2 100644
--- a/src/core/cpu_manager.cpp
+++ b/src/core/cpu_manager.cpp
@@ -1,4 +1,4 @@
-// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
@@ -7,6 +7,7 @@
#include "common/fiber.h"
#include "common/scope_exit.h"
#include "common/thread.h"
+#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/cpu_manager.h"
@@ -25,11 +26,8 @@ CpuManager::~CpuManager() = default;
void CpuManager::Initialize() {
num_cores = is_multicore ? Core::Hardware::NUM_CPU_CORES : 1;
gpu_barrier = std::make_unique<Common::Barrier>(num_cores + 1);
-
- for (std::size_t core = 0; core < num_cores; core++) {
- core_data[core].host_thread =
- std::jthread([this, core](std::stop_token token) { RunThread(token, core); });
- }
+ for (std::size_t core = 0; core < num_cores; core++)
+ core_data[core].host_thread = std::jthread([this, core](std::stop_token token) { RunThread(token, core); });
}
void CpuManager::Shutdown() {
@@ -188,14 +186,15 @@ void CpuManager::ShutdownThread() {
void CpuManager::RunThread(std::stop_token token, std::size_t core) {
/// Initialization
system.RegisterCoreThread(core);
- std::string name;
- if (is_multicore) {
- name = "CPUCore_" + std::to_string(core);
- } else {
- name = "CPUThread";
- }
+ std::string name = is_multicore ? ("CPUCore_" + std::to_string(core)) : std::string{"CPUThread"};
Common::SetCurrentThreadName(name.c_str());
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
+#ifdef __ANDROID__
+ // Aimed specifically for Snapdragon 8 Elite devices
+ // This kills performance on desktop, but boosts perf for UMA devices
+ // like the S8E. Mediatek and Mali likely won't suffer.
+ Common::PinCurrentThreadToPerformanceCore(core);
+#endif
auto& data = core_data[core];
data.host_context = Common::Fiber::ThreadToFiber();