llvm / llvm/llvm-project

[SPIR-V] SPIRV-Val is complaining that OpTypeStruct must not contain an opaque type

Open
#194,435 6 comments 0 reactions 0 assignees View on GitHub
backend:SPIR-V HLSL
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Currently, when compiling HLSL structures or constant buffers that contain opaque resource types (like RWBuffer or Texture2D) to SPIR-V, the compiler generates standard Vulkan SPIR-V which strictly forbids opaque types inside structures. This results in a validation error (VUID-StandaloneSpirv-None-04667).

As a result we are seeing these errors on the offload test suite
https://github.com/llvm/offload-test-suite/actions/runs/24995356633/job/73190808526#step:13:597
```
# .---command stderr------------
# | error: line 29: [VUID-StandaloneSpirv-None-04667] In Vulkan, OpTypeStruct must not contain an opaque type.
# | %class_hlsl__RWBuffer = OpTypeStruct %spirv_SignedImage
# |
# | clang-dxc: error: spirv-val command failed with exit code 1 (use -v to see invocation)
# `-----------------------------
# error: command failed with exit status: 1
```

This is a validator complaint from `spirv-val`.

## Tests impacted
```
OffloadTest-clang-vk :: Feature/ResourcesInStructs/array-of-structs-with-res.test
OffloadTest-clang-vk :: Feature/ResourcesInStructs/res-array-of-matrix-in-struct.test
OffloadTest-clang-vk :: Feature/ResourcesInStructs/res-in-struct-mix.test
OffloadTest-clang-vk :: Feature/ResourcesInStructs/res-in-struct-simple-array.test
OffloadTest-clang-vk :: Feature/ResourcesInStructs/res-in-struct-simple-one.test
```

CC: @s-perron @Keenuts

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.