-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
[HLSL] Add an attribute to differentiate resource attributes for Buffer vs StructuredBuffer and RawBuffer #107907
Comments
This PR introduces new HLSL resource type attribute [[hlsl::row_access]]. Presence of this attribute means that the resource must be accessed in 16-byte blocks at-a-time, or four 32-bit components, also knows as rows. This information is necessary in order to properly distinguish between a typed buffer like `RWBuffer<float4>` which is translated to `dx.TypedBuffer` vs. `RWStructuredBuffer<float4>` which does not have this access constraint and will be translated to `dx.RawBuffer`. Fixes llvm#107907
This PR introduces new HLSL resource type attribute `[[hlsl::raw_buffer]]`. Presence of this attribute on a resource handle means that the resource does not require typed element access. The attribute will be used on resource handles that represent buffers like `StructuredBuffer` or `ByteAddressBuffer` and in DXIL it will be translated to target extension type `dx.RawBuffer`. Fixes #107907
@llvm/issue-subscribers-clang-frontend Author: Justin Bogner (bogner)
The target extension types for buffers are split into [dx.TypedBuffer and dx.RawBuffer]( https://llvm.org/docs/DirectX/DXILResources.html#buffers) in order to separate the types of operation that are possible on the two. Specifically, Typed buffers must be accessed one typed element at a time, whereas Raw and Structured buffers don't have this restriction.
We need to represent this difference in the HLSL AST in order to correctly generate the target types. To do so, we should introduce a type attribute AC:
|
This PR introduces new HLSL resource type attribute `[[hlsl::raw_buffer]]`. Presence of this attribute on a resource handle means that the resource does not require typed element access. The attribute will be used on resource handles that represent buffers like `StructuredBuffer` or `ByteAddressBuffer` and in DXIL it will be translated to target extension type `dx.RawBuffer`. Fixes llvm#107907
The target extension types for buffers are split into dx.TypedBuffer and dx.RawBuffer in order to separate the types of operation that are possible on the two. Specifically, Typed buffers must be accessed one typed element at a time, whereas Raw and Structured buffers don't have this restriction.
We need to represent this difference in the HLSL AST in order to correctly generate the target types. To do so, we should introduce a type attribute
[[raw_buffer]]
that will be used on buffer types such as StructuredBuffer or ByteAddressBuffer that do not require typed element access.Note: This is related to llvm/wg-hlsl#68 and llvm/wg-hlsl#42. We should add this attribute to the table in that document.
AC:
__hlsl_resource_t
The text was updated successfully, but these errors were encountered: