8. Visual C++는 C++14 을 목표로 하고 있습니다. 그래서 C++11과 C++ 14
를 같이 구현하고 있습니다. 당연히 모든 표준을 구현할 것이지만
개발자에게 가장 가치 있는 기능부터 우선적으로 구현하고자 합니다.
때문에 generic lambda와 같은 C++14의 주요 기능을 C++11의 다른 기
능보다 우선적으로 구현하는 경우도 있습니다.
Herb Sutter
- Microsoft Partner Program Manager
9. // Initialize elements of an aggregate (array, struct, union)
// in any order
union
struct
int
int
int
struct // .m2==0
int
21. Performance Optimization Recap
Compilation Unit Optimizations
• /O2 and friends
Whole Program Optimizations
• /GL and /LTCG
Profile-Guided Optimizations
• /LTCG:PGI and /LTCG:PGO
22. 루프내에서만의 Vectorization을 넘어서
VS 2012:
• 루프 내에서만 “vector” instruction 사용
VS 2013 추가
• Statement level vectorization
• Permutation of perfect loop nests
• Range propagation optimizations
• Support for more operations: min/max,
converts, shifts, byteswap, averaging
• Reductions into array elements
• __restrict support for vector alias checking
• Improvements to data dependence analysis
• C++ pointer vectorization
• Gather / scatter optimizations
for (i = 0; i < 1000; i++) {
A[i] = B[i] + C[i];
}
+
r1 r2
r3
add r3, r1, r2
SCALAR
(1 operation)
v1 v2
v3
+
vector
length
vadd v3, v1, v2
VECTOR
(N operations)
Developers love C++ for its compatibility across platforms. Visual Studio 2013 continues to enhance compatibility through language enhancements.
SG 2-4: Kona, Feb 2012
SG 5: May 2012 SG 1 meeting
SG 6: around August 2012
SG 7, 8, and 9: Portland, Oct 2012
LEWG: Dec 2013
SG 10: Jan 2013
SG 11: Bristol, Apr 2013
SG 12: May 2013
Developer productivity has also improved.
NuGet is a Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects... If you develop a library or tool that you want to share with other developers, you create a NuGet package and store the package in a NuGet repository. If you want to use a library or tool that someone else has developed, you retrieve the package from the repository and install it in your Visual Studio project or solution.
Resources
NuGet on Codeplex, http://nuget.codeplex.com/
NuGet for C++ on the VCBlog, http://blogs.msdn.com/b/vcblog/archive/2013/04/26/nuget-for-c.aspx
In Visual Studio 2013, we have introduced new features that boost productivity and save time when working inside the Editor. Some of these are new features and some are the most popular extensions from Productivity Power Tools. These features are a result of the feedback you gave us through User Voice requests, forum posts and Connect bugs. The MVP community also helped us pick some of these experiences.
Our primary focus for the Editor in this version is to keep the developer in context as much as possible.
The Enhanced Scrollbar has been one of the most popular Productivity Power Tools extensions and is now part of the Visual Studio 2013 product! The Enhanced Scrollbar provides you visual cues about your file on the vertical scrollbar. Markers on the scrollbar allow you to quickly view the location of errors, warnings, breakpoints, bookmarks, find results and other useful information in your file. Here, too, we focus on bringing information to your fingertips – you don’t have to scroll away from your current position to get information about other parts of your file.
We know developers move around code a lot when browsing definitions. While designing Visual Studio 2013 features, we looked at the elements and gestures that will help developers stay in context of their code while browsing through definitions. Peek Definition is one such feature that allows you to view definitions inline in the Editor without having to open a new document tab. To see it in action, right click on a symbol and click on the “Peek Definition” command in the context menu or invoke the keyboard shortcut Alt + F12.
Part of our quest for more productive development is moving away from separate tool windows and modal dialogs towards fluid, inline experiences that keep you focused on coding rather than managing Visual Studio. We analyzed usage data and decided to update Navigate To, a widely-used feature that until now, resided in a modal dialog.
Using the new Navigate To, you type in any part of a symbol and can find its definition, using smart semantic search. You can also type in part of a file name in your solution and quickly switch to it, regardless of whether or not it was previously open.
Navigate To in Visual Studio 2013 supports all previous capabilities in a fluid, non-modal and space efficient way. We positioned the new search window around the same upper-right area as the in-editor Find. This positioning allows us to display both the preview tab and maximize the number of Navigate To results we can display on screen without blocking your view of the preview code.
Selecting a result automatically displays it in a preview tab. This helps ensure the selected result is what you're searching for, so you can make a better decision before committing to the new view. To make sure context is easily preserved, pressing Escape takes you back to your initial location if the result wasn't what you were looking for.
The Parameter Help tooltip that appears when typing parameters of an overloaded function will now automatically switch to the best matching overload based on the number of parameters you've typed thus far. And it properly handles nested function calls – when you start typing a nested function call, Parameter Help will display results relevant to the nested call, then restore the contents of the tooltip to the outer function call when you close the argument list.
[This text was grabbed from the resources listed below.]
Resources
Visual Studio 2013 New Editor Features, http://blogs.msdn.com/b/visualstudio/archive/2013/07/15/visual-studio-2013-new-editor-features.aspx
What’s New for Visual C++ Developers in Visual Studio 2013 Preview, https://tr17.techreadytv.com/sessions/DEV227.aspx
C++ IDE Improvements in Visual Studio 2013, http://blogs.msdn.com/b/vcblog/archive/2013/08/26/10443635.aspx
C++ is known for performance. With Visual Studio 2013, we have added more enhancements to make code run faster.
Modern, 64-bit processors, such as the Intel 64 and AMD64, include a set of 16 registers that perform arithmetic operations on integers. They are called scalar registers because they hold just one value at any time. We can write C++ code that adds two integer variables together. That compiler may transform the program to add those two values, using two registers. If we have 1000 pairs of integers to add together, we need to execute 1000 such additions.
However, for several years, these chips have included an additional set of 16 registers, each 128 bits wide. Rather than hold a single, 128-bit wide value, they can hold a collection of smaller values; for example, 4 integers, each 32 bits wide. They are called vector registers because they can hold several values at any one time. The chips also provide new instructions to perform arithmetic on these 4 packed integers. So we can add 4 pairs of integers with a single instruction, in the same time that it took to add just 1 pair of integers when using the scalar registers.
Vectorization, then, is the process of using these vector registers, instead of scalar registers, in an attempt to make the program run faster. In a perfect world, our example loop would execute 4 times faster, but things are rarely perfect due to overhead.
Automatic Vectorization
C++ pointer vectorization. The compiler can now recognize more opportunities to vectorize loops that use pointers to access data.
Statement level vectorization.
__vectorcall (/Gv). You can now pass vector type arguments by using the __vectorcall calling convention to use vector registers. Using the new “__vector” calling convention on the appropriate methods improves performance by reducing instruction count, and minimizes stack allocation. By using this convention, DirectX itself is running about 15% faster.
Permutation of perfect loop nests.
Resources
Jim Radigan breaks it down in his series Inside Vectorization on Channel 9, http://channel9.msdn.com/Series/C9-Lectures-Jim-Radigan-Inside-Auto-Vectorization/Jim-Radigan-Inside-Auto-Vectorization-1-of-n
Jim Hogg wrote Optimizing C++ Code: Overview on the VCBlog, http://blogs.msdn.com/b/vcblog/archive/2013/06/12/optimizing-c-code-new-title.aspx
Auto-Parallelization and Auto-Vectorization in the MSDN library, http://msdn.microsoft.com/en-us/library/hh872235.aspx
Modern, 64-bit processors, such as the Intel 64 and AMD64, include a set of 16 registers that perform arithmetic operations on integers. They are called scalar registers because they hold just one value at any time. We can write C++ code that adds two integer variables together. That compiler may transform the program to add those two values, using two registers. If we have 1000 pairs of integers to add together, we need to execute 1000 such additions.
However, for several years, these chips have included an additional set of 16 registers, each 128 bits wide. Rather than hold a single, 128-bit wide value, they can hold a collection of smaller values; for example, 4 integers, each 32 bits wide. They are called vector registers because they can hold several values at any one time. The chips also provide new instructions to perform arithmetic on these 4 packed integers. So we can add 4 pairs of integers with a single instruction, in the same time that it took to add just 1 pair of integers when using the scalar registers.
Vectorization, then, is the process of using these vector registers, instead of scalar registers, in an attempt to make the program run faster. In a perfect world, our example loop would execute 4 times faster, but things are rarely perfect due to overhead.
Automatic Vectorization
C++ pointer vectorization. The compiler can now recognize more opportunities to vectorize loops that use pointers to access data.
Statement level vectorization.
__vectorcall (/Gv). You can now pass vector type arguments by using the __vectorcall calling convention to use vector registers. Using the new “__vector” calling convention on the appropriate methods improves performance by reducing instruction count, and minimizes stack allocation. By using this convention, DirectX itself is running about 15% faster.
Permutation of perfect loop nests.
Resources
Jim Radigan breaks it down in his series Inside Vectorization on Channel 9, http://channel9.msdn.com/Series/C9-Lectures-Jim-Radigan-Inside-Auto-Vectorization/Jim-Radigan-Inside-Auto-Vectorization-1-of-n
Jim Hogg wrote Optimizing C++ Code: Overview on the VCBlog, http://blogs.msdn.com/b/vcblog/archive/2013/06/12/optimizing-c-code-new-title.aspx
Auto-Parallelization and Auto-Vectorization in the MSDN library, http://msdn.microsoft.com/en-us/library/hh872235.aspx
Modern, 64-bit processors, such as the Intel 64 and AMD64, include a set of 16 registers that perform arithmetic operations on integers. They are called scalar registers because they hold just one value at any time. We can write C++ code that adds two integer variables together. That compiler may transform the program to add those two values, using two registers. If we have 1000 pairs of integers to add together, we need to execute 1000 such additions.
However, for several years, these chips have included an additional set of 16 registers, each 128 bits wide. Rather than hold a single, 128-bit wide value, they can hold a collection of smaller values; for example, 4 integers, each 32 bits wide. They are called vector registers because they can hold several values at any one time. The chips also provide new instructions to perform arithmetic on these 4 packed integers. So we can add 4 pairs of integers with a single instruction, in the same time that it took to add just 1 pair of integers when using the scalar registers.
Vectorization, then, is the process of using these vector registers, instead of scalar registers, in an attempt to make the program run faster. In a perfect world, our example loop would execute 4 times faster, but things are rarely perfect due to overhead.
Automatic Vectorization
C++ pointer vectorization. The compiler can now recognize more opportunities to vectorize loops that use pointers to access data.
Statement level vectorization.
__vectorcall (/Gv). You can now pass vector type arguments by using the __vectorcall calling convention to use vector registers. Using the new “__vector” calling convention on the appropriate methods improves performance by reducing instruction count, and minimizes stack allocation. By using this convention, DirectX itself is running about 15% faster.
Permutation of perfect loop nests.
Resources
Jim Radigan breaks it down in his series Inside Vectorization on Channel 9, http://channel9.msdn.com/Series/C9-Lectures-Jim-Radigan-Inside-Auto-Vectorization/Jim-Radigan-Inside-Auto-Vectorization-1-of-n
Jim Hogg wrote Optimizing C++ Code: Overview on the VCBlog, http://blogs.msdn.com/b/vcblog/archive/2013/06/12/optimizing-c-code-new-title.aspx
Auto-Parallelization and Auto-Vectorization in the MSDN library, http://msdn.microsoft.com/en-us/library/hh872235.aspx
Visual Studio 2012 introduced a set of libraries that help you harness the power of the highly parallel GPU, common in PC’s today, called C++ AMP where AMP is short for Accelerated Massive Parallelism. C++ AMP is builds on Direct3D and is able to offloading compute operations on to the GPU. This capability originated in the need to be able to perform lighting for 3D models and other visual effects that need to be applied to every single pixel a GPU renders. These are naturally very parallelizable tasks, so graphics cards have moved towards an architecture of having hundreds of very simple processing units.
C++ AMP is an open specification for enabling the processing resources of modern graphics cards to be accessed from C++. Visual Studio 2013 continues support for this standard. C++ AMP enjoys a first class experience inside Visual Studio 2013 including debugger and profiler support extended to bring to you operations being performed on the GPU.
Available in Visual Studio 2012
These features were shipped in Visual Studio 2012.
Visual Studio 2013 additions
The CPU\GPU data transfer efficiency on accelerators that share physical memory with CPU is now significantly enhanced due to elimination of redundant copying of data between GPU and CPU memory. Depending upon how the code was written, C++ AMP application that run on integrated GPU and WARP accelerators should see no (or significantly reduced) time spent on copying data. This feature is available only on Windows 8.1 and is turned on by default for WARP and some integrated GPUs. Additionally, developers can also opt into the feature programmatically through a set of APIs.
In Visual Studio 2013, we added a bunch of features to enhance support for textures. This support includes access to hardware texture sampling capabilities, support for staging textures, texture_view redesigned (to be more consistent with array_view design), a more complete and performant set of texture copy APIs including section copy, better interop support for textures including a much bigger set of DXGI formats, and support for mipmap.
We also added side-by-side CPU\GPU debugging (mixed mode debugging is available on Windows 8.1 for the WARP accelerator) and the ability to debug using the WARP accelerator instead of single threaded ref accelerator. Using WARP for debugging provides a much faster debugging experience.
Resources
What’s new for C++ AMP in Visual Studio 2013 on the Native Concurrency blog, http://blogs.msdn.com/b/nativeconcurrency/archive/2013/06/28/what-s-new-for-c-amp-in-visual-studio-2013.aspx
C++ AMP Overview in the MSDN library, http://msdn.microsoft.com/en-us/library/vstudio/hh265136.aspx