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

Translation of "GroupMemoryBarrierWithGroupSync" Intrinsic #70

Open
LukasBanana opened this issue Aug 11, 2017 · 2 comments
Open

Translation of "GroupMemoryBarrierWithGroupSync" Intrinsic #70

LukasBanana opened this issue Aug 11, 2017 · 2 comments

Comments

@LukasBanana
Copy link
Owner

@BearishSun Glslang seems to translate the GroupMemoryBarrierWithGroupSync intrinsic into this:

memoryBarrierShared();
barrier();

But your proposal for the wrapper function translate it into this:

groupMemoryBarrier();
barrier();

Do you know which of the two approaches are wrong?

Greetings,
Lukas

@BearishSun
Copy link
Contributor

BearishSun commented Aug 11, 2017

I went by with what the spec says:

GroupMemoryBarrierWithGroupSync:

  • Blocks execution of all threads in a group until all group shared accesses have been completed and all threads in the group have reached this call.

groupMemoryBarrier:

  • Control the ordering of all memory transactions issued within a single shader invocation, as viewed by other invocations in the same work group.

memoryBarrierShared:

  • Control the ordering of memory transactions to shared variables issued within a single shader invocation.

In GroupMemoryBarrierWithGroupSync there is no mention of shared variables, and instead they refer to all accesses (including shared variables, as well as any other), which to me seems like is equivalent to what groupMemoryBarrier is doing.

Whether I'm interpreting it correctly, I don't know.

@LukasBanana
Copy link
Owner Author

Thanks for the quick reply. I'm preparing a couple of compilation results for my thesis.
It looks like XShaderCompiler, glslang/SPIRV-CRoss, and fxc/HLSLCrossCompiler produce different variants for this intrinsic:

  • XShaderCompiler:
groupMemoryBarrier();
barrier();
  • glslang/SPIRV-Cross:
memoryBarrierShared();
barrier();
  • fxc/HLSLCrossCompiler:
groupMemoryBarrier();
memoryBarrierShared();

Maybe all are valid. But I'm uncertain about this :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants