kurt akeley nvidia corporation nvidia u presentation, 25 ... · nvidia corporation nvidia u...

31
Data Storage and Transfer in OpenGL ® Data Storage and Transfer in OpenGL ® Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 July 2003

Upload: others

Post on 31-Jul-2020

22 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

Data Storage and Transfer in OpenGL®Data Storage and Transfer in OpenGL®

Kurt AkeleyNVIDIA CorporationNVIDIA U Presentation, 25 July 2003

Page 2: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Outline

Data movement is the issueMemory typesDesign examples

Buffer objectsSuperbuffers (in process)

Programmable GPU memoryQ & A

Page 3: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

Data MovementData Movement

Page 4: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Semiconductor Scaling Rates

From: Digital Systems Engineering, Dally and Poulton

31.28Aggregate off-chip bandwidth

71.11750Pins per package

1.31.71Die-length wire delay / gate delay

1.00Device-length wire delay

1.31.71Capability (grids / gate delay)

(5)0.87150 pSGate Delay

1.751.491 BMoore’s Law (grids on a die)**

Years to Double (Half)

Yearly Factor

Current ValueParameter

** Ignores multi-layer metal, 8-layers in 2001

Page 5: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Two Approaches

Move data faster (optimize speed)Point-to-point wiringAdvanced protocols (e.g. clock in data)Wide interfaces (256-bit GPUs)

Move data less (optimize locality)AlgorithmArchitecture (e.g. pipeline GPU)Cache data

Page 6: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

It’s All Cache!

Page 7: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

Memory TypesMemory Types

Page 8: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

OpenGL’s Memory Types

Byte memoryClient pixel data

Element memoryFramebufferTexture object’s image

OthersDisplay list memory...

Page 9: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Memory Properties

Server sideClient side *Typical location

Not allowedMay be allowedOut-of-order ops

Not allowedMay be allowedCPU mapping

PersistentPer-transactionFormatting

Component, indexByteBasic unit

Element memoryByte memoryProperty

Client pixel data Framebuffer

* We’ll see an exception soon

Page 10: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

Buffer ObjectsBuffer Objects

Page 11: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Classic Immediate Mode

ConvenientFlexible

Match client data structuresPer-vertex / per-primitive

SlowVector form slightly faster

float loc[2] = {2, 3};

glColor3f(1, 1, 1);

glBegin(GL_LINES);

glVertex2f(0, 1);

glVertex2fv(loc);

glEnd();

Page 12: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Vertex Arrays

glVertexPointer(size, type, stride, *pointer);

size

type

stride

pointer

glDrawArrays(mode, first, count);

glEnableClientState(GL_VERTEX_ARRAY);

enable

Page 13: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Vertex Array Problems

Client-side array is far from pipelineHard for application to use the right memory

On PC, AGP memory

Page 14: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Solutions

NV_vertex_array_rangeMake vertex arrays work betterRelax coherence rules to enable pullingHelp client to position arrays in AGP memory

Array objectsExtend vertex arrays with element memory

Page 15: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Good Qualities of Vertex Arrays

Easy to mix and match array dataShare vertex array with multiple color arraysDisable any array for debugging

Memory mappedClient can cherry-pick updatesExtra copies avoidedGreat for immediate mode rendering

Easy to mix usage modelsStatic array dataDynamic array data

Page 16: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

ARB Solution: Server-side Buffer Objects

Byte memory (mappable)Server side (efficient for rendering, sharable)

ApplicationByte

Memory+ State

Buffer Object

GL ServerGL Client

Page 17: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Modifying Buffer Object Data

FunctionalglBufferSubDataARB(target, offset, size, *data);

glGetBufferSubDataARB(target, offset, size, *data);

Always safeMemory mapped

void *glMapBufferARB(target, access);

GLboolean *glUnmapBufferARB(target);

May result in data lossMay not be faster

Page 18: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Mapping Rules

Be prepared for data lossMap for brief periods only

Map it, modify it, then unmap itDon’t render from a mapped buffer

Don’t pass a map pointer to the GL

Page 19: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Store Vertex Arrays in Buffers

VertexPointer(size, type, stride, *pointer);

size

type

stride

pointer

bufferARRAY_BUFFER_ARB

offset

Page 20: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Client and Server State

Application

Buffer Objects

GL ServerGL Client

ARRAY_BUFFER_ARB

size

type

stride

pointer

buffer

Buffer objects are server stateVertex arrays parameters are client state

size

type

stride

pointer

buffer

size

type

stride

pointer

buffer

size

type

stride

pointer

buffer

Byte Memory+ State

Page 21: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

SuperbuffersSuperbuffers(In Process)(In Process)

Page 22: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

The OpenGL “Machine Tool”

Point, Line,Polygon

Rasterization

UnpackPixels

PackPixels

PixelOperations

ImageRasterization

TextureMemory

FragmentOperations

UnpackVertexes

VertexOperations

Framebuffer

Image

Geometry

Page 23: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Problems

Framebuffer to texture transferCopy is too slowCurrent acceleration methods (pbuffers) are

Window-system specificAwkward to use

Framebuffer to geometry transferCopy is too slowThere are no acceleration methods

Render to texture

Page 24: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Why Not Add Destructive Copy?

Virtue of simplicityIssues

Can’t be anticipatedForces 2x memory when not otherwise needed

Page 25: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Superbuffer Solution

Invent framebuffer objectsMuch like texture objects

Invent element memory objects1D, 2D, or 3D images

Attach element memory objectsTo texture objects, as image levelsTo framebuffer objects, as color, depth, and stencil buffers

Page 26: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Superbuffers

Texture Object

Memory Object

FramebufferObject

Buffer Object

?

Page 27: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

Can element memory objects be attached to

buffer objects?

Can element memory objects be attached to

buffer objects?

Page 28: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

GPU MemoryGPU Memory

Page 29: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

So Far So Good

Byte / element distinction makes senseTexture is element memory

Always accessed through functional interfaceFramebuffer is element memory

Rendered through functional interfaceCannot be read by vertex/fragment processor

Language arrays are “byte” memory

Page 30: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

Summary

NVIDIA is committed to OpenGL

OpenGL is evolvingBuffer objects will be in 1.5, due this summerSuperbuffers are underway, no target date

Byte / element memory distinction has been useful

Page 31: Kurt Akeley NVIDIA Corporation NVIDIA U Presentation, 25 ... · NVIDIA Corporation NVIDIA U Presentation, 25 July 2003. NVIDIA CONFIDENTIAL Outline Data movement is the issue Memory

NVIDIA CONFIDENTIAL

For More Information

www.opengl.orghttp://developer.nvidia.com/view.asp?IO=presentations