pt-4056, harnessing heterogeneous systems using c++ amp – how the story is evolving, by boby...

22
C++ AMP V2 BOBY GEORGE PROGRAM MANAGER, MICROSOFT CORP

Upload: amd-developer-central

Post on 05-Dec-2014

981 views

Category:

Technology


0 download

DESCRIPTION

Presentation PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George, at the AMD Developer Summit (APU13) November 11-13, 2013.

TRANSCRIPT

Page 1: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

C++ AMP V2BOBY GEORGE

PROGRAM MANAGER, MICROSOFT CORP

Page 2: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

2 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

HARNESSING HETEROGENEOUS SYSTEMS USING C++ AMP

Introduction

Updates•Performance•Productivity•Portability

Future

Page 3: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

Motivation

How to achieve performance without

compromising productivity?

Page 4: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

4 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

C++ AMP TIMELINE

2011

• Introduced @ AMD Fusion Summit 11

• Announced C++ AMP open specification

2012

• C++ AMP V1 released

• Open Spec V1 released

2013

• C++ AMP V2 released

• Support in additional compilers

Page 5: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

5 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

C++ ACCELERATED MASSIVE PARALLELISM (C++ AMP)

What is C++ AMP?

‒ Programming model for expressing data parallel algorithms

‒ Exploit heterogeneous systems using mainstream tools

‒ Just C++ code, consisting of a language extensions and libraries

What C++ AMP gives you?

‒ Productivity: Write C++ code that runs on heterogeneous systems

‒ Portability: Write code once and run on various hardware\platforms

‒ Performance: Write C++ code that accelerate massively

INTRODUCTION

C++ Data Parallelism

Microsoft C++ AMP

Page 6: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

6 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

CODE INTRODUCTIONSEQUENTIAL C++ CODE

1. #include <iostream>2.3.

4. int main()5. {6. int v[11] = {'G', 'd', 'k', 'k', 'n', 31, 'v', 'n', 'q', 'k', 'c'};

7.8. for (int idx = 0; idx < 11; idx++)9. {10. v[idx] += 1;11. }

12. for(unsigned int i = 0; i < 11; i++)13. std::cout << static_cast<char>( v[i]);14. }

Page 7: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

7 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

CODE INTRODUCTIONC++ AMP CODE

1. #include <iostream>2. #include <amp.h>3. using namespace concurrency;

4. int main()5. {6. int v[11] = {'G', 'd', 'k', 'k', 'n', 31, 'v', 'n', 'q', 'k', 'c'};

7. array_view<int> av(11, v);8. parallel_for_each(av.extent, [=](index<1> idx) restrict(amp)9. {10. av[idx] += 1;11. });

12. for(unsigned int i = 0; i < 11; i++)13. std::cout << static_cast<char>(av[i]);14. }

array_view: wraps the data to operate on the accelerator. array_view variables captured and associated data copied to accelerator (on demand)

parallel_for_each: execute the lambda on the accelerator once per thread

extent: the parallel loop bounds or computation “shape”

index: the thread ID that is running the lambda, used to index into data

restrict(amp): tells the compiler to check that code conforms to C++ subset, and tells compiler to target GPU

Concept Count (5)

Page 8: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

8 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

MAPPING TO HARDWARE

Data

Parallelism

MulticoreCPU

GPU

Vecto

r Lanes

Page 9: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

DEMO

Page 10: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

10 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

SO WHO IS USING IT?

Page 11: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

Updates

Page 12: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

12 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

PERFORMANCE

Support for Shared Memory Architecture in Visual Studio 2013

pro

ble

m s

ize

in m

ult

iple

s o

f 1

02

4

execution time in milliseconds

Page 13: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

13 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

PERFORMANCE \ PRODUCTIVITY

Enhanced Texture Functionality in Visual Studio 2013

‒ Already used to develop portable 3D Face Scanner

Page 14: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

14 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

PRODUCTIVITY

Tooling Updates

‒ Side by Side CPU\GPU debugging for WARP accelerator

‒ C++ AMP GPU debugging on Windows 7 and Server 2008 R2

‒ Remote GPU hardware debugging on NVIDIA GPUs

Runtime\Library Updates

‒ Array_view API improvements

‒ C++ AMP runtime improvements like faster texture copying

‒ Added scan algorithms to C++ AMP Algorithms Library

Page 15: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

15 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

PORTABILITY

C++ AMP is a high level language

Announcing…‒ C++ AMP support in CLANG

‒ Via LLVM targeting HSAIL & Khronos SPIR 1.2

‒ AMD is the project sponsor

‒ Attend Ben Sander’s talk for more details

‒ Objectives

‒ Offers consistent C++ AMP programming model across hardware and platforms

‒ Open source work to seed additional support on other compilers and hardware

‒ Microsoft’s Engagement

‒ Collaboration with AMD for design and validation inputs

‒ Preview bits @ https://bitbucket.org/multicoreware/cppamp-driver/

Visual Studio will continue to offer premier C++ AMP dev experience

C++ AMP

DirectComputeKhronosSPIR 1.2

HSAIL

Hardware

Page 16: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

16 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

PORTABILITY

Announcing PathScale ENZO 2014

‒ Targets NVIDIA hardware directly for higher performance

‒ Plans to target AMD hardware and Windows platform

‒ Currently in Private Beta testing phase

Complete the picture…

C++ AMP

DirectComputeKhronosSPIR 1.2

HSAIL

Hardware

Native Code Generation

Your favorite compiler

Page 17: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

Future

Page 18: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

18 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

C++ AMP GROWTH CHART

VS 2012 VS 2013 VS Next End Goal

Performance

Productivity

Portability

Page 19: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

19 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

PERFORMANCE

Support Shared Virtual Memory Architectures

More performant CPU accelerator

Convergence of CPU\GPU parallelization technology

Page 20: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

20 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

PRODUCTIVITY

Convergence of platforms

‒ Write code once and run across multiple platforms

Enhanced tooling support

Continue to invest in parallel algorithms

Page 21: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

21 | PRESENTATION TITLE | NOVEMBER 19, 2013 | CONFIDENTIAL

PORTABILITY

ISO standardization of C++ AMP features like multidimensional arrays, extend etc..

Update Open Specification to latest version of C++ AMP in Visual Studio

‒ Open Specification v1.2 to be released by November 2013

Engage with partners for C++ AMP implementation on non Microsoft technologies

Page 22: PT-4056, Harnessing Heterogeneous Systems Using C++ AMP – How the Story is Evolving, by Boby George

22 | PRESENTATION TITLE | NOVEMBER 19, 2013 | 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. AMD assumes no obligation to update or otherwise correct or revise this information. However, AMD reserves the right to revise this information and to make changes from time to time to the content hereof without obligation of AMD to notify any person of such revisions or changes.

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 MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT WILL AMD BE LIABLE TO ANY PERSON FOR ANY DIRECT, INDIRECT, SPECIAL OR OTHER CONSEQUENTIAL DAMAGES ARISING FROM THE USE OF ANY INFORMATIONCONTAINED HEREIN, EVEN IF AMD IS EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

ATTRIBUTION

© 2013 Advanced Micro Devices, Inc. All rights reserved. AMD, the AMD Arrow logo and combinations thereof are trademarks of Advanced Micro Devices, Inc. in the United States and/or other jurisdictions. SPEC is a registered trademark of the Standard Performance Evaluation Corporation (SPEC). Other names are for informational purposes only and may be trademarks of their respective owners.