perf(shader): skip fault checks dominated by the same check #15795
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15795"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-11-04T16:12:02Z.
What
Skips an invalid-descriptor fault check of a GPU-descriptor buffer access, and the swizzle-selector check of a formatted load, when an identical check on the same descriptor under the same execution guard already sits earlier in the same IR block or in a dominating block. The fault record is first-writer-wins and the invocation stops at the first failing check, so a dominated repeat cannot change the record; only the pc stored for a fault that two invocations race to record can differ. Scalar buffer reads carry no descriptor-flag check on
mainand are untouched.APS5_NO_FAULT_CHECK_DEDUPrestores every check. The row is indocs/dev/ENVIRONMENT.mdand the gap indocs/dev/debt/shader.md.agc_driver_fault_check_dedup(new, 0.4 s) recompiles hand-assembled compute programs that load through a reserved-bit V# with the dedup on and withAPS5_NO_FAULT_CHECK_DEDUPin one process, countsrecord_bda_faultcalls in the SPIR-V (removed: straight line 2, vector load in a uniform if 2, join pair after a skipped if 1, divergent if 1, repeat of the second descriptor 1; kept: other exec mask, empty exec mask, other descriptor), runs both on the GPU and compares the logged fault (address, pc, bytes, stage, reason) and the output for every valid/invalid combination of two descriptors.Tested
Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 4090 (driver 617.42), Vulkan SDK 1.4.363.0. Based on
mainb11c7bf84f. Game captures are below (warm runs of Ghost of Yōtei).build-test(Release, SPIRV-Tools off),ninja -k 0andlibsbuild. Fullctest:main4005 tests, 4 fail; this PR 4006 tests, the same 4 fail:test_registrationandselect_tests_MissingCommandTests(Windows symlink privilege,WinError 1314),agc_driver_direct_write_completion,guest_filesystem(exception 0xc0000409). The new test passes.guest_raise_exceptiontimed out once at 60 s in a loaded full run of this PR and passes alone in 13.0 s on both trees.mainb11c7bf84fand this PR:ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build-test -R '<pattern>' -Voveragc_driver_fault_check_dedup(PR only),agc_driver_buffer_load_store,agc_driver_buffer_descriptor_runtime,agc_driver_bda_span_reads,agc_driver_bda_anchor_reads,agc_driver_descriptor_web_faults,agc_driver_buffer_format,agc_driver_gpu_buffer_format,agc_driver_buffer_atomics,agc_driver_buffer_atomic_unaligned,agc_device_fault,agc_bda_atomics,agc_driver_bda_device,agc_driver_draw_unsupported_buffer_type,agc_driver_gcn_buffer_format_lookup,agc_driver_queued_raw_shader.main: 15 of 15 passed, this PR: 16 of 16 passed. Neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS;VUID-lines: 0 onmain, 0 on this PR. WithVK_LOADER_DEBUG=layerthe loader reportsenv var 'VK_INSTANCE_LAYERS' defined and adding layers "VK_LAYER_KHRONOS_validation"and the new test still printsfault check dedup tests passed. The new test logs the expectedBDA access failed ... reason=8lines in both modes.build-spvtofmainand of this PR, cold NVIDIA GLCache per step moved aside and restored, 1748 files before and after, 3 interleaved passes, env of therun588extra list plus the inline list withAPS5_SPIRV_OPT=largeandAPS5_SPIRV_LARGE_OPT_MIN_WORDS=400000;mainhas nolargemode, so it runs its default pipeline). Requests are 8 captured compute programs of one title scene; the capture was serialized by a fork format, so the trailing fork-only byte (singleWorkgroup, always 0) was dropped for both trees. Module words, blocks and calls are from the captured SPIR-V; every module passesspirv-val --target-env vulkan1.3. Output hashes are the request bench hash over every written buffer (fill=mix seeds 1-3; fill=small and zero for 801cdd2700, which device-loses on mix).record_bda_faultcallsFive of the eight modules are byte-identical (same SHA-256). The GPU medians are single seeds of 5 repeats and noisy (80001e5f00 seed 1 to 3: 14.9, 15.0, 14.9 ms on
mainagainst 7.9, 6.7, 13.6 ms on the PR, with equal hashes); they are not a speed claim.Raw cold pipeline create per pass, module SHA-256 and output hashes
Cold
pipeline_create(s); the order inside a pass alternates (main first, PR first, main first):Modules:
record_bda_faultcalls65dc2268113964498c66f60cf7885c422d8e8dd35e2818357cb5c72de7538d87e86ffefc6805d16905a0189c3b919e81c8bf1938edaa2ac75965fed6c7653dde670c6c7dc6ba8caf61fcafa41ce499291ba1ab7619f2513420aba9fe2bc53b6dd227572589768d4fc6a3201a8d237e530b1b88b85ce12500ca29869664e4a32b915b79bfa9eaebb6c895b1d232fda3ce9cf686647381cf37f9334a10e9fff3f3915b79bfa9eaebb6c895b1d232fda3ce9cf686647381cf37f9334a10e9fff3f3413a151326019cad4b3a841ad9370cb772c6bd705bfbd8a2a4354b4a1529a120f73862999c61a91d066f93596ec03709683743f2050fa639a60d4e5fdfebc055fbea5a2d0e58526ee5b456adad0fcc65ae6b3d2032451b2e2009dad775a41817fbea5a2d0e58526ee5b456adad0fcc65ae6b3d2032451b2e2009dad775a41817c561498e57fe01851590e27f0c43014801a522e51cbdf75cc6121d529d538b2ac561498e57fe01851590e27f0c43014801a522e51cbdf75cc6121d529d538b2a712f131190a441c29b1b6908a894e964658ecce9d3587ec99955ba0aa0402da3712f131190a441c29b1b6908a894e964658ecce9d3587ec99955ba0aa0402da340d9bbee24e7378d2371f1896894ccf81952c89c96c857582fcc026312b2603240d9bbee24e7378d2371f1896894ccf81952c89c96c857582fcc026312b26032Output hashes (
agc_driver_request_bench2_tests, 5 repeats):1a4f1c0df30083031a4f1c0df3008303cdf95945b6c1bc83cdf95945b6c1bc832a569656afe684832a569656afe6848302ac3483d1b3a78302ac3483d1b3a783a106ffbdefc1c383a106ffbdefc1c38338a1bdb9d89fee8338a1bdb9d89fee83ec8cbba982d7c103ec8cbba982d7c1034dadce562eac9f834dadce562eac9f835edd07bc715747035edd07bc71574703b10ac80bfa9754f1b10ac80bfa9754f1c685723f9c65bcb4c685723f9c65bcb4f45f3fec48fd8c6bf45f3fec48fd8c6b63502f78cec82a2e63502f78cec82a2e701b4d0710adc187701b4d0710adc187ef243f9758ac8777ef243f9758ac877716361509255e0b5416361509255e0b54044717d17cbd3128044717d17cbd31285f124543f6dc9ff65f124543f6dc9ff697e30eb7f64933c297e30eb7f64933c2082ee9aa33ec31d6082ee9aa33ec31d6597af73725bf22b3597af73725bf22b3f73e8a364c5a47dbf73e8a364c5a47dbf73e8a364c5a47dbf73e8a364c5a47dbf73e8a364c5a47dbf73e8a364c5a47db4b92acf449b768364b92acf449b76836841bfd2ea647e133841bfd2ea647e13375121ee2f967e4c675121ee2f967e4c6APS5_TRACE_FRAMES=250:30only, order A1mainb11c7bf84f, B1 this PRc1cf922bb1, A2main, one run each. The window is frames 250-280 of a warm run. It does not include the cold compiles this change speeds up, so these captures are a runtime no-regression check; the compile claim rests on the offline bench above.Summary lines (A1, B1, A2)
mainb11c7bf84fc1cf922bb1mainb11c7bf84fpython -I tools/trace_digest.py <trace>, ms per frame (29 frames), the hottest thread (queue worker 0x0) and the other threads that carry the Shader and Graphics phases:mainmainThe hottest thread and the graphics and GPU rows are equal within run spread; the PR's shorter window and lower Shader.Register and Shader.PrepareArtifact come from the two 1.1 s frames that both
mainruns hit around present 275 (3.55 s of inclusive PrepareArtifact in them) and the PR run did not, which a single pair of runs cannot attribute to the change. The three traces are available on request.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code