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

The function "dispatch_workgroups_indirect" does not work #2728

Closed
panxinmiao opened this issue Jun 3, 2022 · 3 comments · Fixed by #2810
Closed

The function "dispatch_workgroups_indirect" does not work #2728

panxinmiao opened this issue Jun 3, 2022 · 3 comments · Fixed by #2810
Labels
area: correctness We're behaving incorrectly type: bug Something isn't working
Milestone

Comments

@panxinmiao
Copy link

Description

I tried to update the wgpu-native to the latest wgpu-core, but the test case of dispatch_workgroups_indirect in the downstream wgpu-py can't pass.

Then I tried to modify this example: "https://github.com/gfx-rs/wgpu/blob/master/wgpu/examples/hello-compute/main.rs" , create an indirect buffer and replace dispatch_workgroups with dispatch_workgroups_indirect for testing, the result is not correct also.

Repro steps

modify this example: "https://github.com/gfx-rs/wgpu/blob/master/wgpu/examples/hello-compute/main.rs", use dispatch_workgroups_indirect instead.

Expected vs observed behavior

The output value is always equal to the input. No computes seem to have been made.

Platform

wgpu master branch. Windows10, vulkan backend

@cwfitzgerald cwfitzgerald added type: bug Something isn't working area: correctness We're behaving incorrectly labels Jun 4, 2022
@cwfitzgerald cwfitzgerald added this to the Release 0.13 milestone Jun 6, 2022
@cwfitzgerald
Copy link
Member

I can't seem to get this to reproduce on metal, what code did you use, I used

    let indirect_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
        label: None,
        contents: bytemuck::cast_slice(&[numbers.len() as u32, 1, 1]),
        usage: wgpu::BufferUsages::INDIRECT,
    });

    // A command encoder executes one or many pipelines.
    // It is to WebGPU what a command buffer is to Vulkan.
    let mut encoder =
        device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
    {
        let mut cpass = encoder.begin_compute_pass(&wgpu::ComputePassDescriptor { label: None });
        cpass.set_pipeline(&compute_pipeline);
        cpass.set_bind_group(0, &bind_group, &[]);
        cpass.insert_debug_marker("compute collatz iterations");
        cpass.dispatch_workgroups_indirect(&indirect_buffer, 0); // Number of cells to run, the (x,y,z) size of item being processed
    }

@panxinmiao
Copy link
Author

My code is similar to yours,
The results are as follows:
image

@cwfitzgerald
Copy link
Member

I've got this reproducing on dx12 with a validation error about bad barriers - I know the problem here.

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 type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants