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

Metal Autosync Doesn't Barrier Vertex Shader Write -> Copy Source Hazards #4732

Open
cwfitzgerald opened this issue Nov 20, 2023 · 0 comments
Labels
api: metal Issues with Metal external: driver-bug A driver is causing the bug, though we may still want to work around it type: bug Something isn't working

Comments

@cwfitzgerald
Copy link
Member

cwfitzgerald commented Nov 20, 2023

Description

Discovered in #4723

In the test code for vertex_indices we do a renderpass that writes to a storage buffer from a vertex shader. It then copies that buffer to a cpu side buffer to read.

If done without a hard cpu-side wait in between the renderpass and read, it appears as though there is no synchronization between the renderpass and the blit.

I know that the M1 has separate blit and vertex engines which metal can use simultanously, so this is my best guess as to what is happening.

See also #3110

        ctx.queue.submit([encoder1.finish()]);
        ctx.device.poll(wgpu::Maintain::Wait); // Remove this for a race.
        ctx.queue.submit([encoder2.finish()]);

Encoder 1 has the renderpass, Encoder 2 has the copy. If you remove the poll, random tests will fail with no data.

Platform
M1, Sonoma 14.1.1

Interestingly it doesn't appear to happen on our CI machine, currently running Monterey (12) also with an M1.

@cwfitzgerald cwfitzgerald added type: bug Something isn't working external: driver-bug A driver is causing the bug, though we may still want to work around it api: metal Issues with Metal labels Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: metal Issues with Metal external: driver-bug A driver is causing the bug, though we may still want to work around it type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant