AMD Graphics Pipeline GIC2020
AMD Graphics Pipeline GIC2020
PIPELINES – JOURNEY
THROUGH THE GPU
LOU KRAMER,
DEVELOPER TECHNOLOGY ENGINEER, AMD
OVERVIEW
.dae
.abc
.3ds
Export .fbx
.ply
.obj
.x3d
.stl
<custom>
Positions
Normal Vectors
Texture Coordinates
Connectivity Information
…
.dae
.abc
.3ds
.fbx
.ply Import
.obj
.x3d Game Engine of your choice
.stl
<custom>
Buffers in
List of Commands
System Memory (CPU)
PCIe®
vkCmdBindPipeline
vkCmdBindVertexBuffers
vkCmdBindIndexBuffer
vkCmdDrawIndexed
▪ Send a batch of commands to the GPU
… so the GPU is busy for quite a while.
▪ Every command list submission takes some
time!
vkCmdBindPipeline
vkCmdBindVertexBuffers
vkCmdBindIndexBuffer
vkCmdDrawIndexed
▪ Send a batch of commands to the GPU
… so the GPU is busy for quite a while.
▪ Every command list submission takes some
time!
▪ vkCmdBindPipeline: Sets the GPU into the correct state.
→ Contains the settings for the different stages of the graphics pipeline.
▪ vkCmdBindVertexBuffers: Tells the GPU which vertex buffers to access for the next drawcalls.
▪ vkCmdBindIndexBuffer: Tells the GPU which index buffer to access for the next draw calls.
▪ vkCmdDrawIndexed: The actual draw call → will process the specified vertices according to the state of the GPU.
Input Assembler Vertex Shader Stage Tesselation Stage Geometry Shader Stage
Input Assembler Vertex Shader Stage Tesselation Stage Geometry Shader Stage
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Vertex Pipeline
Pixel Pipeline
Compute Pipeline
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Shader
Command Geometry Shader Primitive Scan
Processor Dual Compute Unit
Processor Engine Export Assembler Converter
Input
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
▪ Waits until there are enough indices before bothering the Dual Compute Unit. Dual CU
▪ Chooses a Dual CU. Shader PC
▪ Configures Dual CU. Processor
▪ Reserves resources in Dual CU. Input
▪ Loads address of vertex shader program into the program counter (PC). Vector Registers
▪ Initializes scalar and vector registers in Dual CU.
▪ Kicks off work for Dual CU. Scalar Registers
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
Example Pseudo-Code:
…
if (vertex == tail) {
// Do something fox tail specific
Skipped!!!
}
else {
// Do something else 💃
Idle
}
…
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
Double CU
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
Double CU
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
▪ Determine all pixels that overlap the triangle. On a fine level (4x4 pixels) test against the triangle edges.
→ Rasterization
▪ Scan Conversion only on a coarse level.
Forwards quads to the
Shader Processor
Input.
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
▪ A lot of small triangles covering only a single pixel → a lot of threads are masked out:
▪ Pixels within the quad not covered by the triangle lead to inactive threads!
▪ Export finished pixels / fragments via Shader Export.
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
▪ This time, the Shader Export forwards the fragments to the Color Backend / Depth Backend instead of the
Primitive Assembler.
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
▪ Color Blending.
▪ Writes the fragment color to the bound render targets.
▪ MSAA resolve.
▪ Compression.
▪ …
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Input Assembler Vertex Shader Tesselation Geometry Shader Rasterizer Pixel Shader Output Merger
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
Shader Shader
Geometry Shader Primitive Scan Shader
Processor Dual Compute Unit Processor Dual Compute Unit
Engine Export Assembler Converter Export
Input Input
▪ If the triangle is not spanning over the whole output render target,
only a part of the output render target will be modifed!
DisplayPort™
HDMI®
…
THIS INFORMATION IS PROVIDED ‘AS IS.” AMD MAKES NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE CONTENTS HEREOF AND
ASSUMES NO RESPONSIBILITY FOR ANY INACCURACIES, ERRORS, OR OMISSIONS THAT MAY APPEAR IN THIS INFORMATION. AMD SPECIFICALLY
DISCLAIMS ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT WILL
AMD BE LIABLE TO ANY PERSON FOR ANY RELIANCE, DIRECT, INDIRECT, SPECIAL, OR OTHER CONSEQUENTIAL DAMAGES ARISING FROM THE USE OF
ANY INFORMATION CONTAINED HEREIN, EVEN IF AMD IS EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.