Skip to content

[SPIR-V] Handle vector types in HLSL RWBuffers #124551

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
s-perron opened this issue Jan 27, 2025 · 0 comments · Fixed by #125581
Closed

[SPIR-V] Handle vector types in HLSL RWBuffers #124551

s-perron opened this issue Jan 27, 2025 · 0 comments · Fixed by #125581
Assignees
Labels
backend:SPIR-V metabug Issue to collect references to a group of similar or related issues.

Comments

@s-perron
Copy link
Contributor

The representation of a RWBuffer in llvm-ir uses a spirv.Image target extension type. That target extension type corresponds exactly with the OpTypeImage instruction. The instruction has a sampled type, but it must be a scalar type. The difference between RWBuffer with a scalar template and one with a vector template is the result type on the load and the type of the object being stored in a store. See https://godbolt.org/z/b99G474TE for an example with a vector template.

We need to fix the type scavenging for the calls to @lvm.spv.resource.getpointer. They currently set the type of the pointer to the scalar type. It would look at the use to determine the type.

@s-perron s-perron self-assigned this Jan 27, 2025
s-perron added a commit to s-perron/llvm-project that referenced this issue Feb 3, 2025
The type inference for `spv_resource_getpointer` must look at the uses
of the intrinsic. The type of the handle will be a scalar type, but it
can still be read or written as a vector of that type.

Fixes llvm#124551.
@github-project-automation github-project-automation bot moved this to Closed in HLSL Support Feb 7, 2025
github-actions bot pushed a commit to arm/arm-toolchain that referenced this issue Feb 7, 2025
The type inference for `spv_resource_getpointer` must look at the uses
of the intrinsic. The type of the handle will be a scalar type, but it
can still be read or written as a vector of that type.

Fixes llvm/llvm-project#124551.
Icohedron pushed a commit to Icohedron/llvm-project that referenced this issue Feb 11, 2025
The type inference for `spv_resource_getpointer` must look at the uses
of the intrinsic. The type of the handle will be a scalar type, but it
can still be read or written as a vector of that type.

Fixes llvm#124551.
@EugeneZelenko EugeneZelenko added the metabug Issue to collect references to a group of similar or related issues. label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:SPIR-V metabug Issue to collect references to a group of similar or related issues.
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

2 participants