Skip to content
Open
Show file tree
Hide file tree
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
20 changes: 18 additions & 2 deletions docs/d3d12_vulkan.md
Original file line number Diff line number Diff line change
Expand Up @@ -2719,7 +2719,11 @@ Pipeline creation:
a device loss or a kill never reaches teardown, so neither file used to keep that boot's compute pipelines.
Compute pipelines are therefore journaled one file each (`src/pipeline_cache_journal.h`):
`pipeline_cache.d/cs-<hash>.bin` beside the session file, named by a hash of the SPIR-V words, the stage flags and
subgroup request, the push-constant range and the bindless layout. A build creates a `VkPipelineCache` from its
subgroup request, the push-constant range and the bindless layout. Each file is a 24-byte stamp (`LPJ1`, then a
hash of the gta6rt executable that wrote it and a hash of the device-create config it was written under:
extensions, feature bits, the NVIDIA diagnostics config and its flags, `src/vulkan_device_config.h`) followed by
the cache blob; files an older runtime wrote have no stamp
and are read as before. A build creates a `VkPipelineCache` from its
file (if the header names this device and pipeline-cache UUID) and creates the pipeline against it; when the
driver reports a compile (creation feedback without `APPLICATION_PIPELINE_CACHE_HIT`, or no file), that cache is
written back to the file at once, through a staging file renamed over it. Without a file, and with
Expand Down Expand Up @@ -2754,7 +2758,19 @@ Pipeline creation:
LEONIDA_SHADERS, LEONIDA_PIPELINE_CACHE_DIR, and LEONIDA_DEVICE_FAULT/LEONIDA_AFTERMATH, whose diagnostics config
makes other pipelines) and builds every compute entry of the library through the dispatch path
(`build_compute_pipeline`), largest first, on below-normal-priority threads. Entries with a usable journal file are
skipped (only their header is read), so it can be stopped and started again. Running as gta6rt.exe it also fills
skipped (only their stamp and header are read), so it can be stopped and started again. Only files this gta6rt
binary wrote under this device-create config count as done: on NVIDIA 621.40 a rebuilt runtime was measured getting few hits from another build's
files (#1608), so a file from another build, or one without a stamp, is built against again. A hit takes
milliseconds and the file is then stamped as this build's; a miss is compiled and the file rewritten. The run's last
lines say how many files came from another build and how many of them the driver still took, and the runtime's
journal lines count them too (`from another build: N, M of them found`). Files this build wrote under another
device-create config are handled the same way and counted apart (`from another device config`). NVIDIA's
diagnostics config (`LEONIDA_DEVICE_FAULT=1`, `LEONIDA_AFTERMATH=1`) also names its pipelines apart; on NVIDIA
621.01 a journal precompiled without it gave a boot with it 0 of 10 pipelines from the journal (10 compiled), and
10 of 10 when both matched. So a pipeline with no file that has one under the other setting is reported, by the
precompiler and once at boot (`only under the other diagnostics config setting: N`): run the precompiler with the
boot's `LEONIDA_DEVICE_FAULT` / `LEONIDA_AFTERMATH`. `LEONIDA_PIPELINE_JOURNAL_BUILD=<hex>` stands in for the
executable's hash (tests). Running as gta6rt.exe it also fills
NVIDIA's disk cache, which that driver keys by the executable's name. Measured on an RTX 4070 Ti (driver 630.20),
4 threads: modules of 3.6-5.8 MB took 46-145 s each, 12 in 312 s, about 3.5 GB of host memory each while in the
driver (14.5 GB peak for four). Graphics pipelines are not covered: they are built at a title's draw from its PSO
Expand Down
6 changes: 5 additions & 1 deletion docs/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ reasons behind each step: [linux_proton.md](linux_proton.md#amd-on-linux-what-go
`LEONIDA_SHADERS`, `LEONIDA_PIPELINE_CACHE_DIR` and `LEONIDA_DEVICE_FAULT`, before the first run. It built 3,693
compute pipelines. Not `make_game.py --stages pipelines`: its cache never matches the runtime's driver keys.
The pre-compile builds the programs `LEONIDA_SKIP_COMPUTE` names too (`--skip-listed` leaves them out) and ends
with one line that counts what it built, what was journaled already and what it left out.
with one line that counts what it built, what was journaled already and what it left out. After a rebuild of
gta6rt, run it again: files another build wrote are not counted as journaled already, and it says how many of them
the driver still took. Run it with the same `LEONIDA_DEVICE_FAULT` and `LEONIDA_AFTERMATH` as the boot: NVIDIA's
diagnostics config (`LEONIDA_DEVICE_FAULT=1`) compiles other pipelines, and a journal made without it gives such a
boot no hits.
- **Driver and OS:** `amdgpu.lockup_timeout=30000,60000,10000,10000` on the kernel command line (the default is
2000 ms; reboot needed).
- **Environment:**
Expand Down
4 changes: 4 additions & 0 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,10 @@ if(TARGET Vulkan::Headers)
add_executable(vulkan_device_fault_test test/vulkan_device_fault_test.cpp)
target_link_libraries(vulkan_device_fault_test PRIVATE Vulkan::Headers)
add_test(NAME vulkan_device_fault COMMAND vulkan_device_fault_test)
# The device-create config the pipeline journal stamps its files with (src/vulkan_device_config.h), on the CPU.
add_executable(vulkan_device_config_test test/vulkan_device_config_test.cpp)
target_link_libraries(vulkan_device_config_test PRIVATE Vulkan::Headers)
add_test(NAME vulkan_device_config COMMAND vulkan_device_config_test)
# The AMD breadcrumbs (LEONIDA_DEVICE_MARKERS): seq numbering, marker writes and the likely-hang verdict, on the CPU.
add_executable(vulkan_device_markers_test test/vulkan_device_markers_test.cpp)
target_link_libraries(vulkan_device_markers_test PRIVATE Vulkan::Headers)
Expand Down
3 changes: 3 additions & 0 deletions runtime/shims/d3d12_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ struct VulkanDeviceInfo {
bool device_checkpoints = false;
bool device_diagnostics_config = false;
bool device_markers = false; // VK_AMD_buffer_marker enabled for LEONIDA_DEVICE_MARKERS=1
// leonida::device_create_config of the VkDeviceCreateInfo (src/vulkan_device_config.h): the pipeline journal's
// stamp. 0 for a caller-owned device.
std::uint64_t device_create_config = 0;
bool separate_depth_stencil_layouts = true;
bool depth_range_unrestricted = false; // VK_EXT_depth_range_unrestricted enabled on this device.
std::uint32_t max_push_constants_size = 0;
Expand Down
Loading
Loading