56
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Kevin Goldsmith | Senior Engineering Manager Bob Archer | Senior Computer Scientist Pixel Bender

Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

Embed Size (px)

Citation preview

Page 1: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Kevin Goldsmith | Senior Engineering Manager

Bob Archer | Senior Computer Scientist

Pixel Bender

Page 2: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What is Pixel Bender?

A domain specific kernel and graph language for image and video

processing designed to efficiently target current and future

heterogeneous hardware.

2

Page 3: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender Kernels & Graphs

3

<languageVersion : 1.0;>

kernel pixelate_sample

<

namespace : "AIF Test";

vendor : "Adobe";

version : 1;>

{

parameter int dimension;

input image4 inputImage;

output pixel4 outputPixel;

void evaluatePixel()

{

float dimAsFloat = float(dimension);

float2 sc = floor(outCoord() /

float2(dimAsFloat, dimAsFloat));

sc *= dimAsFloat;

outputPixel = sampleNearest(inputImage, sc);

}

}

<?xml version="1.0" encoding="utf-8"?>

<graph name = "PixelateGraph"xmlns="http://ns.adobe.com/PixelBenderGraph/1.0">

<metadata name = "namespace" value = "AIF"/>

<metadata name = "vendor" value = "Adobe Systems" />

<metadata name = "version" type = "int" value = "1" />

<parameter type = "int" name = "dimension" >

<metadata name = "defaultValue" type = "int" value = "1" />

<metadata name = "minValue" type = "int" value = "1" />

<metadata name = "maxValue" type = "int" value = "100" />

</parameter>

<inputImage type = "image4" name = "inputImage" />

<outputImage type = "image4" name = "outputImage" />

<kernel>

<![CDATA[

<languageVersion : 1.0;>

kernel Pixelate

<

namespace:"AIF";

vendor:"Adobe Systems";

version:1;

>

{

}

]]>

</kernel>

<node id = "pixelateFilter" name ="Pixelate" namespace = "AIF" vendor = "Adobe Systems"

version ="1" clientID ="ADBE Pixelate" >

<evaluateParameters>

<![CDATA[

void evaluateParameters()

{

pixelateFilter::dimension = dimension;

}

]]>

</evaluateParameters>

</node>

<!-- Connect the graph -->

<connect fromImage = "inputImage" toNode = "pixelateFilter" toInput = "src" />

<connect fromNode = "pixelateFilter" fromOutput = "dst" toImage = "outputImage" />

</graph>

Page 4: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender Kernels & Graphs

4

<languageVersion : 1.0;>

kernel pixelate_sample

<

namespace : "AIF Test";

vendor : "Adobe";

version : 1;>

{

parameter int dimension;

input image4 inputImage;

output pixel4 outputPixel;

void evaluatePixel()

{

float dimAsFloat = float(dimension);

float2 sc = floor(outCoord() /

float2(dimAsFloat, dimAsFloat));

sc *= dimAsFloat;

outputPixel = sampleNearest(inputImage, sc);

}

}

<?xml version="1.0" encoding="utf-8"?>

<graph name = "PixelateGraph"xmlns="http://ns.adobe.com/PixelBenderGraph/1.0">

<metadata name = "namespace" value = "AIF"/>

<metadata name = "vendor" value = "Adobe Systems" />

<metadata name = "version" type = "int" value = "1" />

<parameter type = "int" name = "dimension" >

<metadata name = "defaultValue" type = "int" value = "1" />

<metadata name = "minValue" type = "int" value = "1" />

<metadata name = "maxValue" type = "int" value = "100" />

</parameter>

<inputImage type = "image4" name = "inputImage" />

<outputImage type = "image4" name = "outputImage" />

<kernel>

<![CDATA[

<languageVersion : 1.0;>

kernel Pixelate

<

namespace:"AIF";

vendor:"Adobe Systems";

version:1;

>

{

}

]]>

</kernel>

<node id = "pixelateFilter" name ="Pixelate" namespace = "AIF" vendor = "Adobe Systems"

version ="1" clientID ="ADBE Pixelate" >

<evaluateParameters>

<![CDATA[

void evaluateParameters()

{

pixelateFilter::dimension = dimension;

}

]]>

</evaluateParameters>

</node>

<!-- Connect the graph -->

<connect fromImage = "inputImage" toNode = "pixelateFilter" toInput = "src" />

<connect fromNode = "pixelateFilter" fromOutput = "dst" toImage = "outputImage" />

</graph>

Page 5: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender Kernels & Graphs

5

<languageVersion : 1.0;>

kernel pixelate_sample

<

namespace : "AIF Test";

vendor : "Adobe";

version : 1;>

{

parameter int dimension;

input image4 inputImage;

output pixel4 outputPixel;

void evaluatePixel()

{

float dimAsFloat = float(dimension);

float2 sc = floor(outCoord() /

float2(dimAsFloat, dimAsFloat));

sc *= dimAsFloat;

outputPixel = sampleNearest(inputImage, sc);

}

}

<?xml version="1.0" encoding="utf-8"?>

<graph name = "PixelateGraph"xmlns="http://ns.adobe.com/PixelBenderGraph/1.0">

<metadata name = "namespace" value = "AIF"/>

<metadata name = "vendor" value = "Adobe Systems" />

<metadata name = "version" type = "int" value = "1" />

<parameter type = "int" name = "dimension" >

<metadata name = "defaultValue" type = "int" value = "1" />

<metadata name = "minValue" type = "int" value = "1" />

<metadata name = "maxValue" type = "int" value = "100" />

</parameter>

<inputImage type = "image4" name = "inputImage" />

<outputImage type = "image4" name = "outputImage" />

<kernel>

<![CDATA[

<languageVersion : 1.0;>

kernel Pixelate

<

namespace:"AIF";

vendor:"Adobe Systems";

version:1;

>

{

}

]]>

</kernel>

<node id = "pixelateFilter" name ="Pixelate" namespace = "AIF" vendor = "Adobe Systems"

version ="1" clientID ="ADBE Pixelate" >

<evaluateParameters>

<![CDATA[

void evaluateParameters()

{

pixelateFilter::dimension = dimension;

}

]]>

</evaluateParameters>

</node>

<!-- Connect the graph -->

<connect fromImage = "inputImage" toNode = "pixelateFilter" toInput = "src" />

<connect fromNode = "pixelateFilter" fromOutput = "dst" toImage = "outputImage" />

</graph>

Page 6: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender Kernels & Graphs

6

<languageVersion : 1.0;>

kernel pixelate_sample

<

namespace : "AIF Test";

vendor : "Adobe";

version : 1;>

{

parameter int dimension;

input image4 inputImage;

output pixel4 outputPixel;

void evaluatePixel()

{

float dimAsFloat = float(dimension);

float2 sc = floor(outCoord() /

float2(dimAsFloat, dimAsFloat));

sc *= dimAsFloat;

outputPixel = sampleNearest(inputImage, sc);

}

}

<?xml version="1.0" encoding="utf-8"?>

<graph name = "PixelateGraph"xmlns="http://ns.adobe.com/PixelBenderGraph/1.0">

<metadata name = "namespace" value = "AIF"/>

<metadata name = "vendor" value = "Adobe Systems" />

<metadata name = "version" type = "int" value = "1" />

<parameter type = "int" name = "dimension" >

<metadata name = "defaultValue" type = "int" value = "1" />

<metadata name = "minValue" type = "int" value = "1" />

<metadata name = "maxValue" type = "int" value = "100" />

</parameter>

<inputImage type = "image4" name = "inputImage" />

<outputImage type = "image4" name = "outputImage" />

<kernel>

<![CDATA[

<languageVersion : 1.0;>

kernel Pixelate

<

namespace:"AIF";

vendor:"Adobe Systems";

version:1;

>

{

}

]]>

</kernel>

<node id = "pixelateFilter" name ="Pixelate" namespace = "AIF" vendor = "Adobe Systems"

version ="1" clientID ="ADBE Pixelate" >

<evaluateParameters>

<![CDATA[

void evaluateParameters()

{

pixelateFilter::dimension = dimension;

}

]]>

</evaluateParameters>

</node>

<!-- Connect the graph -->

<connect fromImage = "inputImage" toNode = "pixelateFilter" toInput = "src" />

<connect fromNode = "pixelateFilter" fromOutput = "dst" toImage = "outputImage" />

</graph>

High Pass Texturize

Saturate

Blend Vacation

Page 7: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender Kernels & Graphs

7

<languageVersion : 1.0;>

kernel pixelate_sample

<

namespace : "AIF Test";

vendor : "Adobe";

version : 1;>

{

parameter int dimension;

input image4 inputImage;

output pixel4 outputPixel;

void evaluatePixel()

{

float dimAsFloat = float(dimension);

float2 sc = floor(outCoord() /

float2(dimAsFloat, dimAsFloat));

sc *= dimAsFloat;

outputPixel = sampleNearest(inputImage, sc);

}

}

<?xml version="1.0" encoding="utf-8"?>

<graph name = "PixelateGraph"xmlns="http://ns.adobe.com/PixelBenderGraph/1.0">

<metadata name = "namespace" value = "AIF"/>

<metadata name = "vendor" value = "Adobe Systems" />

<metadata name = "version" type = "int" value = "1" />

<parameter type = "int" name = "dimension" >

<metadata name = "defaultValue" type = "int" value = "1" />

<metadata name = "minValue" type = "int" value = "1" />

<metadata name = "maxValue" type = "int" value = "100" />

</parameter>

<inputImage type = "image4" name = "inputImage" />

<outputImage type = "image4" name = "outputImage" />

<kernel>

<![CDATA[

<languageVersion : 1.0;>

kernel Pixelate

<

namespace:"AIF";

vendor:"Adobe Systems";

version:1;

>

{

}

]]>

</kernel>

<node id = "pixelateFilter" name ="Pixelate" namespace = "AIF" vendor = "Adobe Systems"

version ="1" clientID ="ADBE Pixelate" >

<evaluateParameters>

<![CDATA[

void evaluateParameters()

{

pixelateFilter::dimension = dimension;

}

]]>

</evaluateParameters>

</node>

<!-- Connect the graph -->

<connect fromImage = "inputImage" toNode = "pixelateFilter" toInput = "src" />

<connect fromNode = "pixelateFilter" fromOutput = "dst" toImage = "outputImage" />

</graph>

•Explicitly Data Parallel

•Explicitly Lock Free

•Implicitly Vectorizable

•Contains Optimization Hints

•Region Reasoning

•Parameter Ranges

•Supports per-frame

functions

•JIT

•x86 with SSE

•GLSL

•Implicitly Task Parallel

•Contains Optimization Hints

•Region Reasoning

•Parameter Ranges

•Parameter Use

•Supports per frame and internal

graph logic

•Language/Hardware Agnostic

•Enforces the programming Model

Page 8: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender Runtime

Run-time scheduling

Decide if a Pixel Bender node runs on the GPU or CPU

Order the execution of each node

Drives Optimization

Runs region reasoning pass

Concatenate adjacent Pixel Bender nodes

Fix parameter values for constant folding and range propagation

Caches intra-graph frames when possible to reduce computation

Allows host application to aid optimization

Lock parameter values

Lock inputs

Interfaces with host application resource management

Application can force CPU or GPU execution

Application can provide memory or threading management

8

Page 9: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender Runtime

Run-time scheduling

Decide if a Pixel Bender node runs on the GPU or CPU

Order the execution of each node

Drives Optimization

Runs region reasoning pass

Concatenate adjacent Pixel Bender nodes

Fix parameter values for constant folding and range propagation

Caches intra-graph frames when possible to reduce computation

Allows host application to aid optimization

Lock parameter values

Lock inputs

Interfaces with host application resource management

Application can force CPU or GPU execution

Application can provide memory or threading management

9

Page 10: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender Runtime

Run-time scheduling

Decide if a Pixel Bender node runs on the GPU or CPU

Order the execution of each node

Drives Optimization

Runs region reasoning pass

Concatenate adjacent Pixel Bender nodes

Fix parameter values for constant folding and range propagation

Caches intra-graph frames when possible to reduce computation

Allows host application to aid optimization

Lock parameter values

Lock inputs

Interfaces with host application resource management

Application can force CPU or GPU execution

Application can provide memory or threading management

10

Page 11: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender Runtime

Run-time scheduling

Decide if a Pixel Bender node runs on the GPU or CPU

Order the execution of each node

Drives Optimization

Runs region reasoning pass

Concatenate adjacent Pixel Bender nodes

Fix parameter values for constant folding and range propagation

Caches intra-graph frames when possible to reduce computation

Allows host application to aid optimization

Lock parameter values

Lock inputs

Interfaces with host application resource management

Application can force CPU or GPU execution

Application can provide memory or threading management

11

Page 12: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Demo

12

Page 13: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Lessons Learned (so far)

A DSL allows you to limit the language for optimization purposes while

preserving programmability

Just-in-time Compilation allows you not only to use runtime information

for optimization purposes, but also allows you to future-proof algorithms

against later hardware architectures

Developers will learn new programming languages if they give them an

ability to do something new, or make something significantly easier

A language with only a text representation creates some nice network

and community effects (for a time)

13

Page 14: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Lessons Learned (so far)

A DSL allows you to limit the language for optimization purposes while

preserving programmability

Just-in-time Compilation allows you not only to use runtime information

for optimization purposes, but also allows you to future-proof algorithms

against later hardware architectures

Developers will learn new programming languages if they give them an

ability to do something new, or make something significantly easier

A language with only a text representation creates some nice network

and community effects (for a time)

14

Page 15: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Lessons Learned (so far)

A DSL allows you to limit the language for optimization purposes while

preserving programmability

Just-in-time Compilation allows you not only to use runtime information

for optimization purposes, but also allows you to future-proof algorithms

against later hardware architectures

Developers will learn new programming languages if they give them an

ability to do something new, or make something significantly easier

A language with only a text representation creates some nice network

and community effects (for a time)

15

Page 16: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Lessons Learned (so far)

A DSL allows you to limit the language for optimization purposes while

preserving programmability

Just-in-time Compilation allows you not only to use runtime information

for optimization purposes, but also allows you to future-proof algorithms

against later hardware architectures

Developers will learn new programming languages if they give them an

ability to do something new, or make something significantly easier

A language with only a text representation creates some nice network

and community effects (for a time)

16

Page 17: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Warning.

Speculation ahead.

17

Page 18: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

How do we make the most of the

hardware we have available?

18

Page 19: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Writing multi threaded code is like

juggling chainsaws; amazing when it

works and truly sucky when it doesn’t.

Andrew Wulf

19

Page 20: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Gflop / $

20

Page 21: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Gflop / $

Gflop / watt

21

Page 22: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Gflop / $

Gflop / watt

Gflop / developer-hour

22

Page 23: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What have we got?

23

Page 24: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What have we got?

DSL for image processing (Pixel Bender)

24

Page 25: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What have we got?

DSL for image processing (Pixel Bender)

JIT compiler / optimizer

25

Page 26: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What have we got?

DSL for image processing (Pixel Bender)

JIT compiler / optimizer

Runtime – enforces programming model, allows graphs

26

Page 27: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What have we got?

DSL for image processing (Pixel Bender)

JIT compiler / optimizer

Runtime – enforces programming model, allows graphs

High performance on parallel hardware (using OpenGL)

27

Page 28: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What have we got?

DSL for image processing (Pixel Bender)

JIT compiler / optimizer

Runtime – enforces programming model, allows graphs

High performance on parallel hardware (using OpenGL)

Future proof against new hardware

28

Page 29: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What have we got?

DSL for image processing (Pixel Bender)

JIT compiler / optimizer

Runtime – enforces programming model, allows graphs

High performance on parallel hardware (using OpenGL)

Future proof against new hardware

Cross platform

29

Page 30: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What cross platform means to Adobe

Mac

Windows

AMD

Intel

nVidia

CPU

GPU

Mobile hardware

30

Page 31: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What have we got?

DSL for image processing (Pixel Bender)

JIT compiler / optimizer

Runtime – enforces programming model, allows graphs

High performance on parallel hardware (using OpenGL)

Future proof against new hardware

Cross platform

31

Page 32: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What have we got?

DSL for image processing (Pixel Bender)

JIT compiler / optimizer

Runtime – enforces programming model, allows graphs

High performance on parallel hardware (using OpenGL)

Future proof against new hardware

Cross platform

OpenCL

32

Page 33: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Why not just switch entirely to OpenCL?

33

Page 34: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Why not just switch entirely to OpenCL?

Pixel Bender has certain advantages:

Ease of writing

34

Page 35: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Why not just switch entirely to OpenCL?

Pixel Bender has certain advantages:

Ease of writing

Optimization opportunities

35

Page 36: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Why not just switch entirely to OpenCL?

Pixel Bender has certain advantages:

Ease of writing

Optimization opportunities

Race free by construction

36

Page 37: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Why not just switch entirely to OpenCL?

Pixel Bender has certain advantages:

Ease of writing

Optimization opportunities

Race free by construction

Parallelism for the masses

37

Page 38: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Warning.

Increased speculation

ahead.

38

Page 39: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender has certain disadvantages:

One fixed programming model

Focuses on image processing

Not general enough

39

Page 40: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Framework

40

Inputs Framework Outputs

Page 41: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Framework

41

Inputs Framework Outputs

Page 42: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Michael McCool’s parallel programming patterns

Gather

Map

Reduce

Superscalar sequences

Pipeline

Nesting

Scans

Recurrences

Search

Subdivision

Stencil

Scatter

Pack

Selection

Partition

Expand

42

Page 43: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What are we going to do about it?

43

Page 44: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Internal customers

44

Page 45: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

External customers

45

Page 46: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

References

Pixel Bender

http://www.adobe.com/devnet/pixelbender.html

http://blogs.adobe.com/pixel-bender/

http://blogs.adobe.com/kevin-goldsmith/tag/pixel-bender-2

Structured Parallel Programming with Deterministic Patterns

Michael D. McCool http://software.intel.com/file/27160

Patterns for Parallel Programming

Mattson, Sanders & Massingill

46

Page 47: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Page 48: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 4

8

Pixel Bender programming model

Write a function that produces a

single output pixel

Page 49: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 4

9

Pixel Bender programming model

Page 50: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 5

0

Pixel Bender programming model

Page 51: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 5

1

Pixel Bender programming model

Page 52: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 5

2

Pixel Bender programming model

Page 53: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Page 54: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Why Pixel Bender?

2001 programmable shading units on the GPU

2005 dual core CPUs

2005 AIF team formed

2006 quad core CPUs

2006 AMD announces CTM

2008 OpenCL

2011 fusion chips

54

Page 55: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Pixel Bender History

2001 programmable shading units on the GPU

2005 dual core CPUs

2005 AIF team formed

2006 quad core CPUs

2006 AMD announces CTM

2007 After Effects CS3 replaces GLSL code with Pixel Bender

2007 Flash Player 10 Announced including Pixel Bender support

2008 OpenCL

2008 After Effects CS4 - first CPU implementation, 3rd party plug-ins, Pixel Bender Graph language announced

2008 Photoshop CS4 – Pixel Bender plug-in released

2010 Pixel Bender commercial plug-ins start to appear en masse

2010 Flash Player Molehill Announced – Pixel Bender 3D

2011 fusion chips

55

Page 56: Pixel Bender - Home - AMDdeveloper.amd.com/wordpress/media/2013/06/2903_2_final.pdfDecide if a Pixel Bender node runs on the GPU or CPU Order the execution of each node Drives Optimization

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Disclaimer & Attribution

The information presented in this document is for informational purposes only and may contain technical inaccuracies, omissions and typographical errors.

The information contained herein is subject to change and may be rendered inaccurate for many reasons, including but not limited to product and roadmap changes, component and motherboard version changes, new model and/or product releases, product differences between differing manufacturers, software changes, BIOS flashes, firmware upgrades, or the like. There is no obligation to update or otherwise correct or revise this information. However, we reserve the right to revise this information and to make changes from time to time to the content hereof without obligation to notify any person of such revisions or changes.

NO REPRESENTATIONS OR WARRANTIES ARE MADE WITH RESPECT TO THE CONTENTS HEREOF AND NO RESPONSIBILITY IS ASSUMED FOR ANY INACCURACIES, ERRORS OR OMISSIONS THAT MAY APPEAR IN THIS INFORMATION.

ALL IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. IN NO EVENT WILL ANY LIABILITY TO ANY PERSON BE INCURRED FOR ANY DIRECT, INDIRECT, SPECIAL OR OTHER CONSEQUENTIAL DAMAGES ARISING FROM THE USE OF ANY INFORMATION CONTAINED HEREIN, EVEN IF EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

AMD, the AMD arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. All other names used in this presentation are for informational purposes only and may be trademarks of their respective owners.

The contents of this presentation were provided by individual(s) and/or company listed on the title page. The information and opinions presented in this presentation may not represent AMD’s positions, strategies or opinions. Unless explicitly stated, AMD is not responsible for the content herein and no endorsements are implied

56