diff --git a/docs/pipeline_check.md b/docs/pipeline_check.md index 4d5be5e352..27d3c91a53 100644 --- a/docs/pipeline_check.md +++ b/docs/pipeline_check.md @@ -41,6 +41,7 @@ Build with `make_game.py --stages shaders --compact-spirv` to run SPIRV-Tools lo | `--large-module-bytes N` | Compile modules larger than N bytes alone (default 4 MiB; 0 disables isolation). | | `--stats FILE` | Write the driver's per-shader statistics as CSV rows `name,stage,statistic,value`. Needs `VK_KHR_pipeline_executable_properties`; use it without `cache.bin`, because a cached pipeline may come without statistics. | | `--cache-feedback` | Group successful pipeline creations by `VkPipelineCreationFeedback`: cache hits, no hit reported, and unavailable. | +| `--no-pipeline-cache` | Pass `VK_NULL_HANDLE` to pipeline creation and do not create, read, or save an application `VkPipelineCache`. Cannot be combined with `cache.bin`; the driver's internal or on-disk caches are unaffected. | | `--isolate` | POSIX only: check in child processes, `--isolate-batch N` modules at a time (default 256), so a crashing module is recorded as `MODULE CRASH` and the pass continues. Not compatible with `--stats`. | | `--inflight-file F` | Keep the modules currently in the driver in F as `namephase` lines. It is rewritten by the watchdog and when a large module enters or leaves, and emptied at the end; `make_game.py`'s pipelines stage reads it. | | `--skip-file F` | Do not compile modules named one per line in F; each is reported as `MODULE CRASH` and counted as a failed pipeline. `make_game.py` writes F after a crash so the next run checks the rest. | diff --git a/runtime/test/vk_pipeline_check.cpp b/runtime/test/vk_pipeline_check.cpp index 3ff89524fc..70c1a60da3 100644 --- a/runtime/test/vk_pipeline_check.cpp +++ b/runtime/test/vk_pipeline_check.cpp @@ -30,6 +30,7 @@ // --cache-feedback count each stage's successful pipelines by VkPipelineCreationFeedback: hits (VALID and // APPLICATION_PIPELINE_CACHE_HIT), no hit reported (VALID only) and unavailable (no VALID bit, or a // pre-1.3 device without VK_EXT_pipeline_creation_feedback). The three add up to the ok count. +// --no-pipeline-cache pass VK_NULL_HANDLE to pipeline creation for an application-cache A/B run; cannot use cache.bin // --nv-diagnostics create the device with VK_NV_device_diagnostics_config and the flags the runtime's // LEONIDA_DEVICE_FAULT=1 / LEONIDA_AFTERMATH=1 use (shader debug info, resource tracking, automatic // checkpoints), to measure what that does to compile times and to cache hits @@ -796,7 +797,7 @@ int main(int argc, char** argv) { std::fprintf(stderr, "usage: vk_pipeline_check [cache.bin] [--jobs N] [--start I] [--count N] [--slow SEC] " "[--max-bytes N] [--large-module-bytes N] [--large-parallel N] [--stage all|cs|graphics | --compute-only | --graphics-only] " - "[--stats FILE] [--cache-feedback] [--isolate [--isolate-batch N]] [--inflight-file F] " + "[--stats FILE] [--cache-feedback] [--no-pipeline-cache] [--isolate [--isolate-batch N]] [--inflight-file F] " "[--skip-file F]\n"); return 2; } @@ -809,7 +810,7 @@ int main(int argc, char** argv) { unsigned large_parallel = 0; // 0 = by the memory budget double slow = 30.0; std::string stage_filter = "all"; - bool cache_feedback = false, isolate = false, iso_child = false, nv_diagnostics = false; + bool cache_feedback = false, no_pipeline_cache = false, isolate = false, iso_child = false, nv_diagnostics = false; size_t isolate_batch = 256; for (int i = 2; i < argc; i++) { std::string a = argv[i]; @@ -853,6 +854,7 @@ int main(int argc, char** argv) { else if (a == "--inflight-file") valid = !(inflight_path = value()).empty(); else if (a == "--skip-file") valid = !(skip_path = value()).empty(); else if (a == "--cache-feedback") cache_feedback = true; + else if (a == "--no-pipeline-cache") no_pipeline_cache = true; else if (a == "--isolate") isolate = true; else if (a == "--nv-diagnostics") nv_diagnostics = true; else if (a == "--isolate-child") iso_child = true; // internal: the parent's child runs @@ -881,6 +883,11 @@ int main(int argc, char** argv) { return 2; } + if (no_pipeline_cache && cache_given) { + std::fprintf(stderr, "--no-pipeline-cache cannot be combined with cache.bin\n"); + return 2; + } + if (isolate && !stats_path.empty()) { std::fprintf(stderr, "--isolate cannot be combined with --stats\n"); return 2; @@ -956,6 +963,7 @@ int main(int argc, char** argv) { "--large-module-bytes", std::to_string(large_module_bytes), "--large-parallel", std::to_string(large_parallel)}; if (cache_feedback) pass.push_back("--cache-feedback"); + if (no_pipeline_cache) pass.push_back("--no-pipeline-cache"); if (!inflight_path.empty()) pass.insert(pass.end(), {"--inflight-file", inflight_path}); if (!skip_path.empty()) pass.insert(pass.end(), {"--skip-file", skip_path}); struct Agg { uint32_t mod_ok = 0, mod_bad = 0, pipe_ok = 0, pipe_bad = 0, pipe_skip = 0, big = 0, crashed = 0, fb[3] = {}; }; @@ -1434,19 +1442,23 @@ int main(int argc, char** argv) { } VkPipelineCacheCreateInfo pci{VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO}; std::vector seed; - if (!cache_path.empty()) { // resume: pipelines already in the cache compile instantly + if (!no_pipeline_cache && !cache_path.empty()) { // resume: pipelines already in the cache compile instantly std::ifstream cf(cache_path, std::ios::binary); seed.assign(std::istreambuf_iterator(cf), {}); if (!seed.empty()) std::fprintf(stderr, "seeded the pipeline cache with %zu bytes from %s\n", seed.size(), cache_path.c_str()); } pci.initialDataSize = seed.size(); pci.pInitialData = seed.empty() ? nullptr : seed.data(); VkPipelineCache cache = VK_NULL_HANDLE; - if (vkCreatePipelineCache(dev, &pci, nullptr, &cache)) { // data from another driver: start empty - pci.initialDataSize = 0; pci.pInitialData = nullptr; - if (VkResult r = vkCreatePipelineCache(dev, &pci, nullptr, &cache)) { - std::fprintf(stderr, "vkCreatePipelineCache failed: %d\n", r); - return 1; + if (!no_pipeline_cache) { + if (vkCreatePipelineCache(dev, &pci, nullptr, &cache)) { // data from another driver: start empty + pci.initialDataSize = 0; pci.pInitialData = nullptr; + if (VkResult r = vkCreatePipelineCache(dev, &pci, nullptr, &cache)) { + std::fprintf(stderr, "vkCreatePipelineCache failed: %d\n", r); + return 1; + } } + } else { + std::fprintf(stderr, "application pipeline cache: disabled (driver-internal caches may still be active)\n"); } std::vector().swap(seed); // the driver has copied the seed; it can be several GiB auto save_cache = [&](bool final_save) {