Graphics Reference
In-Depth Information
Figure 5.3. A visualization of individual threads within a dispatch call.
From this geometric interpretation of the thread locations, we can also consider an
overall unique identifier for each of the threads from within the complete dispatch call.
This identifier could essentially locate the thread with an X, Y, and Z coordinate within the
three-dimensional grid shown in Figure 5.3. As described before, each of these threads will
be used to execute one instance of our processing kernel.
5.2.3 Thread Addressing System
At this point, we have an understanding of how the compute shader instantiates threads, and
subsequently, of how many instances of our processing kernel will be executed for a given
dispatch size. From the example dispatch call in the previous section, we would have 6,400
threads/kernel instances being executed. But how do all of these individual threads know what
data to operate on? If they are all instantiations of the same kernel program, then the desired
data cannot be manually specified in the shader program. There must be a different mechanism
for informing each thread about which portion of a data set it should be processing.
The geometric interpretation of the threading structure of a dispatch call holds the
key to understanding how this information is provided. This geometric organization of the
threading system was an intentional design decision, which allows for a very clear and
concise thread addressing system. As we saw in the previous section, it is trivial to identify
Search WWH ::




Custom Search