博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vans鞋内衬烂了怎么办_C ++内衬改进:Zipliner
阅读量:2509 次
发布时间:2019-05-11

本文共 5342 字,大约阅读时间需要 17 分钟。

vans鞋内衬烂了怎么办

 include improvements to the C++ inliner. Among these is the ability to inline some routines after they have been optimized, referred to as the «Zipliner.» Depending on your application, you may see some minor code quality improvements and/or major build-time (compiler throughput) improvements.  包括对C ++内衬的改进。 其中包括在对某些例程进行优化后对其进行内联的能力,称为“ Zipliner”。 根据您的应用程序,您可能会看到一些次要的代码质量改进和/或主要的构建时间(编译器吞吐量)改进。

C2内衬 (C2 Inliner)

Terry Mahaffey has provided an overview of . This details some of the inliner’s constraints and areas for improvement, a few of which are particularly relevant here: 

Terry Mahaffey概述了 。 这详细介绍了衬板的一些约束条件和需要改进的地方,其中一些与这里特别相关:

  1. The inliner is recursive and may often re-do work it has already done. Inline decisions are context sensitive and it is not always profitable to replay its decision-making for the same function. 

    内联函数是递归的,并且可能经常重新做已经完成的工作。 内联决策是上下文相关的,重播针对相同功能的决策并不总是有利可图的。
  2. The inliner is very budget conscious. It has the difficult job of balancing executable size with runtime performance. 

    内衬非常注重预算。 它很难平衡可执行文件的大小和运行时的性能。
  3. The inliner’s view of the world is always «pre-optimized.» It has very limited knowledge of copy propagation and dead control paths for example.

    班轮的世界观始终是“预先优化的”。 例如,它对复制传播和无效控制路径的了解非常有限。

现代C ++ (Modern C++)

Unfortunately, many of the coding patterns and idioms common to heavy generic programming bump into those constraints. Consider the following routine in the :

不幸的是,繁重的通用编程中常见的许多编码模式和习惯用法都遇到了这些限制。 考虑一下的以下例程:

Eigen::Matrix
::outerStride(void)

which calls innerSize:

调用innerSize:

template
class DenseBase ... Index innerSize() const {     return IsVectorAtCompileTime ? this->size()          : int(IsRowMajor) ? this->cols() : this->rows(); }

That instantiation of outerStride does nothing but return one of its members. Therefore, it is an excellent candidate for full inline expansion. To realize this win though the compiler must fully evaluate and expand outerStride’s 18 total callees, for every callsite of outerStride in the module. This eats into both the optimizer throughput as well as the inliner’s code-size budget. It also bears mentioning that calls to ‘rows’ and ‘cols’ are inline-expanded as well, even though those are on a statically dead path.

outsideStride的实例化只返回其成员之一。 因此,它是全面内联扩展的绝佳选择。 为了实现这一目标,尽管编译器必须针对模块中externalStride的每个调用站点,完全评估和扩展externalStride的18个被调用者。 这既影响了优化器的吞吐量,也影响了内联代码的预算大小。 还需要提及的是,即使“行”和“ cols”的调用处于静态死路径中,它们的调用也会被内联扩展。

It would be much better if the optimizer just inlined the two-line member return:

如果优化器仅内联两行成员返回,那就更好了:

?outerStride@?$Matrix@N$0?0$0?0$0A@$0?0$0?0@Eigen@@QEBA_JXZ PROC ; Eigen::Matrix
::outerStride, COMDAT mov     rax, QWORD PTR [rcx+8]     ret 0

内联优化IR (Inlining Optimized IR)

For a subset of routines the inliner will now expand the already-optimized IR of a routine, bypassing the process of fetching IR, and re-expanding callees. This has the dual purpose of expanding callsites much faster, as well as letting the inliner measure its budget more accurately. 

对于例程的子集,内联函数现在将扩展例程的本已优化的IR,从而绕过获取IR和重新扩展被调用者的过程。 这具有双重目的,即可以更快地扩展呼叫站点,还可以让内线用户更准确地衡量其预算。

First, the optimizer will summarize that outerStride is a candidate for this faster expansion when it is originally compiled (Remember that c2.dll tries to compile routines before their callers). Then, the inliner may replace calls to that outerStride instantiation with the field access. 

首先,优化器将总结出,在最初编译时,outerStride是此更快扩展的候选对象(请记住,c2.dll尝试在调用者之前编译例程)。 然后,内联函数可以使用字段访问替换对该externalStride实例的调用。

The candidates for this faster inline expansion are leaf functions with no locals, which refer to at most two different arguments, globals, or constants. In practice this targets most simple getters and setters.

这种更快的内联扩展的候选者是没有局部变量的叶函数,它们最多引用两个不同的参数,全局变量或常量。 实际上,这是针对最简单的获取器和设置器的。

好处 (Benefits)

There are many examples like outerStride in the Eigen library where a large call tree expands into just one or two instructions. Modules that make heavy use of Eigen may see a significant throughput improvement; we measured the optimizer taking up to 25-50% less time for such repros. 

Eigen库中有很多示例,例如externalStride,其中一个大型调用树仅扩展为一条或两条指令。 大量使用Eigen的模块可能会显着提高吞吐量。 我们测得的优化器最多可减少25-50%的此类再现时间。

The new Zipliner will also enable the inliner to measure its budget more accurately. Eigen developers have long been aware that MSVC does not inline to their specifications (see EIGEN_STRONG_INLINE). Zipliner should help to alleviate some of this concern, as a ziplined routine is now considered a virtually «free» inline.

新的Zipliner还将使衬板能够更准确地衡量其预算。 Eigen开发人员早就意识到MSVC不符合其规范(请参阅EIGEN_STRONG_INLINE)。 Zipliner应该有助于减轻这种担忧,因为现在使用带拉链的例程实际上被视为“免费”内联。

试试看功能 (Give the feature a try)

This is enabled by default in Visual Studio 2019 16.3, along with some improvements in 16.4. Please  and give the new improvements a try. We can be reached via the comments below or via email (visualcpp@microsoft.com). If you encounter problems with Visual Studio or MSVC, or have a suggestion for us, please let us know through Help > Send Feedback > Report A Problem / Provide a Suggestion in the product, or via . You can also find us on Twitter ().

默认情况下,此选项在Visual Studio 2019 16.3中已启用,并在16.4中进行了一些改进。 请并尝试新的改进。 可以通过以下评论或电子邮件(visualcpp@microsoft.com)与我们联系。 如果您在使用Visual Studio或MSVC时遇到问题,或对我们有建议,请通过帮助>发送反馈>报告问题/在产品中提供建议或通过告诉我们。 您也可以在Twitter( )上找到我们。

翻译自:

vans鞋内衬烂了怎么办

转载地址:http://fzdwd.baihongyu.com/

你可能感兴趣的文章
前端数据可视化插件(二)图谱
查看>>
kafka web端管理工具 kafka-manager【转发】
查看>>
获取控制台窗口句柄GetConsoleWindow
查看>>
51nod 1197 字符串的数量 V2(矩阵快速幂+数论?)
查看>>
OKMX6Q在ltib生成的rootfs基础上制作带QT库的根文件系统
查看>>
多线程基础
查看>>
前后台验证字符串长度
查看>>
《算法导论 - 思考题》7-1 Hoare划分的正确性
查看>>
表达式求值-201308081712.txt
查看>>
centos中安装tomcat6
查看>>
学习进度
查看>>
poj3368 RMQ
查看>>
“此人不存在”
查看>>
github.com加速节点
查看>>
解密zend-PHP凤凰源码程序
查看>>
python3 序列分片记录
查看>>
Atitit.git的存储结构and 追踪
查看>>
atitit 读书与获取知识资料的attilax的总结.docx
查看>>
B站 React教程笔记day2(3)React-Redux
查看>>
找了一个api管理工具
查看>>