for (i = 0; i < 1024; i++) c[i] = a[i]*b[i]; for (i = 0; i < 1024; i+=4) c[i:i+3] =...
Post on 16-Dec-2015
226 Views
Preview:
TRANSCRIPT
What's New in Visual C++ 2012
Rong LuProgram ManagerVisual C++ teamMicrosoft Corporation
Agenda
Performance and C++
Modern C++
Build metro style apps
It’s all about Productivity
Agenda
Performance and C++
Modern C++
Build metro style apps
It’s all about Productivity
Performance and C++
1.0
Power - driver at all scales: mobile, desktop, datacenter
Size - Limits on processor resources: desktop, mobile
Experience - Bigger experience on smaller hardware
Things have changed. Performance is king
again.
How do I speed up the code?
VC11 Compiler makes easier• Auto-Vectorization• Take advantage of vector
processors on CPU• Vectorize loops and use
SSE2 instructions automatically.
• ON by default.• No code changes required.for (i = 0; i < 1024; i++)
C[i] = A[i]*B[i];
for (i = 0; i < 1024; i+=4) C[i:i+3] = A[i:i+3]*B[i:i+3];
• Auto-Parallelization• Take advantage of multi-
core• Reorganizes the loop to on
multiple threads • Not ON by default• Hint in the code
#pragma loop(hint_parallel ( N ) )
for (i = 0; i < 1024; i++) C[i] = A[i]*B[i]; N is the number of
cores you want to parallelize over
demo: Vectorization and Parellelization
VC11 Compiler makes easier (Cont’d)• C++ AMP (Accelerated Massive Parallelism)• Heterogeneous platform support• A new C++ language feature• STL-like library• Open spec
performance
productivity
portability
Part of VC11 compiler, Visual Studio integration
Builds on DirectX, one EXE runs across hardware from different vendors
Increase performance of data-parallel algorithms by offloading to hardware
accelerators. E.g. GPU.
Summary
Performance and C++
• Speed up code using VC11 compiler• Auto-Vectorization• ON by default. Just recompile your
code
• Auto-Parallelization• Utilize multi-processor and multi-core
CPUs
• C++ AMP• Offload data parallel algorithms to
hardware accelerators, e.g. GPU
Agenda
Performance and C++
Modern C++
Build metro style apps
It’s all about Productivity
Modern C++: Clean, Safe and Fast
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;
auto p = make_shared<circle>( 42 );
vector<shared_ptr<shape>> vw = load_shapes();
for_each( begin(vw), end(vw), [&]( shared_ptr<circle>& s ) { if( s && *s == *p ) cout << *s << “ is a match\n”;} );
• Then • Nownew
make_shared
T* shared_ptr<T>
no need for “delete”
automatic lifetime management
exception-safe
for/while/do std:: algorithms
[&] lambda functions
auto type deduction
not exception-safe
missing try/catch, __try/__finally
C++ 11 language featuresC++11 Core Language Features VC10 VC11
Rvalue references v2.0 v2.1*Lambdas v1.0 v1.1decltype v1.0 v1.1**
auto v1.0 v1.0static_Assert Yes Yes
Trailing return types Yes Yesnullptr Yes Yes
Strongly typed enums Partial YesForward declared enums No Yes
Standard-layout and trivial types No YesAtomics No Yes
Strong compare and exchange No YesBidirectional fences No Yes
Data-dependency ordering No Yes
C++ Libraries• STL• C++ 11 conformant• Support for new headers• <atomic>, <chrono>, <condition_variable>,
<filesystem>, <future>, <mutex>, <ratio>, <thread>.
• PPL (Parallel Pattern Library)• A rich task-based programming model that
supports asynchrony and continuations• Parallel algorithms• Concurrency-safe containers
Summary
• Modern C++ is Clean, Safe, Fast
• C++ 11 language features in VC11• Enhancement and new additions
• Libraries in VC11• C++ 11 conformant• Parallel pattern libraries (PPL)
Modern C++
Agenda
Performance and C++
Modern C++
Build metro style apps
It’s all about Productivity
Building metro style apps using C++First class support for building Windows
metro style apps using C++. XAML/C++ apps DirectX games Build your own C++ Windows runtime (WinRT)
component and access it from the language of your choice: C#, VB, JS, C++
Build metro style app using XAML/C++
Whole stack is native code
Full debugging support
(local, simulator, device)
C++ access to Windows runtime
XAML visual designer in VS
demo: Build metro style app using XAML/C++
XAML designer in VS• Object creation• Layout• Property editing• Create and reuse
resources• Configurable
design-time workspace
• XAML editor and IntelliSense
C++ for Windows runtimeA set of language extensions and libraries
to allow direct consumption and authoring of Windows runtime (WinRT) types. Strongly-typed system for Windows runtime Automatically reference counted Exception-based Deep integration with STL Well defined binary contract across module boundaries
Consume WinRT type in C++ (Code sample)void MainPage::detectButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e){// detectButton handlerFaceFileList->Clear();
WinRTComponent^ faceDetectComponent = ref new WinRTComponent();auto action = faceDetectComponent->ExtractFacesFromFilesAsync(localSrcFileVector);}
Author WinRT type in C++ (Code sample)namespace winrtfacedetect{public ref class WinRTComponent sealed{public:WinRTComponent();
IAsyncActionWithProgress<String^>^ ExtractFacesFromFilesAsync(IVector<StorageFile^>^ inFileVector);
IVector<String^>^ SearchFiles(String^ query);
private:Vector<String^>^ getPathsFromFiles(IVector<StorageFile^>^ inFileVector);};}
Build metro style games using DirectX
Debugging/Packaging support
Mesh Viewer/Shader designer
HLSL editor/ compiler
Graphics Debugging
Images / textures• Modern image formats• PNG, JPG, GIF, BMP, TIFF• Direct Draw Surface (DDS)
• 32-bit!• Channels!• Paint tools• Filters• MIP maps
Graphics debugger• D3D11 / D3D11.1• Event history• Pixel history• Call stack• Object table• Object visualization• Custom events
Models / meshes• Inspect models• FBX, X, OBJ
• Camera controls• Experiment & Learn• Basic shapes• Transforms (e.g. scale)
HLSL
Pixel Shaders• Visual designer• Intermediate rendering• Export to HLSL• Real-time rendering• Use with models
Build metro style apps
Summary• First class support in VS11 for
building Windows metro style apps using C++.• XAML/C++• DirectX• Build your own C++ WinRT
component
• C++/CX language extension for consuming and authoring Windows Runtime types.• Access C++ WinRT component
from the language of your choice: C#, VB, JS, C++
Agenda
Performance and C++
Modern C++
Build metro style apps
It’s all about Productivity
Improve development productivity using VC11
Additional C++ features• Reference Highlighting• Semantic Colorization• C++/CLI IntelliSense is
back!• Auto-display of member
list• Member list filtering• Code snippets
IDE enhancements in VS11• Solution Explorer• Project Compatibility with
VS2010 SP1 projects• Quick Launch• Find and Replace control• Simplified Toolbars• Search everywhere
Visual Studio 2012 ALM and C++
ALM features in VS 2012
Additional ALM features for C++ in VS 2012
User Story/Product Backlog mgmtLightweight RequirementsSprint planning, Taskboards planningContext SwitchingStakeholder FeedbackCode ReviewExploratory Testing
2010 features UpdatedCode AnalysisCode Coverage
Architectural DiscoveryUnit Testing
Architectural Discovery • Use dependency graphs to better understand your
code• Generate graphs for whole solution• Generate graphs for include file (C++)• It is your diagram, edit it!
• Use Architecture Explorer to browse assets and generate customized graphs
Code Analysis • Improved user experience and analysis capabilities• 64 bit support• Available in all editions• Concurrency rules (Pro+)• Customize ruleset (Pro+)
Unit Testing• New native C++ unit test framework in VS11• Author tests, manage tests and view results in VS• Available in all editions• Continuous run after build (Premium+)• Extensible: plug in 3rd party native framework to VS
(Pro+)
Code Coverage• Simplified experience and integrated with unit test
framework• Analyze code coverage by one single click in VS• For all tests• For selected tests
• Allow integration with 3rd party unit test frameworks
It’s all about Productivity
Summary• VC11 helps improve
productivity• IDE enhancements
• Solution explorer• Project compatibility with VC10• Reference highlighting• Member list filtering
• Application Lifecycle management tools• Architecture discovery tools• Unit testing• Code analysis • Code coverage
Summary• Visual C++ 2012 has a lot to offer to C++
developers:
Performance and C++
Modern C++
Build metro style apps
It’s all about Productivity
Q&Aronglu@microsoft.com
Resources • Keep up with Visual C++ team: http://blogs.msdn.com/vcblog• Deep Dives:
• A lap around Visual Studio 11 Express for Metro style apps using C++ • Using the Windows Runtime from C++ • Bringing existing C++ code into Metro style apps • Taming GPU compute with C++ AMP • Tips & tricks: how to use Visual Studio to the fullest • Writing modern C++ code: how C++ has evolved over the years • Tips and tricks for developing Metro style apps using C++ • Under the covers with C++ for Metro style apps • A lap around DirectX game development tools • First Look at the New C++ IDE Productivity Features in Visual Studio 11• ALM for C++ in Visual Studio 11• What's new in Visual Studio 11 for Application Lifecycle Management • Working on an agile team with Visual Studio 11 and Team Foundation Server 11 • Improving software quality using Visual Studio 11 C++ Code Analysis
© 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.
top related