feat(shader): name the values that differ between a program's compute pipelines #28296
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28296"
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 zeezey on 2026-11-29T19:40:46Z.
What
Extends
APS5_TRACE_SPECIALIZATION_VARIANTS(#28102) with a pipeline-level line, as agreed on #28102: when a program gets its second or later compute pipeline for a large module, the driver names the specialization values that differ from the module of the program's previous pipeline. Built on #28102's headcdded18cb0; the naming is #28102'sShaderRecompiler::SpecializationConstantName, so the names and the value format are those of the variant line.RecompileResult::preparedConstantscarries them to the driver. They are no part of the pipeline identity and are not stored in the shader disk cache (EncodeResultis unchanged; thesizeof(RecompileResult)assert moves from 568 to 584).VulkanDevice::createComputePipelineprints, for a module of more than 100000 SPIR-V words (APS5_TRACE_SPECIALIZATION_VARIANTS_WORDSsets another size,0covers all; a value that is not a whole number is reported once and the default is used):[specialization-variant] pipeline <n> of program <address>: <words> SPIR-V words, the previous one <words>; compiled variant <id>, as before | <old id> -> <new id>; differs from the previous pipeline's module in <count> of <values> values: <name> <old>-><new> ...At most 48 values per line, 8 lines per program and 1500 per run; the pipelines the device builds to probe its float controls print none.
fix(shader): keep every pipeline in the pipeline variant trace history, from the review here). A result read from the shader disk cache kept no values, so it neither prints nor counts.SpecializationConstantNameis added toshaderCacheReviewedNames, since the driver header calls it.agc_pipeline_variant_tracecovers the size parsing, the value count and the caps, and that a pipeline at or under the size still counts as its program's previous pipeline and uses no cap;agc_driver_pipeline_variant_trace_linedispatches one program with other V# values and checks the printed lines, and runs again untraced and at the default size.Tested
Windows 11 Pro 10.0.26300, WinLibs MinGW-w64 GCC 15.2.0, Ninja, Release,
-DBUILD_TESTING=ON -DANYPS5_RELINKER_CLI=ON -DANYPS5_VIDEO_OUT_TEST_DRIVER=windows, NVIDIA GeForce RTX 4090 (driver 621.24), Vulkan SDK 1.4.363, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layerin every run below except thebuild.ymljobs.d6f40c49be, which adds the review fix, from a build directory Defender skips:ctest(-j 8): 7430 tests, 7389 passed, 36 skipped (#28102's head: 7426, 7381, 36). No line reports the layer missing; the same 89Validation Warninglines as on #28102's head, noVUID-orValidation Errorline. Not passing on both:agc_driver_linear_target_import_creation,guest_pthread_mutex_contention,guest_webrtc_thread; six others only on #28102's head. Not passing only on this PR:agc_driver_rect_list_vertex_layer(an access violation on a thread in the NVIDIA driver) andguest_video_out_high_frame_rate(an abort); both then passed 5 of 5 times on each, one at a time, alternating with #28102's head.specializ|variant|identity|trace|shader_disk_cache|spirv_module(244): all pass, noVUID-orValidationline;VUID-orValidationline, the longest run 2.0 s. With the old size check put back intoPipelineVariantTrace::Next,agc_pipeline_variant_tracefails;VUID-orValidationline;APS5_TRACE_SPECIALIZATION_VARIANTSset, which none of the gate's tests sets) and the relinker jobs (the relinker-only build compiles none of the changed files).2e967ba7b2.ctest(no-R,-j 8; on #28102's head theagc_tests ran with-j 1and-j 4) on #28102's head and on this PR: 7426 and 7429 tests, 7381 and 7376 passed, 36 skipped on both. This PR adds four tests;run_report_schemawas missing from its run because CMake had found another Python withoutjsonschema; with the same Python as #28102's head it passes (below). No line reports the layer missing. Both logs have the same 89Validation Warninglines (Undefined-Value-ShaderOutputNotConsumed-DynamicRendering84,Undefined-Value-OutputNotWritten-DynamicRendering3,Undefined-Value-ShaderOutputNotConsumed1,VALIDATION-SETTINGS1) and noVUID-orValidation Errorline.agc_driver_linear_target_import_creation,guest_pthread_mutex_contention,guest_timed_wait_cpu.frame_capture_minimize,guest_audio_in_open_within,guest_select_wait,guest_webrtc_thread,jpeg_external_toolchain,rebase_verify_shard_2.embedded_data_syscalls,guest_own_tls_relocations,ignored_string_segments,public_headers_compile_2,restricted_undefined_symbols_executable_1,restricted_undefined_symbols_executable_6,restricted_undefined_symbols_guest_1,restricted_undefined_symbols_guest_6,restricted_undefined_symbols_guest_7,test_executable_manifests,tls_function_coverage_register_address_loadsandtls_initial_image(timeouts),guest_unused_import_dependencies(the relinker's output file could not be opened) andwindows_import_modules(Windows refused to start a generated program as potentially unwanted software). This PR's build directory was outside the folders Microsoft Defender skips on this PC, and Defender quarantined programs the relinker tests wrote there (Trojan:Win32/Sabsik.FL.A!ml, its machine-learning heuristic). Built again in a folder Defender skips, as #28102's head is, those 14 andrun_report_schemaran 5 times one at a time, alternating with #28102's head: every run passed on both.specializ|variant|identity|trace|shader_disk_cache|spirv_module(244) withctest -j 8: 243 passed, noVUID-orValidationline;agc_driver_wait_attribution_trace_plan_verifyfailed once ("queue 0 neither drained for a queued item nor queued its dispatch submission behind it"). Run one at a time, alternating with #28102's head, the threeagc_driver_wait_attribution_tracetests failed in 4 of 70 runs on #28102's head, all with the message above, and in 9 of 70 on this PR, from the first build directory, the one Defender scanned. On this PR the message was either that one or "a queue 0 wait that a title CPU store satisfied was not reported as Driver.MemoryWait.blocked.memory". From the build in a folder Defender skips, 20 more alternating rounds: 60 of 60 passed on this PR, 59 of 60 on #28102's head, whose one failure was that second message.VUID-orValidationline, the longest run 3.2 s.tools/vulkan_validation_gate.py, #28102's head against this PR,--repeat 20 --test-timeout 30 --gpu NVIDIA, with the five tests both have that create a Vulkan instance (agc_driver_buffer_unaligned_base,agc_driver_compute_nested_table_call,agc_driver_image_table_variants,agc_driver_null_buffer_specialization,agc_driver_registration_trace): exit 0, no problems and no new diagnostics. All 200 test runs passed with the layer inserted, the longest in 5.2 s. The four new tests are not on #28102's head, so the gate cannot take them; they are in the 20 runs above.specializ|variant|identity|trace|shader_disk_cache|spirv_module: 237 of 237 pass, noVUID-orValidationline; the new tests each take under a second.build.ymljobs a pull request runs, here (the macOS rows of the relinker job not run):ctest --timeout 120 --parallel 4, on Windows also--repeat after-timeout:2): 1172 of 1172 pass on Windows, 1148 of 1148 on Linux;tls_function_coverage) on Linux: 34 of 34 pass;check_test_registrationpasses,build_mingw_host_only_testslinks its two targets, andbuild_changed_guest_testsran 6210 tests. All pass butagc_driver_linear_target_import_creation, which does not pass on #28102's head either,public_headers_compile_34(timeout) andwindows_write_watch("cannot restore full resident run protection"). Those two then passed 5 of 5 times on each, alternating with #28102's head, from the build in a folder Defender skips.python3 -I tools/check_conventions.py --base cdded18cb0with this title and body: all checks passed;python3 tools/debt_fold.py --checkpasses.Checklist
cdded18cb0, not on currentmain(see Depends on); 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
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T19:51:47Z.
Review: COMMENTED
Actionable comments posted: 1
2068774b-1150-450c-bba0-ce33c409d60aReviewing files that changed from the base of the PR and between
1f27e2abfaand2e967ba7b2.core/libs/prx/libSceAgcDriver/Execution/include/PipelineVariantTrace.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/PipelineVariantTrace.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/SpirvModule.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_pipeline_variant_trace_line_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_runtime_formatted_store_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_pipeline_variant_trace_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/BufferDescriptorRuntime.cppcore/libs/prx/libSceAgcDriver/tests/execution/NullBufferSpecialization.cppcore/libs/prx/libSceAgcDriver/tests/execution/PipelineVariantTraceLine.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/CompiledVariant.hppcore/shader/recompiler/Optimization/include/Optimization/DescriptorBindingBuilder.hppcore/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvSpecialization.hppcore/shader/recompiler/SpirvBackend/src/SpirvInstructionOperands.hppcore/shader/recompiler/SpirvBackend/src/SpirvSpannedUniformity.cppcore/shader/recompiler/SpirvBackend/src/SpirvSpecialization.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/changes/shader-pipeline-variant-identity.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T20:09:03Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
2e967ba7b299b9eca304118888f2500633077e02using the prepared diff and targeted reads throughrepo_read.py. No tests or build commands were run. The author-reported checks are summarized in the PR description and were not run by me.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppwas excluded from the review folder; I read only the relevant range throughrepo_read.py. I did not read every changed file, so this is not a complete file-by-file review. Build, tests, and title behavior were not independently verified. The PR description reports these checks and results: Windows and Linux focused suites, selected complete test runs, Vulkan validation, and convention/debt checks.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T22:04:06Z.
Review: COMMENTED
Reviewed — comments
A formal decision is not justified because I inspected only selected changed files and did not run checks.
What I ran
Reviewed head
d6f40c49be95086114306e415d97160c71b7793busing the prepared diff and the pinned repository reader. No executable checks were run.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Not verified
I read
PipelineVariantTrace.hpp, selected ranges fromVulkanDevice.cpp,Recompiler.cpp,SpirvInstructionOperands.hpp,SpirvSpecialization.cpp, andDescriptorBindingBuilder.cpp, plus portions ofdescription.md,commits.md,manifest.json, anddiff.patch. I did not read every changed file or every changed hunk. The changed-file list also includes tests, CMake test registrations, shader recompiler files, and documentation that I did not fully inspect.files.jsonwas not available through the reader; the file listing showed the changed paths and inclusion status. No tests or builds were run.To get this to a good state
Nothing is required. Optional: complete the review of the remaining changed files and run relevant checks before making a formal decision.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T16:42:29Z.
Review: COMMENTED
The branch's pipeline-variant trace fixture passed on Linux with the exact trace header and constant-name implementation. It covers the threshold and verifies that smaller modules stay in the comparison history without consuming the output caps.
The Vulkan call site still updates the previous module and can spend the log budget before
CreateComputePipelinesucceeds. A failed Vulkan creation therefore becomes the comparison point for the next successful build. Can the trace commit its history after successful creation, where the pipeline-created counters already update?The integrated Linux
agc_pipeline_variant_traceCTest also passed atd6f40c49be.agc_driver_gcn_scalar_buffer_basepassed on bothb21303b0bdand the change with lavapipe. Both paired logs showed Khronos validation 1.4.369 inserted and contained no missing-layer warnings orVUID-errors.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T21:19:15Z.
Review: COMMENTED
Actionable comments
920aa84b-089f-4453-9fe3-b006d7e233deReviewing files that changed from the base of the PR and between
d6f40c49beand95f176146d.core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppdocs/dev/ENVIRONMENT.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T22:30:10Z.
Review: COMMENTED
Reviewed — comments
Nothing blocks this; the points below are optional.
What I ran
Reviewed prepared PR materials and targeted source context at head
95f176146d232ed6b19c36771d75db956f0a9efc. I did not run tests or builds. The author-reported test results in the description were not run by me.Commands used for source inspection:
Results
Findings
Blocking
None identified in the portions inspected.
Non-blocking
None.
Not verified
This is an incomplete review, so it does not support approval.
files.jsonlists 24 changed files as reviewed, with none excluded by rule. I inspected the full text ofPipelineVariantTrace.hppandSpirvInstructionOperands.hpp, plus targeted changed areas inVulkanDevice.cpp,DescriptorBindingBuilder.cppandSpirvSpecialization.cpp. I also inspected prepared diff sections, but did not fully review the remaining changed code:PipelineVariantTrace.cpp,ShaderDiskCache.cpp,SpirvModule.cpp, the changed CMake and execution test files,CMakeLists.txt,CompiledVariant.hpp,DescriptorBindingBuilder.hpp,Recompiler.cpp,Recompiler.hpp,ShaderDiskCache.cpp,SpirvSpecialization.hpp,SpirvSpannedUniformity.cpp, and the changed documentation. No runtime, hardware, or test behavior was independently confirmed.To get this to a good state
Nothing is required. The remaining changed files and runtime behavior are optional follow-up review points before treating this as a complete review.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.