Graphics Reference
In-Depth Information
Figure 5.5. The synchronization of multiple threads within a thread group with a memory barrier with
group synch.
are guaranteed to have completed, the developer can be certain there won't be any issues
with read-after-write errors.
The sister function for GroupMemoryBarrier() is GroupMemoryBarrierWithGroup
Sync(). This function blocks a thread from continuing until all group shared memory
writes are completed, but it also blocks execution until all of the threads in the group have
advanced to this function. This allows the developer to be certain that all threads have had
a chance to execute to this function call before other threads advance farther. This is a use-
ful mechanism to utilize when each thread in a thread group is loading a set of data into
the group shared memory for the other threads to use. It is clear that we wouldn't want any
thread to advance until all of the group shared memory has been loaded, making this the
perfect synchronization method. Figure 5.5 demonstrates how this thread management is
performed.
The second pair of synchronization functions performs similar operations, except
that they operate over the Device memory pool. This means that all pending memory write
operations that write to a resource through an unordered access view can be synchronized
before continuing execution of the shader program. This can be very useful for synchroniz-
ing larger amounts of memory, which would require the use of device resources since the
Search WWH ::




Custom Search