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 backend crash with WGSL dot function #2694

Closed
hanawatson opened this issue May 25, 2022 · 4 comments
Closed

Vulkan backend crash with WGSL dot function #2694

hanawatson opened this issue May 25, 2022 · 4 comments
Labels
area: correctness We're behaving incorrectly backend: vulkan Issues with Vulkan external: upstream Issues happening in lower level APIs or platforms type: bug Something isn't working
Milestone

Comments

@hanawatson
Copy link

hanawatson commented May 25, 2022

Description
wgpu with Vulkan backend crashes with a parent device is lost validation error when given a WGSL shader that uses the dot function.

Repro steps
Run this WGSL code (it seems to work for all alternative random values of vectors that I have tried) through wgpu with Vulkan backend:

struct outputBuffer {
	output: i32,
}

@group(0) @binding(0)
var<storage, read_write> out: outputBuffer;

@compute @workgroup_size(1)
fn main() {
	var var0 = dot(vec2<i32>(1, 2), vec2<i32>(1, 2));
	out.output = 0;
}

Expected vs observed behavior
Expecting normal compilation/running behavior, and an output of 0 for the out buffer. Instead, wgpu seems to crash:

wgpu error: Validation Error
        
        Caused by:
            In Device::create_compute_pipeline
            parent device is lost

Extra materials
Setting RUST_LOG=trace gets a lot of information about my GPU etc., followed by:

[2022-05-25T18:59:33Z DEBUG naga::front] Resolving [1] = GlobalVariable([1]) : Value(Pointer { base: [2], space: Storage { access: LOAD | STORE } })
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [2] = Constant([1]) : Value(Scalar { kind: Sint, width: 4 })
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [3] = Constant([2]) : Value(Scalar { kind: Sint, width: 4 })
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [4] = Compose { ty: [3], components: [[2], [3]] } : Handle([3])
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [5] = Constant([1]) : Value(Scalar { kind: Sint, width: 4 })
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [6] = Constant([2]) : Value(Scalar { kind: Sint, width: 4 })
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [7] = Compose { ty: [3], components: [[5], [6]] } : Handle([3])
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [8] = Math { fun: Dot, arg: [4], arg1: Some([7]), arg2: None, arg3: None } : Value(Scalar { kind: Sint, width: 4 })
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [9] = LocalVariable([1]) : Value(Pointer { base: [1], space: Function })
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [10] = AccessIndex { base: [1], index: 0 } : Value(Pointer { base: [1], space: Storage { access: LOAD | STORE } })
        [2022-05-25T18:59:33Z DEBUG naga::front] Resolving [11] = Constant([3]) : Value(Scalar { kind: Sint, width: 4 })
        [2022-05-25T18:59:33Z DEBUG naga::valid::interface] var GlobalVariable { name: Some("checksum"), space: Storage { access: LOAD | STORE }, binding: Some(ResourceBinding { group: 0, binding: 0 }), ty: [2], init: None }
        [2022-05-25T18:59:33Z DEBUG naga::valid::function] var LocalVariable { name: Some("var0"), ty: [1], init: None }
        [2022-05-25T18:59:33Z WARN  wgpu_hal::vulkan] Unrecognized device error ERROR_UNKNOWN
        [2022-05-25T18:59:33Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default

and enabling Vulkan validation layers gives this:

UNASSIGNED-CoreValidation-Shader-InconsistentSpirv(ERROR / SPEC): msgNum: 7060244 - Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55fb1f2e70f0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: ConstantNull cannot appear in a function declaration
          %26 = OpConstantNull %int
        
            Objects: 1
                [0] 0x55fb1f2e70f0, type: 3, name: NULL
        VUID-vkDestroyDevice-device-00378(ERROR / SPEC): msgNum: 1901072314 - Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x55fb1f2e70f0, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0xee647e0000000009, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x55fb1f2e70f0[], VkShaderModule 0xee647e0000000009[] has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (https://vulkan.lunarg.com/doc/view/1.3.211.0/linux/1.3-extensions/vkspec.html#VUID-vkDestroyDevice-device-00378)
            Objects: 2
                [0] 0x55fb1f2e70f0, type: 3, name: NULL
                [1] 0xee647e0000000009, type: 15, name: NULL

Platform
cargo 1.60.0, wgpu v0.12.0, Mesa Intel(R) UHD Graphics 620 (KBL GT2) (renderer version 21.3.8), Vulkan backend, Kali Linux
(Was planning on getting a little more information using wgpu-info, but every time I try to run it panics with a No such file error - unsure if this is relevant)

@cwfitzgerald cwfitzgerald added this to the Release 0.13 milestone Jun 2, 2022
@cwfitzgerald cwfitzgerald added type: bug Something isn't working external: upstream Issues happening in lower level APIs or platforms area: correctness We're behaving incorrectly labels Jun 2, 2022
@cwfitzgerald
Copy link
Member

Is this against master or against released 0.12?

@hanawatson
Copy link
Author

hanawatson commented Jun 3, 2022

Is this against master or against released 0.12?

Against released 0.12, I think (the crate version is v0.12.0, so I'm assuming these match up!).

@cwfitzgerald cwfitzgerald added the backend: vulkan Issues with Vulkan label Jun 4, 2022
@jinleili
Copy link
Contributor

jinleili commented Jun 9, 2022

Verified on master, cannot reproduce this issue

@cwfitzgerald
Copy link
Member

Thank you so much for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: correctness We're behaving incorrectly backend: vulkan Issues with Vulkan external: upstream Issues happening in lower level APIs or platforms type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants