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

[HLSL] Split [[hlsl::resource_class]] out of the HLSLResource attribute #98193

Closed
Tracked by #98192
bogner opened this issue Jul 9, 2024 · 2 comments · Fixed by #98419
Closed
Tracked by #98192

[HLSL] Split [[hlsl::resource_class]] out of the HLSLResource attribute #98193

bogner opened this issue Jul 9, 2024 · 2 comments · Fixed by #98419
Assignees
Labels
clang:codegen clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support

Comments

@bogner
Copy link
Contributor

bogner commented Jul 9, 2024

Create a new hlsl::resource_class attribute to replace the resource class argument of the HLSLResource unspellable attribute. The attribute should be spellable so that we can use it to simplify testing.

AC:

  • Decide what the spelling should be
  • The attribute [[hlsl::resource_class(...)]] can be applied to types in HLSL source
  • The attribute is parametrized with uav, srv, cbuffer, or sampler
  • HLSLResource no longer has a ResourceClass argument, and existing code that used that now uses the new attribute
@bogner bogner added metabug HLSL HLSL Language Support labels Jul 9, 2024
@bogner bogner changed the title [HLSL] Split [[clang::hlsl_resource_class]] out of the HLSLResource attribute [HLSL] Split [[hlsl::resource_class]] out of the HLSLResource attribute Jul 10, 2024
@bob80905 bob80905 self-assigned this Jul 10, 2024
bob80905 added a commit that referenced this issue Jul 12, 2024
The ability to spell out and specify the resource class is necessary for
testing various resource binding behaviors. Though it is not intended
for users to use this in customized HLSL source code, the ability to
specify the resource class via an attribute is immensely helpful for
writing thorough tests.
This PR introduces a new attribute, hlsl::resource_attribute, that can
only be applied on structs. This attribute only has 1 required argument,
and must be one of:
```
SRV
UAV
CBuffer
Sampler
```
By applying this attribute to a struct, the struct will have the
`HLSLResourceClassAttr` attribute attached to it in the AST
representation, which provides information on the type of resource class
the struct is meant to be.

The resource class data that was originally contained within the
`HLSLResourceAttr` attribute has been removed in favor of this new
attribute, and so certain ast-dump tests need to be modified so that the
same information can be represented via 2 attributes instead of one.

Fixes #98193

---------

Co-authored-by: Damyan Pepper <damyanp@microsoft.com>
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:codegen and removed metabug labels Jul 12, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 12, 2024

@llvm/issue-subscribers-clang-frontend

Author: Justin Bogner (bogner)

Create a new `hlsl::resource_class` attribute to replace the resource class argument of the HLSLResource unspellable attribute. The attribute should be spellable so that we can use it to simplify testing.

AC:

  • Decide what the spelling should be
  • The attribute [[hlsl::resource_class(...)]] can be applied to types in HLSL source
  • The attribute is parametrized with uav, srv, cbuffer, or sampler
  • HLSLResource no longer has a ResourceClass argument, and existing code that used that now uses the new attribute

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 12, 2024

@llvm/issue-subscribers-clang-codegen

Author: Justin Bogner (bogner)

Create a new `hlsl::resource_class` attribute to replace the resource class argument of the HLSLResource unspellable attribute. The attribute should be spellable so that we can use it to simplify testing.

AC:

  • Decide what the spelling should be
  • The attribute [[hlsl::resource_class(...)]] can be applied to types in HLSL source
  • The attribute is parametrized with uav, srv, cbuffer, or sampler
  • HLSLResource no longer has a ResourceClass argument, and existing code that used that now uses the new attribute

aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this issue Jul 14, 2024
)

The ability to spell out and specify the resource class is necessary for
testing various resource binding behaviors. Though it is not intended
for users to use this in customized HLSL source code, the ability to
specify the resource class via an attribute is immensely helpful for
writing thorough tests.
This PR introduces a new attribute, hlsl::resource_attribute, that can
only be applied on structs. This attribute only has 1 required argument,
and must be one of:
```
SRV
UAV
CBuffer
Sampler
```
By applying this attribute to a struct, the struct will have the
`HLSLResourceClassAttr` attribute attached to it in the AST
representation, which provides information on the type of resource class
the struct is meant to be.

The resource class data that was originally contained within the
`HLSLResourceAttr` attribute has been removed in favor of this new
attribute, and so certain ast-dump tests need to be modified so that the
same information can be represented via 2 attributes instead of one.

Fixes llvm#98193

---------

Co-authored-by: Damyan Pepper <damyanp@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants