From 322a5afce3d6c5fbcf16ed9a8914805087b33a55 Mon Sep 17 00:00:00 2001 From: Takoroka <137927095+Takoroka@users.noreply.github.com> Date: Thu, 29 Oct 2026 00:37:06 -0400 Subject: nx2: macro memo hashes its keys as they are, rewrites re-stored calls in place The flat map re-hashed the already mixed u64 keys with MSVC's byte-wise FNV-1a (~1.4% of the GPU thread), and calls stored again after a data RAM guard failed appended new records, so the arena filled with stale copies and was cleared every few seconds. EDEN_NX2_MME_MEMO_STATS logs the counters: in title 1, 97.3% of calls replay, 2.1% fail a guard. --- src/video_core/macro.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/video_core/macro.cpp') diff --git a/src/video_core/macro.cpp b/src/video_core/macro.cpp index ee64ef5ab7..2864d1c5ad 100644 --- a/src/video_core/macro.cpp +++ b/src/video_core/macro.cpp @@ -1457,6 +1457,17 @@ void MacroEngine::Execute(Core::System& system, Engines::Maxwell3D& maxwell3d, u return value == nullptr || value[0] != '0'; }(); if (use_memo) { + // EDEN_NX2_MME_MEMO_STATS: log the memo's counters every 2^24 calls. + if (static const bool memo_stats = std::getenv("EDEN_NX2_MME_MEMO_STATS") != nullptr; + memo_stats && (++native_calls & 0xffffff) == 0) { + const auto& stats = native_memo.GetStatistics(); + LOG_INFO(HW_GPU, + "Macro memo: {} hits, {} misses, {} guard failures, {} stores ({} in " + "place), {} clears; {} entries, {} KiB", + stats.hits, stats.misses, stats.guard_failures, stats.stores, + stats.overwrites, stats.clears, native_memo.Size(), + native_memo.ArenaWords() * 4 / 1024); + } native_memo.Synchronize(native_code_generation); if (decltype(native_memo)::Effects effects; native_memo.Find(method, parameters, *native_interpreter.active_dram, effects)) { -- cgit v1.2.3