Skip to content

[HLSL] Create HLSLConstantAccess pass to translate hlsl_constant loads #124630

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

Closed
Tracked by #41
hekota opened this issue Jan 27, 2025 · 0 comments · Fixed by #134571
Closed
Tracked by #41

[HLSL] Create HLSLConstantAccess pass to translate hlsl_constant loads #124630

hekota opened this issue Jan 27, 2025 · 0 comments · Fixed by #134571
Assignees
Labels
backend:DirectX HLSL HLSL Language Support

Comments

@hekota
Copy link
Member

hekota commented Jan 27, 2025

Create a new HLSLConstantAccess pass that will translate all load instructions in hlsl_constant address space to llvm.{dx|spv}.resource.load.cbuffer intrinsics calls. It will make use of the metadata generated in #113514 that maps the constants global variables to individual constant buffers and specified the constant buffer layout. The pass also needs to transform related getelementptr instructions to use the constant buffer layout offsets.

After the HLSLConstantAccess pass completes the constant buffer metadata is no longer needed and should be removed.

@hekota hekota added the HLSL HLSL Language Support label Jan 27, 2025
@hekota hekota moved this to Designing in HLSL Support Jan 27, 2025
@hekota hekota mentioned this issue Jan 27, 2025
11 tasks
@damyanp damyanp moved this from Designing to Ready in HLSL Support Feb 10, 2025
@damyanp damyanp moved this from Ready to Active in HLSL Support Feb 20, 2025
hekota added a commit that referenced this issue Feb 20, 2025
Translates `cbuffer` declaration blocks to `target("dx.CBuffer")` type. Creates global variables in `hlsl_constant` address space for all `cbuffer` constant and adds metadata describing which global constant belongs to which constant buffer. For explicit constant buffer layout information an explicit layout type `target("dx.Layout")` is used. This might change in the future.

The constant globals are temporary and will be removed in upcoming pass that will translate `load` instructions in the `hlsl_constant` address space to constant buffer load intrinsics calls off a CBV handle (#124630, #112992).

See [Constant buffer design
doc](llvm/wg-hlsl#94) for more details.

Fixes #113514, #106596
bogner added a commit to bogner/llvm-project that referenced this issue Apr 7, 2025
This introduces a pass that walks accesses to globals in cbuffers and
replaces them with accesses via the cbuffer handle itself. The logic to
interpret the cbuffer metadata is kept in `lib/Frontend/HLSL` so that it
can be reused by other consumers of that metadata.

Fixes llvm#124630.
@bogner bogner moved this from Active to Needs Review in HLSL Support Apr 7, 2025
bogner added a commit to bogner/llvm-project that referenced this issue Apr 8, 2025
This introduces a pass that walks accesses to globals in cbuffers and
replaces them with accesses via the cbuffer handle itself. The logic to
interpret the cbuffer metadata is kept in `lib/Frontend/HLSL` so that it
can be reused by other consumers of that metadata.

Fixes llvm#124630.
bogner added a commit to bogner/llvm-project that referenced this issue Apr 9, 2025
This introduces a pass that walks accesses to globals in cbuffers and
replaces them with accesses via the cbuffer handle itself. The logic to
interpret the cbuffer metadata is kept in `lib/Frontend/HLSL` so that it
can be reused by other consumers of that metadata.

Fixes llvm#124630.
bogner added a commit to bogner/llvm-project that referenced this issue Apr 14, 2025
This introduces a pass that walks accesses to globals in cbuffers and
replaces them with accesses via the cbuffer handle itself. The logic to
interpret the cbuffer metadata is kept in `lib/Frontend/HLSL` so that it
can be reused by other consumers of that metadata.

Fixes llvm#124630.
bogner added a commit to bogner/llvm-project that referenced this issue Apr 16, 2025
This introduces a pass that walks accesses to globals in cbuffers and
replaces them with accesses via the cbuffer handle itself. The logic to
interpret the cbuffer metadata is kept in `lib/Frontend/HLSL` so that it
can be reused by other consumers of that metadata.

Fixes llvm#124630.
@bogner bogner closed this as completed in 3de88fe Apr 16, 2025
@github-project-automation github-project-automation bot moved this from Needs Review to Closed in HLSL Support Apr 16, 2025
var-const pushed a commit to ldionne/llvm-project that referenced this issue Apr 17, 2025
This introduces a pass that walks accesses to globals in cbuffers and
replaces them with accesses via the cbuffer handle itself. The logic to
interpret the cbuffer metadata is kept in `lib/Frontend/HLSL` so that it
can be reused by other consumers of that metadata.

Fixes llvm#124630.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:DirectX HLSL HLSL Language Support
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

3 participants