steve teixeira director of program management, visual c++ microsoft corporation visual c++ and the...
TRANSCRIPT
Steve TeixeiraDirector of Program Management, Visual C++Microsoft Corporation
Visual C++ and the Native Renaissance
What we’ll talk about today
The C++ Renaissance is real and it includes you
There are some interesting trends driving the Renaissance
Visual C++ in Dev11 will help you capitalize on these trends
We’ll dive deep into a few choice topics
renaissance (n.)1. a movement or period of vigorous
artistic and intellectual activity2. rebirth, revival
Source: http://www.m-w.com
What’s in a Renaissance?
An explosion of creativity, innovation, growth
New innovators
New projects
Intense learning; teachers becoming students
What is Driving the C++ Renaissance?
The new relevance of
cross-platform
Experience expectation
Hardware evolution
New productivity
gains
Mobile devices
Graphics, physics, touch,
gesture
GPU, vector, sensors
C++11, modern tools,
perf-orientation
C++ developers: Old guys with beards?
18
21
24
27
30
33
36
39
42
45
48
51
54
57
60
63
66
69
75
80
84
88
92
0 20 40 60 80 100 120 140 160
COUNT
AG
E
Source: Microsoft
Age of C++ projects
10+ years
5-9 years
0-4 years
0% 10% 20% 30% 40% 50% 60%
Source: Microsoft
Types of new C++ projects
Source: Microsoft
Gaming; 20%
Engr/Sci-ence; 15%
Frameworks; 12%Business; 10%
Embedded; 8%
Productivity; 8%
Imaging; 7%
Content; 7%
Other; 13%
Why Developers Choose C++
Close-to-the hardwarePerformance, efficiency, controlReal-to-life experiences; faster time-to-answer
Cross-platformOther compilers, other OSesMaximize ROI
CompatibleExisting source, experienceOther programming languages
Mobile is driving cross-platform
Old pattern:Write once, run mediocre everywhere
New pattern:Platform code in platform language (Objective-C, Java, C++/CX)Cross-platform code in C++ or HTML5/JavaScript
Best experience = Platform programming modelWe no longer operate in a keyboard/monitor/mouse world
Windows 8:C++ and Metro using C++/CX
Windows Phone 8: Finally, C++!
The new relevance of
cross-platform
Mobile devices
Windows 8 developer platform
C++ in a Metro-style world
XAML-based C++ applicationsXAML user interfaceC++ code
DirectX-based applications and gamesDirectX user interface (2D or 3D)C++ code
Hybrid applicationsHTML5/JavaScript front-end calling C++ WinRT components
The new relevance of
cross-platform
Mobile devices
C++/CX (Component eXtensions)
Set of language extensions and libraries to allow direct consumption and authoring of Windows Runtime types.
Strongly-typed system for Windows RuntimeAutomatically reference countedException-basedDeep integration with STLWell defined binary contract across module boundaries
The new relevance of
cross-platform
Mobile devices
demo
Mixing C++ and C++/CX
C++ enables experience realism
Sweet spot: Immersive, graphically rich appsBuilding games and “game-ified” apps:
DirectX + MetroManage images, textures, assetsModels and meshesWrite shaders in HLSLVisual shader designerGraphics debugging
Experience expectation
Graphics, physics, touch,
gesture
Images / textures
32-bit!Channels!Paint toolsFiltersModern image formats
PNG, JPG, GIF, BMP, TIFFDirect Draw Surface (DDS)
MIP maps
Experience expectation
Graphics, physics, touch,
gesture
Models / meshes
Inspect modelsFBX, X, OBJ
Camera controlsExperiment & Learn
Basic shapesTransforms (e.g. scale)
Experience expectation
Graphics, physics, touch,
gesture
Pixel Shaders
Visual designerIntermediate renderingExport to HLSLReal-time renderingUse with models
Experience expectation
Graphics, physics, touch,
gesture
Graphics debugger
D3D11 / D3D11.1Event historyPixel historyCall stackObject tableObject visualizationCustom events
Experience expectation
Graphics, physics, touch,
gesture
demo
Journal:Immersive experiences with C++
C++, evolving with hardware
1975-2005Put a computer on every desk, in every home, in every pocket.
2005-2011Put a parallel supercomputer on every desk, in every home, in every pocket.
2011-201xPut a heterogeneous local & distributed parallel supercomputer on every desk, in every home, in every pocket.
Welcome tothe jungle
The free lunchis so over
Hardware evolution
GPU, vector, sensors
C++, the modern system language
Automatic loop vectorizationImproved Parallel Pattern Library (PPL)Support for ARM hardwareGPGPU with C++AMPEnhanced parallel debugging and profiling
Hardware evolution
GPU, vector, sensors
What’s “Vector”
+
r1 r2
r3
add r3, r1, r2
SCALAR(1 operation)
v1 v2
v3
+
vectorlength
vadd v3, v1, v2
VECTOR(N operations)
Hardware evolution
GPU, vector, sensors
Vector machine instructions
B[0] B[1] B[2] B[3]
A[0] A[1] A[2] A[3]
A[0] + B[0] A[1] + B[1] A[2] + B[2] A[3] + B[3]
+
xmm1
xmm0
“addps xmm1, xmm0 “
xmm1
Hardware evolution
GPU, vector, sensors
for (i = 0; i < 1000; i++){
C[i] = A[i]+B[i]}
for (i = 0; i < 1000; i+=4){
C[i:i+3] = A[i:i+3]+B[i:i+3]}
Modern CPU layout
SCLRUNIT
VECTUNIT
VECTUNIT
VECTUNIT
VECTUNIT
SCLRUNIT
SCLRUNIT
SCLRUNIT
Hardware evolution
GPU, vector, sensors
Modern CPU layout
SCLRUNIT
VECTUNIT
VECTUNIT
VECTUNIT
VECTUNIT
SCLRUNIT
SCLRUNIT
SCLRUNIT
Hardware evolution
GPU, vector, sensors
PPL & ParallelismLoop vectorizationTask-based parallelism
task<T>compose: then()join: when_all()choice: when_any()
Algorithmspartitionerstransformreducesorts
Containersunordered map, multimap, set, multiset
Windows 8 async
How?
// composing with order dependencies
task<void> a([=]() {DoSomething();});
a.then([=]() {DoSomethingElse();));
// choice & join
auto t = t1 || t2; // same as when_any
auto t = t1 && t2; // same as when_all
demo
Task graphs
C++ AMP
Heterogeneous platform supportPart of Visual C++ Visual Studio integrationSTL-like library for multidimensional data Builds on DirectXIs an open specification
performance
portabilityproductivity
Hardware evolution
GPU, vector, sensors
Basic Elements of C++ AMP coding
void AddArrays(int n, int * pA, int * pB, int * pC){ array_view<int,1> a(n, pA); array_view<int,1> b(n, pB); array_view<int,1> sum(n, pC); parallel_for_each(
sum.extent, [=](index<1> idx) restrict(amp) { sum[idx] = a[idx] + b[idx];
} );}
array_view variables captured and associated data copied to accelerator (on demand)
restrict(amp): tells the compiler to check that this code can execute on Direct3D hardware (aka accelerator)
parallel_for_each: execute the lambda on the accelerator once per thread
extent: the number and shape of threads to execute the lambda
index: the thread ID that is running the lambda, used to index into data
array_view: wraps the data to operate on the accelerator
Hardware evolution
GPU, vector, sensors
C++AMP performance knobs
Schedule threads in tilesAvoid thread index remappingGain ability to use tile static memory
0 1 2 3 4 5
0
1
2
3
4
5
6
7
0 1 2 3 4 5
0
1
2
3
4
5
6
7
g.tile<2,2>()g.tile<4,3>()
array_view<int,2> data(8, 6, p_my_data);parallel_for_each( data.grid.tile<2,2>(), [=] (tiled_index<2,2> t_idx)… { … });
Hardware evolution
GPU, vector, sensors
demo
C++ AMP
A new focus on C++ productivity
C++11 standard makes writing (and reading!) C++ fun againIDEs and tool chains have dramatically improvedNew realization: time-to-done is more important than time-to-first-check-in
New productivity
gains
C++11, modern tools,
perf-orientation
“The going word at Facebook is that ‘reasonably written C++ code just runs fast,’ which underscores the enormous effort spent
at optimizing PHP and Java code. Paradoxically, C++ code is more difficult to write than in other languages, but efficient code is a lot
easier.” – Andrei Alexandrescu
Modern C++: clean, safe, fast
auto p = make_shared<circle>( 42 );
vector<shared_ptr<shape>> vw = load_shapes();
for(auto s: vw) if( s && *s == *p ) cout << *s << “ is a match\n”;} );
circle* p = new circle( 42 );vector<shape*> vw = load_shapes();for( vector<circle*>::iterator i = vw.begin();
i != vw.end(); ++i ){ if( *i && **i == *p ) cout << **i << “ is a match\n”;}for( vector<circle*>::iterator i = vw.begin(); i != vw.end(); ++i ) { delete *i;}delete p;
Then Now
T* shared_ptr<T>
new make_shared
no need for “delete”
automatic lifetime management
exception-safe
for/while/do range-based for
loops
auto type deduction
not exception-safe
missing try/catch, __try/__finally
New productivity
gains
C++11, modern tools,
perf-orientation
Visual Studio 11 ALM and C++
New C++ ALM features
2010 features UpdatedCode analysis (x64 support added!)Code coverage
Architecture ToolsDependency DiagramsArchitecture Explorer
Unit TestingC++ Unit Test FrameworkManage and Run tests in VS
New ALM features
User Story/Product Backlog mgmtLightweight RequirementsSprint planning, Taskboards planningContext SwitchingStakeholder FeedbackCode ReviewExploratory Testing
New productivity
gains
C++11, modern tools,
perf-orientation
VS IDE Enhancements
Improved Solution Explorer Project Compatibility with VS2010 Sp1 projectsFind commands quickly using Quick LaunchNew Find and Replace ControlSimplified Toolbars remove clutterSearch everywhere including Toolbox and Add Ref. Dialog
New productivity
gains
C++11, modern tools,
perf-orientation
C++ specific IDE Enhancements
Code Understanding enhancementsReference Highlighting Semantic Colorization
Code Editing enhancementsC++/CLI IntellisenseAutomatic Display of IntelliSense Member ListMember List FilteringCode Snippets
New productivity
gains
C++11, modern tools,
perf-orientation
What’s next?Continuing the Renaissance
http://msdn.microsoft.com/en-us/devlabs/casablanca
Casablanca Enables
Client access to REST services using modern C++
Writing Azure-based and on-premises REST services in modern C++
Composing asynchronous libraries in C++
Using the proven actor design pattern in C++
demo
Project Casablanca:C++ and the Cloud
Async File I/O
TimersBinary
Serializers
JSONParser & Writer
Azure / IIS Host Windows Host
Windows 7 / 8
IOCPPPLWinHTTP
HTTPClient & Listener
TCPClient & Listener
Web SocketsClient & Listener
UDPClient & Listener
Apps & Libraries
Azure Storage
Windows Live
XboxLive
C++Actors
BingMaps
Architecture
Foundation
Casablanca Lib
Service Host
Possible 3rd Party
C++ Cloud Scenarios
Performance-intensive servicesSignal processing (media search, codecs)Entertainment (rendering, game servers)Massive-scale services (search, social, etc.)Science/engineering (CFD, big math, weather, etc.)
Re-platforming server apps on the cloudRetrofit for manageability, scalability, fault tolerance, asynchronyISV (Database, email, video/telephony, gaming, etc.)LOB services
REST-ful clientsConsuming REST-ful services from C++ applicationsBuilding device+cloud experiences with Windows Azure
What is Driving the C++ Renaissance?
The new relevance of
cross-platform
Experience expectation
Hardware evolution
New productivity
gains
Mobile devices
Graphics, physics, touch,
gesture
GPU, vector, sensors
C++11, modern tools,
perf-orientation
Q&A
Related Content
DEV316: Application Lifecycle Management Tools for C++ in VS 2012
DEV334: C++ Accelerated Massive Parallelism in Visual C++ 2012
DEV367: Building Windows 8 Metro-style Apps with C++
PRC08: C++ in Visual Studio 2012: Modern, Readable, Safe, Fast
DEV Track Resources
Visual Studio Home Page :: http://www.microsoft.com/visualstudio/en-us
Jason Zander’s Blog :: http://blogs.msdn.com/b/jasonz/
Facebook :: http://www.facebook.com/visualstudio
Twitter :: http://twitter.com/#!/visualstudio
Somasegar’s Blog :: http://blogs.msdn.com/b/somasegar/
VC++ Team Blog :: http://blogs.msdn.com/b/vcblog/
Resources
Connect. Share. Discuss.
http://europe.msteched.com
Learning
Microsoft Certification & Training Resources
www.microsoft.com/learning
TechNet
Resources for IT Professionals
http://microsoft.com/technet
Resources for Developers
http://microsoft.com/msdn
Evaluations
http://europe.msteched.com/sessions
Submit your evals online
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date
of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.