diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp index 9eca923131..a9f3320867 100644 --- a/runtime/shims/d3d12_vulkan_device.cpp +++ b/runtime/shims/d3d12_vulkan_device.cpp @@ -17727,6 +17727,7 @@ ComputeBuild build_compute_pipeline(DeviceState& device, const leonida::ShaderEn auto& compiling = leonida::driver_compile; VkResult created = VK_ERROR_UNKNOWN; bool from_shared = false, probe_compiled = false; + int hit_reported = -1; // what the journal sees as its hit, printed below to explain a missing write ULONGLONG probe_ms = 0, driver_ms = 0; { // Every driver call of the build (shader module, journal cache, pipeline) in one turn through the compile @@ -17773,7 +17774,8 @@ ComputeBuild build_compute_pipeline(DeviceState& device, const leonida::ShaderEn } compiling.name.store(nullptr, std::memory_order_release); vk.vkDestroyShaderModule(dev, module, nullptr); // Vulkan lets a module go once the pipeline exists - journal.finish(!from_shared && created == VK_SUCCESS && built, trace.hit(), driver_ms); + hit_reported = trace.hit(); // what finish() sees; decides whether the file is written + journal.finish(!from_shared && created == VK_SUCCESS && built, hit_reported, driver_ms); } std::vector().swap(words); profile.finish(int(created)); @@ -17793,8 +17795,15 @@ ComputeBuild build_compute_pipeline(DeviceState& device, const leonida::ShaderEn out.journaled = journal.written(); out.ms = GetTickCount64() - started; if (created == VK_SUCCESS && built && out.ms >= 2000) - std::fprintf(stderr, "[rt] d3d12: compute pipeline %s took %.1f s to build (%zu B SPIR-V)\n", - entry->name.c_str(), double(out.ms) / 1000.0, bytes); + // The timer starts before the journal file is read and before the shared cache is asked, so this + // line reports the whole call. Name where the pipeline came from: a compile, the shared cache or + // its own journal file, which is what a compile cost has to be read from. + std::fprintf(stderr, + "[rt] d3d12: compute pipeline %s took %.1f s to obtain from %s (%zu B SPIR-V; hit %d," + " seeded %d, written %d)\n", + entry->name.c_str(), double(out.ms) / 1000.0, + out.journal_hit ? "its journal file" : out.from_shared ? "the shared cache" : "a compile", + bytes, hit_reported, int(journal.seeded), int(out.journaled)); return out; }