C++ + r1 r2 r3 add r3, r1, r2 SCALAR (1 operation) v1 v2 v3 + vector length vadd v3, v1, v2 VECTOR (N operations)

Post on 23-Dec-2015

243 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

Favorite Things for C++ Developers in Visual Studio 2013 Eric BattalioSenior Program Manager, Microsoft

DEV-B223

Worst kept secretsPerformancePortabilityCompatibility

Best Kept SecretsPick up arcane new skillsCreate support toolsConsume shared code librariesSupport hybrid devicesAccess to native codeBoundary-pushing apps

Tuning a managed applicationCode maintenanceCross platformPorting code to a new applicationGraphics

“It’s fun!”

C++

Windows 8.1PerformanceLanguage and LibrariesEditor and IDECommunity

C++

Windows 8.1PerformanceLanguage and LibrariesEditor and IDECommunity

Improvements to C++/CXBoxed TypesOverriding ToString()Improved WinRT ExceptionsFaster PerformanceImproved C++/CX Collections

Universal App Templates for C++Windows Runtime ComponentDirectXDirectX and XAML

Better XAML DesignerNew and updated templatesImproved designer performanceNew Windows 8.1 controlsRulers and dynamic guidesIn-place editingGo To Definition

Graphics ToolsGetting StartedProject Templates (+Windows Phone), Item Templates

Graphics Assets AuthoringImage Editor, Model Editor, Shader Designer, Content Pipeline, Compile HLSL in VS

Graphics DiagnosticsGraphics Debugger (+Windows Phone Apps), Graphics Profiler (+Graphics Frame Analysis)

Graphics DiagnosticsVS 2013 RTMRemote debuggingCompute shader debuggingAvailable in VS Express for Windows!

VS 2013 Update 2Consecutive captureProgrammatic captureEnhanced Event ListDebugging Windows Phone 8.1 appsGraphics Frame Analysis

Diagnostic HubXAML UI responsiveness profilingEnergy profilerCPU profilingMemory profiling

Debugging Goodness“Just My Code” for C++Improved Async debuggingJavaScript/C++ interop debuggingARM crash dump debugging

X

Demo

Graphics Diagnostics

C++

Windows 8.1PerformanceLanguage and LibrariesEditor and IDECommunity

Performance Optimizations Recap

Compilation Unit/O2 and friends

.cpp

.cpp .obj

.obj

.exe

.cpp

.cpp .obj

.obj

.exe

.cpp

.cpp .obj

.obj

.exe

Run TrainingScenario

s

.exe

Whole Program/GL and /LTCG

Whole Program/LTCG:PGI and /LTCG:PGO

Automatic VectorizationVisual Studio 2012Uses “vector” instructions where possible in loops.

Visual Studio 2013 adds more!Statement level vectorizationPermutation of perfect loop nestsRange propagation optimizationsReductions into array elements__restrict support for vector alias checkingImprovements to data dependence analysisC++ pointer vectorizationGather / scatter optimizationsSupport for more operations: min/max, converts, shifts, byteswap, averaging

+

r1 r2

r3

add r3, r1, r2

SCALAR(1 operation)

v1 v2

v3

+

vectorlength

vadd v3, v1, v2

VECTOR(N operations)

Automatic Vectorization// STL – pointers everywhere; not even a loop counter variablevoid transform1(int const* first1, int const* last1, int const* first2, int* result) { while (first1 != last1) { //converted to integer *result++ = *first1++ + *first2++; // make these array references }}// DirectX – no loops here! Vectorize operations on adjacent memory cellsXMVECTOR four_vector_example(XMVECTOR V) { XMVECTOR Result;    Result.vector4_f32[0] = 1.f / V.vector4_f32[0];    Result.vector4_f32[1] = 1.f / V.vector4_f32[1];    Result.vector4_f32[2] = 1.f / V.vector4_f32[2];    Result.vector4_f32[3] = 1.f / V.vector4_f32[3];    return Result;}// Machine Vision Libraryvoid machine_vision_filter_example (int* A, int boxStart) { for (int i = 0; i < 100; i++) A[boxStart + i] = A[boxStart + i] + 1;}

C++ AMPVisual Studio 2012 experienceProgramming model for heterogeneous computingAllowed C++ code to run on the GPU for general-purpose computationSTL-like library for multidimensional data

Visual Studio 2013 adds:Shared memory support to eliminate/reduce copying of data between CPU and GPUEnhanced texture support: texture sampling, mipmap support and staging texturesC++ AMP debugging on Win7 and side-by-side CPU/GPU debuggingFaster C++ AMP runtime: improved copy performance, reduce launch overheadBetter DirectX interop supportImproved C++ AMP runtime diagnosticsImprovements to array_view APIs

C++ AMP – Easy Peasy!#include "amp.h"using namespace concurrency;

void square_array(float* arr, int n){ // Create a view over the data on the CPU array_view<float, 1> dataView(n, &arr[0]);

// Run code on the GPU parallel_for_each(dataView.extent, [=](index<1> idx) restrict(amp) { dataView[idx] = dataView[idx] * dataView[idx]; });

// Copy data from GPU to CPU dataView.synchronize();}

Improved Compiler ThroughputEliminated bottlenecks in the writing of PDB filesAround 10% performance improvement in both /MP and non-/MP builds

Header file lookup has been made more efficientMajor performance gains in compiling large projects with lots of headersSpeedup is even greater on machines with many cores and SSDs

Demo

C++ AMP

C++

Windows 8.1PerformanceLanguage and LibrariesEditor and IDECommunity

Visual C++ Conformance UpdateVC++ Nov 2013 CTP

High confidence

Med confidence

VC++ CTP.next(upcoming)

initializer_listsint main(){ std::map<int, int> m { { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 } };}

Raw String Literalsvoid f(){ char* p = "\"Hello, world!\""; char* q = R"("Hello, world!")"; char* r = R"("Hello, """""""" world!")"; char* s = R"("Hello, \ \ \ \ \ world!")"; char* p = R"("Hello, many-lined world!")";}

Uniform Initializationvoid f(){ int x = 0; int y(0); int z{0};}

= deleteclass NonCopyable{public: NonCopyable() { /* ... */ }

NonCopyable(NonCopyable const&) = delete; NonCopyable& operator=(NonCopyable const&) = delete;};

= defaultclass C{public: C(int x) { /* ... */ } C() = default;};

C99 Designated Initializerstypedef struct S { int x; int y; int z; } S;

void f(){ S a = { .x = 1, .y = 2, .z = 3 };}

C99 Mixed Declarations and Statementsint f(){ int x = foo(); if (x != 0) return -1;

int y = bar(); if (y != 0) return -1;

return 0;}

Why C99 Support?

C++ Standard LibraryContainers support the C++11 fine-grained type requirementsSupport for several C++14 Features:Transparent operator functors (less<>, greater<>, plus<>, etc.)std::make_unique<T>(args…) and std::make_unique<T[]>(n)cbegin(), cend(), rbegin(), rend(), and crbegin(), crend() non-member functions

Improved performance in <atomic>Stabilization and bug fixes in <type_traits>

C Standard LibraryImplemented most of the missing C99 library functionalitymath.h, complex.h, fenv.h, and float.h math functionsinttypes.h format specifier macros and conversion functionsstdio.h: vscanf, vfscanf, vsscanfstdlib.h: atoll, strtof, strtold, strtoll, strtoullwchar.h: vwscanf, vfwscanf, vswscanf, wcstof, wcstold, wcstoll, wcstoull

A few C99 library features still not yet implementedprintf/scanf length modifiers, snprintf and snwprintf, a few other thingsBut we’re actively working on these remaining features

Parallel STLWorking draft, Technical Specification for C++ Extensions for ParallelismA proposal to add high-level parallel algorithms to ISO C++Prototype available, https://parallelstl.codeplex.com/

Parallel STLstd::sort(v.begin(), v.end());

std::experimental::parallel::sort(par, v.begin(), v.end());

ATL and MFC (wut?)Removed the ATL DLL entirelyDeprecated support for the MBCS MFCRecommendation is to move applications to UnicodeFixed 105 MFC bugs; 60 ATL bugs

C++ REST SDKCloud-based client-server communications libraryConnecting and interacting with RESTful servicesAsynchronous for fast, fluid appsUses modern C++11 patternsCross-platform

What is included?HTTP Client, JSON Library, and asynchronous streams and buffers

NuGet

Demo

NuGet

C++

Windows 8.1PerformanceLanguage and LibrariesEditor and IDECommunity

Code FormattingOver 40 new settings to control when and how your C++ code is formatted.Turn off individual options or all of them.

Enhanced ScrollbarProvides visual cues about source on vertical scrollbarQuickly locate errors, warning, bookmarks, etc.

No need to scroll away to see matches!

Peek DefinitionView, edit and move around inside the definition file while keeping your place in the original code.

IntelliSense TweaksMember List windowHides private members of types, except when you're editing code that defines the type.

Parameter Help tooltip Automatically switch to the best matching overload based on the number of parameters you've typed thus far

Rename Refactor Helper ExtensionMore intelligent find/replace!Open to feedback and improvement suggestions.Grab it on the Visual Studio Gallery.

Send a SmileSomething delighting or bugging you? Let us know quickly with just a few clicks!

Switching configurations in the property pages makes this weird glitch happen :(

Crashes on empty project C++ when IntelliSense should come up...

****ing C++ lang, that is bugging me all the time

Thanks for amazing tool to write c++ apps!

std::vector<std::string> v = { "a", "b", "c" }; initializer for std collections

Thanks a lot, xoxoxo

Error C2227 is not in the help files, off or online.

Demo

Editor Awesomeness

C++

Windows 8.1PerformanceLanguage and LibrariesEditor and IDECommunity

C++ CommunityConnect with othersDiscover new tips and tricksShare your knowledge and experienceJoin (or create) a user group

C++ MVPsActive in the communityStrong developers and C++ wieldersProvide feedback directly to product group

Nominate a peer...or yourself!

Suggest and vote for featuresWe want your suggestions, help us improve Visual Studio and Visual C++Visit Visual C++ on User Voice http://aka.ms/UserVoiceVisualCPP

Found a bug? Let us knowReport a bug on our Connect site, http://aka.ms/VisualStudioConnect

Demo

Community Goodness

C++ Scenarios for C# Developers, DEV-B371

Debugging Tips and Tricks in Visual Studio 2013, DEV-B352

Related content

What's New in Microsoft Visual Studio 2013 for C++ Developers, DEV-H223

Find me later in the Visual Studio booth, on Twitter @visualc or at ebattali@Microsoft.com

Visit the Developer Platform & Tools BoothHaving a friend buy your coffee?Yea, it’s kind of like that.

MSDN Subscribers get up to $150/mo in Azure credits.

Stop by the Developer Platform and Tools booth and visit the MSDN Subscriptions station to activate your benefits and receive a gift!

http://aka.ms/msdn_teched

3 Steps to New Gear! With Application Insights

1. Create a Visual Studio Online account http://visualstudio.com

2. Install Application Insights Tools for Visual Studio Online http://aka.ms/aivsix

3. Come to our booth for a t-shirt and a chance to win!

VSIP QR Tag Contests Visit our booth to join the hunt for cool prizes!

ResourcesMicrosoft Engineering Stories

How Microsoft Builds Softwarehttp://aka.ms/EngineeringStories

Visual Studio Industry Partner Program

Meet Our New Visual Studio Online Partners or Join Now.http://vsipprogram.com

Visual Studio | Integrate

Create Your Own Dev Environmenthttp://integrate.visualstudio.com

Development tools & services for teams of all sizeshttp://www.visualstudio.com

Complete an evaluation and enter to win!

Evaluate this session

Scan this QR code to evaluate this session.

© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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