21
GPU Graphics Processing Unit

GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Embed Size (px)

Citation preview

Page 1: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

GPUGraphics Processing Unit

Page 2: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Graphics Pipeline

Scene Scene TransformationsTransformations

Lighting & Lighting & ShadingShading

ViewingViewingTransformationTransformation

ss

RasterizationRasterization

GPUs evolved as hardware and

software algorithms evolve

Page 3: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Early Graphics•Originally, no specialized graphics

hardware

• All processing in software on CPU,

•Results transmitted to frame buffer

first, external frame buffers

later, internal frame buffers.

CPUCPU FrameFramebufferbuffer DisplayDisplay

Page 4: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

More detailed pipeline

Geometry Geometry datadata

Transform & Transform & lightinglighting

Culling, perspective divide, Culling, perspective divide, viewport mappingviewport mapping

RasterizationRasterization

Simple texturingSimple texturing

Depth testDepth test

Frame buffer Frame buffer blendingblending

Simple functionality

transferred to specialized hardware.

Page 5: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Add more functionality

to GPU.

Geometry Geometry datadata

Transform & Transform & lightinglighting

Culling, perspective divide, Culling, perspective divide, viewport mappingviewport mapping

RasterizationRasterization

Simple texturingSimple texturing

Depth testDepth test

Frame buffer Frame buffer blendingblending

Simplefunctionality

transferred to specialized hardware

Page 6: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Fixed function GPU pipeline

•Pipeline implemented in hardware

•Each stage does fixed task

•Tasks are parameterized

•Inflexible – fixed, parameterized functions

•Vector-matrix operations (some parallelism).

CPUCPU FrameFramebufferbuffer

DisplayDisplay

Scene Scene TransformationTransformation

ss

Lighting & Lighting & ShadingShading

ViewingViewingTransformationsTransformations

RasterizationRasterization

GPU

Page 7: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Technology advances

•Hardware gets cheaper, smaller, and more powerful

•Parallel architectures develop

•Graphics processing get more sophisticated (environmental mapping, displacement mapping, sub-surface scattering)

•Need more flexibility in GPUs.

Page 8: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Make this programmable:Vertex Shader

Geometry dataGeometry data

Transform & lightingTransform & lighting

Culling, perspective divide, Culling, perspective divide, viewport mappingviewport mapping

RasterizationRasterization

Complex Complex texturingtexturing

Depth test, alpha test, stencil Depth test, alpha test, stencil testtest

Frame buffer blendingFrame buffer blending

Make this programmable:

Fragment Shader

Page 9: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Vertex shader

•Graphics systems: convert everything to triangles

•Pass vertices, normals, colors, texture coordinates to GPU processor

•GPU: vertex-based computations,

Independent of other vertices

•Later, assemble into triangles.

Page 10: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Fragment shader•Fragment is triangle clipped to pixel

Interpolate values

•Multiple textures, Alpha, stencil, depth

Independent of other fragments

•Blend with contents of frame buffer.

Page 11: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Geometry dataGeometry data

Culling, perspective Culling, perspective divide, viewport divide, viewport

mappingmapping

RasterizationRasterization

Fragment Fragment ShaderShader

Alpha test, depth test, stencil Alpha test, depth test, stencil testtest

Frame buffer blendingFrame buffer blending

Vertex Vertex ShaderShader

Vertex Vertex ShaderShader

Vertex Vertex ShaderShader

Fragment Fragment ShaderShader

Fragment Fragment ShaderShader

Introduce parallelism:

add multiple

units

Page 12: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Shading language•Shade trees -> Pixar’s Renderman

shader

Page 13: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Shader Language

•Low level (like assembler) but high-level language compilers: nVidia’s Cg

•4 component floating point data type

•SIMD

Page 14: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Cg: C-based graphics program

•Array & structures

•Flow control

•Vectors & matrices

•No memory allocation, file I/O

Page 15: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Power• GPUs have moved away from the traditional fixed-

function 3D graphics pipeline toward a flexible general-purpose computational engine.

• The raw computational power of a GPU dwarfs that of the most powerful CPU, and the gap is steadily widening.

• GPUs have moved away from the traditional fixed-function 3D graphics pipeline toward a flexible general-purpose computational engine

Page 16: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Next: unify shaders•One set of shaders

•Allocate to either vertices or fragments

Page 17: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Pipeline evolved

Page 18: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

Evolved pipeline

Page 19: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

GPGPU• Make GPU more general – adapt certain types of

programs to it’s pipelined, parallel architecture

• Single GeForce 8800 chip achieves a sustained 330 billion floating-point operations per second (Gflops) on simple benchmarks

•Cost-effective: graphics driving demand up, supply up, price down for GPUs

•Finding uses in non-graphics applications.

Page 20: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

GeForce 8800 GTX

Page 21: GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware

More general: NVIDIA’s CUDA

•More general data parallel model

•Decompose across threads

•Sharing and communication between threads..