Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions runtime/shims/d3d12_vulkan_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<std::uint32_t>().swap(words);
profile.finish(int(created));
Expand All @@ -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;
}

Expand Down
Loading