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

Memory barrier documentation, and wrappers for common usage #696

Closed
hrydgard opened this issue Jul 29, 2021 · 1 comment · Fixed by #769
Closed

Memory barrier documentation, and wrappers for common usage #696

hrydgard opened this issue Jul 29, 2021 · 1 comment · Fixed by #769
Labels
t: enhancement A new feature or improvement to an existing one.

Comments

@hrydgard
Copy link
Contributor

hrydgard commented Jul 29, 2021

In https://embarkstudios.github.io/rust-gpu/api/spirv_std/arch/fn.control_barrier.html , there's no explanation of the MEMORY template parameter, or even what values are valid in it. (Turns out it is a scope, just like the EXECUTION parameter).

I guess what would be most immediately helpful is basically just examples matching the common ones like HLSL's GroupMemoryBarrierWithGroupSync.

@hrydgard hrydgard added the t: enhancement A new feature or improvement to an existing one. label Jul 29, 2021
@hrydgard
Copy link
Contributor Author

hrydgard commented Jul 29, 2021

Here's an exact implementation of GroupMemoryBarrierWithGroupSync(), verified against the output of DXC:

    unsafe {
        control_barrier::<
            { Scope::Workgroup as u32 },
            { Scope::Workgroup as u32 },
            { Semantics::WORKGROUP_MEMORY.bits() | Semantics::ACQUIRE_RELEASE.bits() },
        >();
    }

Maybe we should have a library of wrappers for common combinations.

@hrydgard hrydgard changed the title Memory barrier documentation Memory barrier documentation, and wrappers for common usage Sep 13, 2021
@hrydgard hrydgard linked a pull request Oct 18, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: enhancement A new feature or improvement to an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant