You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[SPIR-V] Add descriptor heap RaytracingAccelerationStructure support - #8518
Building off of #8517, this PR extends the SPV_EXT_descriptor_heap native heap lowering to cover RaytracingAccelerationStructure resources loaded from ResourceDescriptorHeap. It is part 2/4 in a series.
Acceleration structure descriptors are accessed via OpUntypedAccessChainKHR into a runtime array of OpTypeAccelerationStructureKHR, consistent with the image and sampler paths added in the previous commit.
Only casts are stripped here, so a syntactically valid parenthesized heap base such as (ResourceDescriptorHeap)[i] is diagnosed as unsupported even though it still refers directly to the builtin variable. Use IgnoreParenCasts() consistently when resolving the base declaration.
const auto *declRefExpr = dyn_cast<DeclRefExpr>(baseExpr->IgnoreCasts());
const auto *decl =
declRefExpr ? dyn_cast<VarDecl>(declRefExpr->getDecl()) : nullptr;
if (!decl) {
emitError("unsupported ResourceDescriptorHeap/SamplerDescriptorHeap "
"expression",
baseExpr->getExprLoc());
return nullptr;
This looks like a user-visible bug fix/feature change. Please add (or point to) the corresponding entry in docs/ReleaseNotes.md.
If release-note coverage is planned in a related PR (including one that hasn’t been submitted yet), please mention that plan/link so we can avoid duplicate notes.
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 52 out of 52 changed files in this pull request and generated 1 comment.
Suppressed comments (3)
tools/clang/lib/SPIRV/SpirvEmitter.cpp:5315
A heap-to-heap reassignment of RaytracingAccelerationStructure also reaches this branch because mixingDetected includes (isASType && wasHeap) regardless of srcIsHeap. That assignment does not mix bound and heap resources, so this diagnostic is misleading; report the unsupported AS reassignment separately.
emitError("mixing bound and descriptor heap resources in the same variable "
"is not supported with SPV_EXT_descriptor_heap",
loc);
Use the possessive “its” rather than “it's” (“it is”).
// The sampler array just uses the sampler size as it's stride.
docs/SPIR-V.rst:2089
This is a significant user-visible compiler feature, but docs/ReleaseNotes.md has no native descriptor-heap entry. Please add release-note coverage, or point to the shared release note planned for this four-PR series.
When ``-fspv-use-descriptor-heap`` is specified, DXC lowers
``ResourceDescriptorHeap`` and ``SamplerDescriptorHeap`` through
``SPV_EXT_descriptor_heap`` instead of the default emulated heap path. This
also requires ``SPV_KHR_untyped_pointers`` and ``-fspv-target-env=vulkan1.3``
Passing a heap-initialized acceleration structure to an out or inout parameter bypasses the reassignment diagnostic. processCall creates a temporary but does not copy resource parameters back, so later uses of the alias still read the original heap handle after the helper assigns a different resource. Reject writable arguments that refer to these aliases until their updated values can be represented correctly.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Heap stride varies by shader stage and extension settings, potentially causing shaders sharing a heap to read different descriptors for the same index.
Heap stride varies by shader stage and extension settings, potentially causing shaders sharing a heap to read different descriptors for the same index.
Azure Pipelines:
Successfully started running 1 pipeline(s).
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
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.
Building off of #8517, this PR extends the SPV_EXT_descriptor_heap native heap lowering to cover RaytracingAccelerationStructure resources loaded from ResourceDescriptorHeap. It is part 2/4 in a series.
Acceleration structure descriptors are accessed via OpUntypedAccessChainKHR into a runtime array of OpTypeAccelerationStructureKHR, consistent with the image and sampler paths added in the previous commit.
Assisted by an AI agent
Diego Novillo (@dnovillo)