Skip to content

[SPIR-V] Add -fvk-bind-*-heap flag to DXC - #6919

Merged
Nathan Gauër (Keenuts) merged 2 commits into
microsoft:mainfrom
Keenuts:fix-6913
Sep 20, 2024
Merged

Nathan Gauër (Keenuts) merged 2 commits into
microsoft:mainfrom
Keenuts:fix-6913

Conversation

@Keenuts

Copy link
Copy Markdown
Collaborator

Those flags allow the user to hardcode the binding ID for the heaps. This allow the user to either force heap aliasing, or simply have more control over the heaps.

Fixes #6913

Those flags allow the user to hardcode the binding ID for the heaps.
This allow the user to either force heap aliasing, or simply have more
control over the heaps.

Fixes microsoft#6913

Signed-off-by: Nathan Gauër <[email protected]>

@s-perron Steven Perron (s-perron) left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only part that seems missing that other resources that are automatically assigned resources bindings should not use the fixed binding for the descriptor heaps:

// RUN: %dxc -T cs_6_6 -E main -fcgl %s -spirv -fvk-bind-resource-heap 0 0 -fvk-bind-counter-heap 1 0 | FileCheck %s

// CHECK-DAG: OpDecorate %a DescriptorSet 0
// CHECK-DAG: OpDecorate %a Binding 2
// CHECK-DAG: OpDecorate %counter_var_a DescriptorSet 0
// CHECK-DAG: OpDecorate %counter_var_a Binding 3
RWStructuredBuffer<uint> a; 

[numthreads(1, 1, 1)]
void main() {  
// CHECK-DAG: OpDecorate %ResourceDescriptorHeap DescriptorSet 0
// CHECK-DAG: OpDecorate %ResourceDescriptorHeap Binding 0
// CHECK-DAG: OpDecorate %counter_var_ResourceDescriptorHeap DescriptorSet 0
// CHECK-DAG: OpDecorate %counter_var_ResourceDescriptorHeap Binding 1
  RWStructuredBuffer<uint> b = ResourceDescriptorHeap[1];
  
  a.IncrementCounter();
  b.IncrementCounter();
}

@Keenuts

Copy link
Copy Markdown
Collaborator Author

resources

You mean a test checking only resources related to the flag are fixed, and the others are still keeping the automatic behavior?

@Keenuts

Copy link
Copy Markdown
Collaborator Author

Oh got it

Signed-off-by: Nathan Gauër <[email protected]>
@Keenuts

Copy link
Copy Markdown
Collaborator Author

thanks for the finding! pre-reserved the IDs.
If you use the flags, but not the heaps, then the IDs are still reserved. This allow for a much simpler solution (otherwise I'd need to go over resources once to pre-reserve, and then to the normal allocation)

@Keenuts
Nathan Gauër (Keenuts) merged commit 97af068 into microsoft:main Sep 20, 2024
Mxr (SjMxr233) pushed a commit to ShaderHelper/DirectXShaderCompiler that referenced this pull request Jul 24, 2025
Those flags allow the user to hardcode the binding ID for the heaps.
This allow the user to either force heap aliasing, or simply have more
control over the heaps.

Fixes microsoft#6913

---------

Signed-off-by: Nathan Gauër <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Feature Request] [SPIR-V] -fvk-bind-resource-heap

3 participants