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

Crash on Chrome WebGPU for kernels that bind with aliasing. #1930

Open
ArthurBrussee opened this issue Jun 25, 2024 · 1 comment
Open

Crash on Chrome WebGPU for kernels that bind with aliasing. #1930

ArthurBrussee opened this issue Jun 25, 2024 · 1 comment
Labels
bug Something isn't working wgpu Related to WGPU backend

Comments

@ArthurBrussee
Copy link
Contributor

ArthurBrussee commented Jun 25, 2024

Describe the bug

If some operations use a tensor multiple times, Chrome can crash complaining it's a violation of the WebGPU specification to bind aliased buffers.

To Reproduce

let tensor = Tensor::<Backend, 2>::zeros([2, 1], &device); 
let test: Tensor<Backend, 2> = tensor.clone().mul(tensor).sum_dim(1); // fails!
//  for some reason works if tensor is 1D? Or if not summing / presumable some other operation?
// It might be slightly more involved than I thought!
// The following does work:
// let test: Tensor<Backend, 2> = tensor.clone().powf_scalar(2.0).sum_dim(1);

Run this code on WebGPU on Chrome (firefox nightly seems fine with it - though I've had a host of other issues on firefox so generally it seems less complete).

The output looks like:

Writable storage buffer binding aliasing found between [BindGroup (unlabeled)] set at bind group index 0, binding index 0, and [BindGroup (unlabeled)] set at bind group index 0, binding index 1, with overlapping ranges (offset: 0, size: 8) and (offset: 0, size: 8) in [Buffer (unlabeled)].
 - While encoding [ComputePassEncoder (unlabeled)].DispatchWorkgroups(1, 1, 1).

127.0.0.1/:1 [Invalid CommandBuffer "Command Encoder" from CommandEncoder "Command Encoder"] is invalid.
 - While calling [Queue].Submit([[Invalid CommandBuffer "Command Encoder" from CommandEncoder "Command Encoder"]])

Expected behavior
Don't crash :) How to achieve that seems trickier. You'd need different WGSL versions of the kernel depending on whether inputs/outputs are the same or not. CubeCL might be able to handle that, but I'm not entirey sure what 's best here!

@antimora
Copy link
Collaborator

CC @louisfd @nathanielsimard

@antimora antimora added bug Something isn't working wgpu Related to WGPU backend labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wgpu Related to WGPU backend
Projects
None yet
Development

No branches or pull requests

2 participants