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

Vulkan validation error: "OpTypeStruct containing an OpTypeRuntimeArray must be decorated with Block or BufferBlock" #2322

Closed
SludgePhD opened this issue Apr 27, 2023 · 0 comments · Fixed by #2455
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: SPIR-V Binary SPIR-V input and output

Comments

@SludgePhD
Copy link
Contributor

I ran into an issue in webonnx/wonnx#161 that causes a large amount of validation errors (due to the large number of shaders compiled by that project). This was surfaced when I updated the validation layers (I'm now at 1.3.243.0-1 of vulkan-validation-layers on Arch Linux), and I think the root cause is naga emitting invalid SPIR-V.

The validation errors all look like this:

[2023-04-18T00:42:44Z ERROR wgpu_hal::vulkan::instance] VALIDATION [UNASSIGNED-CoreValidation-Shader-InconsistentSpirv (0x6bbb14)]
        Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x7f1894544910, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: [VUID-StandaloneSpirv-OpTypeRuntimeArray-04680] Vulkan, OpTypeStruct containing an OpTypeRuntimeArray must be decorated with Block or BufferBlock.
      %ArrayVector = OpTypeStruct %_runtimearr_Vec4
    
[2023-04-18T00:42:44Z ERROR wgpu_hal::vulkan::instance]         objects: (type: DEVICE, hndl: 0x7f1894544910, name: ?)

And I think the reason we're seeing them is that every shader starts with a preamble like this:

type Scalar = f32;
type Vec3 = vec3<f32>;
type Vec4 = vec4<f32>;

struct Array {
	data: array<Scalar>
};

struct ArrayVector {
	data: array<Vec4>
};

type Mat3x3 = mat3x3<f32>;
type Mat4x4 = mat4x4<f32>;
type Mat4x3 = mat4x3<f32>;

struct ArrayMatrix {
	data: array<Mat4x4>
};

struct ArrayMatrix3 {
	data: array<Mat3x3>
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: SPIR-V Binary SPIR-V input and output
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants