Repository navigation
perf(shader): memoize SPIR-V emission failures - #1023
Merged
adriadam10 merged 1 commit intoOct 7, 2026
Merged
Conversation
The source entry remembers a resource plan that failed to build, but not a failed emission: findOrCompileVariant kept only successful variants, and the first attempt used up the prepared program, so every request for a program whose emission throws ran PrepareResourceProgram and the emitter again before the draw was skipped. compileVariant now reports an exception from SpirvEmitter::Emit (and from SPIRV-Tools validation when enabled), and the source entry keeps it per code address, binding layout and resource specialization; the next request for that variant rethrows it before the disk-cache lookup. Descriptor population depends on the snapshot and an out-of-memory error is transient, so neither is kept. Nothing reaches the disk cache, and APS5_NO_FAILURE_MEMO=1 turns the memo off as for plan failures.
Collaborator
|
Checked on RADV (build + full ctest on current main, 395/395; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A variant whose SPIR-V emission throws is never remembered:
findOrCompileVariantkeeps only successful variants and the first attempt uses up the prepared program, so every later request rerunsPrepareResourceProgramand the emitter to hit the same error. Plan failures already have a memo; this adds one for emission.compileVariantreports an exception fromSpirvEmitter::Emit(or SPIRV-Tools validation), and the source entry keeps it per code address, binding layout and resource specialization. A repeat rethrows it before the disk-cache lookup.APS5_NO_FAILURE_MEMO=1turns it off as for plan failures.bdaAbiVersionline after the emission and merge cleanly; perf(agc): baseline shader recompilation on registration #639 (draft) rewrites both functions and already needs a rebase.Tested
mainee391a5: configure-DBUILD_TESTING=ON, full build,--target libs,ctest:ctest --output-on-failure)VK_DRIVER_FILES): 367/367 pass;agc_driver_flat_storeis left out there because it takes several minutes on Windows llvmpipeverifyEmissionFailureMemoinagc_shader_disk_cache(CPU only): a pixel shader's clock read without VK_KHR_shader_clock emits once per layout, stride and address (on four threads too), twice withAPS5_NO_FAILURE_MEMO=1. Fails onmain.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)