Graphics Reference
In-Depth Information
group shared memory is limited to 32 KB for each thread group. If the desired size of the
shared memory is too large to fit in the GSM, the data can be stored in a larger resource in-
stead. These Device synchronization functions provide a synching method when a program
uses these larger resources. There are two versions of the device memory barrier functions,
one with group synchronization and one without it.
The final pair of synchronization functions essentially performs both of the previous
types of synchronization. They are useful when there is a mixture of both group shared
memory and resource memory that will be accessed by multiple threads and must be syn-
chronized before use. These types of mixed memory scenarios are particularly important to
synchronize, since the two different types of memory will likely use different subsystems
for writing, and therefore have different time delays for completing the writes.
5.4.2 Atomic Functions
The memory barrier functions are very useful for synchronizing all of the threads in a
thread group. However, this is not always necessary or desirable. There are many situations
when smaller scale synchronizations are needed, perhaps among only a few threads at a
time. In other situations, the place at which the threads should synchronize may or may not
be at the same point of execution (such as when different threads in a thread group perform
heterogeneous tasks). In these cases, the memory barrier functions are not an appropriate
synchronization method.
Instead, Shader model 5 has introduced a number of new atomic functions that can
provide more fine-grained synchronization between threads. These functions are guaran-
teed to be executed in the order that they are programmed, and they can thus be used from
one thread, and the result of the function will be propagated to any other threads trying to
access the same destination. The following list specifies all of the available functions.
InterlockedAddQ
InterlockedMin()
InterlockedMaxQ
InterlockedAndQ
InterlockedOr()
InterlockedXorQ
InterlockedCompareStore()
InterlockedCompareExchange()
InterlockedExchange()
Search WWH ::




Custom Search