From e4deef6ba4ea76aac997ed3102f8e9801fd170b9 Mon Sep 17 00:00:00 2001 From: Takoroka <137927095+Takoroka@users.noreply.github.com> Date: Wed, 28 Oct 2026 20:43:00 -0400 Subject: Native MME: decode each instruction once; reuse the parameter FIFO The Turing macro interpreter re-extracted every field of each 96-bit instruction on every execution and copied the register file per instruction; title 1's GPU thread spent about half its busy time there. Instructions are now decoded once per PC (re-decoded when their words change) and both lanes' operands are read up front instead of copying the registers. The parameter FIFO is a member instead of a vector allocated per macro call. Rendering checked unchanged on the attract loop; the GPU thread went from ~68% to ~45-50% busy. --- src/video_core/macro.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/video_core/macro.cpp') diff --git a/src/video_core/macro.cpp b/src/video_core/macro.cpp index d70cfefd2f..d3ba353ca0 100644 --- a/src/video_core/macro.cpp +++ b/src/video_core/macro.cpp @@ -1354,7 +1354,9 @@ void MacroEngine::Execute(Core::System& system, Engines::Maxwell3D& maxwell3d, u } LOG_DEBUG(HW_GPU, "Native MME context={:#x}", context); LOG_DEBUG(HW_GPU, "Native MME start={:#x}, parameters={}, data={:08x}", method, parameters.size(), fmt::join(parameters, ",")); - std::vector fifo(parameters.begin(), parameters.end()); + // Reused between calls (a macro never calls another: methods >= 0xe00 are refused below). + auto& fifo = native_fifo; + fifo.assign(parameters.begin(), parameters.end()); native_interpreter.active_dram = &maxwell3d.GetNativeDataRam(); const auto result = native_interpreter.Execute(native_code, method, fifo, [&](u32 address) { return address < Maxwell3D::Regs::NUM_REGS ? maxwell3d.GetRegisterValue(address) : 0U; }, -- cgit v1.2.3