gpu fundamentals

Upload: iluxi

Post on 10-Feb-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/22/2019 GPU fundamentals

    1/21

    GPUGraphics Processing Unit

  • 7/22/2019 GPU fundamentals

    2/21

    Graphics

    PipelineScene

    Transformations

    Lighting &

    Shading

    Viewing

    Transformations

    Rasterization

    GPUs evolved as

    hardware and software

    algorithms evolve

  • 7/22/2019 GPU fundamentals

    3/21

    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.

    CPUFrame

    bufferDisplay

  • 7/22/2019 GPU fundamentals

    4/21

    More detailed

    pipeline

    Geometry data

    Transform & lighting

    Culling, perspective divide,

    viewport mapping

    Rasterization

    Simple texturing

    Depth test

    Frame buffer blending

    Simple

    functionality

    transferred tospecialized

    hardware.

  • 7/22/2019 GPU fundamentals

    5/21

    Add more

    functionality

    to GPU.

    Geometry data

    Transform & lighting

    Culling, perspective divide,

    viewport mapping

    Rasterization

    Simple texturing

    Depth test

    Frame buffer blending

    Simple

    functionality

    transferred tospecialized

    hardware

  • 7/22/2019 GPU fundamentals

    6/21

    Fixed function GPU pipeline

    Pipeline implemented in hardware Each stage does fixed task Tasks are parameterized

    Inflexiblefixed, parameterized functions Vector-matrix operations (some parallelism).

    CPU Frame

    bufferDisplay

    SceneTransformations

    Lighting &

    Shading

    ViewingTransformations

    Rasterization

    GPU

  • 7/22/2019 GPU fundamentals

    7/21

    Technology

    advances Hardware gets cheaper, smaller, and

    more powerful

    Parallel architectures develop Graphics processing get more

    sophisticated (environmental mapping,

    displacement mapping, sub-surfacescattering)

    Need more flexibility in GPUs.

  • 7/22/2019 GPU fundamentals

    8/21

    Make this

    programmable:

    Vertex Shader

    Geometry data

    Transform & lighting

    Culling, perspective divide, viewport

    mapping

    Rasterization

    Complex texturing

    Depth test, alpha test, stencil test

    Frame buffer blending

    Make this

    programmable:Fragment Shader

  • 7/22/2019 GPU fundamentals

    9/21

    Vertex shader

    Graphics systems: convert everything totriangles

    Pass vertices, normals, colors, texturecoordinates to GPU processor GPU: vertex-based computations, Independent of other vertices

    Later, assemble into triangles.

  • 7/22/2019 GPU fundamentals

    10/21

    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.

  • 7/22/2019 GPU fundamentals

    11/21

    Geometry data

    Culling, perspective divide,

    viewport mapping

    Rasterization

    Fragment

    Shader

    Alpha test, depth test, stencil test

    Frame buffer blending

    Vertex

    Shader

    Vertex

    Shader

    Vertex

    Shader

    Fragment

    Shader

    Fragment

    Shader

    Introduce

    parallelism:add multiple

    units

  • 7/22/2019 GPU fundamentals

    12/21

    Shading language

    Shade trees -> Pixars Renderman shader

  • 7/22/2019 GPU fundamentals

    13/21

    Shader Language

    Low level (like assembler) but high-level

    language compilers: nVidias Cg 4 component floating point data type SIMD

  • 7/22/2019 GPU fundamentals

    14/21

    Cg: C-based graphics program

    Array & structures

    Flow control Vectors & matrices

    No memory allocation, file I/O

  • 7/22/2019 GPU fundamentals

    15/21

    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 ofthe 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

  • 7/22/2019 GPU fundamentals

    16/21

    Next: unify shaders

    One set of shaders Allocate to either vertices or fragments

  • 7/22/2019 GPU fundamentals

    17/21

    Pipeline evolved

  • 7/22/2019 GPU fundamentals

    18/21

    Evolved pipeline

  • 7/22/2019 GPU fundamentals

    19/21

    GPGPU

    Make GPU more generaladapt certain types ofprograms to its pipelined, parallel architecture

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

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

    Finding uses in non-graphics applications.

  • 7/22/2019 GPU fundamentals

    20/21

    GeForce 8800 GTX

  • 7/22/2019 GPU fundamentals

    21/21

    More general: NVIDIAs CUDA

    More general data parallel model Decompose across threads Sharing and communication between threads..