From 1d7c662b4bf2870d600da56452d53fbaff295a52 Mon Sep 17 00:00:00 2001 From: OreoFR <29048345+OreoFR@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:24:49 +0100 Subject: compile gate: `auto` default, calibrated at device creation With LEONIDA_COMPILE_GATE unset or `auto`, the device measures the driver once before the VulkanContext exists: a worker creates a synthetic compute pipeline (SPIR-V written in code, new specialization seed each run, no pipeline cache) while the queue gets empty submissions waited on a fence. Quick submissions with the create still in the driver give the adaptive gate; a held one, a create too fast to tell, an unexplained slow submission or any failure give classic. The verdict is cached per vendor/device/driver/pipelineCacheUUID in compile_gate_calibration.txt beside the pipeline cache; LEONIDA_COMPILE_GATE_RECALIBRATE=1 measures again. Only the title process calibrates; build hosts and tests keep classic. `classic`, `adaptive`, `1`, `0` still force a mode. Tests: compile_gate_policy_test (no GPU: settings, NVIDIA version decode, verdicts, cache file, SPIR-V shape) and vk_compile_gate_calibration_test (GPU: a verdict within 20 s, adaptive on NVIDIA 621.40). Co-Authored-By: Claude Opus 5.5 --- runtime/src/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/src/main.cpp') diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index 6f7039099..c8545f338 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp @@ -177,6 +177,7 @@ void start_title_peek(std::uint8_t* base) { } // namespace #include "base_reservation.h" +#include "compile_gate_policy.h" #include "code_hooks.h" #include "cpu_emulation.h" #include "host_cpu.h" @@ -390,6 +391,9 @@ int wmain(int argc, wchar_t** argv) { if (argc > 1 && std::wstring(argv[1]) == L"--precompile-pipelines") return precompile_main(argc, argv); if (argc > 1 && std::wstring(argv[1]) == L"--compile-server") return compile_server_main(argc, argv); #endif + // The title's process (not a build host above): LEONIDA_COMPILE_GATE=auto may calibrate the driver when the device + // is made (src/compile_gate_policy.h). + leonida::compile_gate_policy::calibration_allowed = true; std::filesystem::path image, game_dir, overlay_dir, mods_dir; uint32_t archetype_lookup_rva = 0; // --archetype-lookup RVA[,ARG]: the game's archetype lookup by hash int archetype_lookup_arg = 0; -- cgit v1.2.3