Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 20, 2024
Merged

Conversation

Keenuts
Copy link
Collaborator

@Keenuts Keenuts commented Sep 18, 2024

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]>
@Keenuts Keenuts requested a review from a team as a code owner September 18, 2024 09:58
@Keenuts Keenuts requested review from s-perron and cassiebeckley and removed request for s-perron September 18, 2024 10:53
Copy link
Collaborator

@s-perron s-perron left a comment

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
Collaborator Author

Keenuts commented Sep 18, 2024

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
Collaborator Author

Keenuts commented Sep 18, 2024

Oh got it

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

Keenuts commented Sep 18, 2024

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 Keenuts merged commit 97af068 into microsoft:main Sep 20, 2024
12 checks passed
@Keenuts Keenuts deleted the fix-6913 branch September 20, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

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