gpt4 book ai didi

linux - 在编译时启用 AVX512 支持会显着降低性能

转载 作者:行者123 更新时间:2023-12-03 09:57:36 24 4
gpt4 key购买 nike

我有一个使用静态库的 C/C++ 项目。该库是为“skylake”架构而构建的。该项目是一个数据处理模块,即它执行许多算术运算、内存复制、搜索、比较等。
CPU为Xeon Gold 6130T,支持AVX512。我尝试使用 -march=skylake 编译我的项目和 -march=skylake-avx512然后与图书馆链接。
如果使用 -march=skylake-avx512与使用 -march=skylake 构建的项目相比,项目性能显着下降(平均下降 30%) .
这怎么解释?可能是什么原因?
信息:

  • Linux 3.10
  • gcc 9.2
  • 英特尔至强金牌 6130T
  • 最佳答案

    project performance is significantly decreased (by 30% on average)


    在无法轻松矢量化的代码中,零星的 AVX 指令会随处降低 CPU 的频率,但不会提供任何好处。在这种情况下,您可能希望完全关闭 AVX 指令。
    Advanced Vector Extensions, Downclocking :

    Since AVX instructions are wider and generate more heat, Intel processors have provisions to reduce the Turbo Boost frequency limit when such instructions are being executed. The throttling is divided into three levels:

    • L0 (100%): The normal turbo boost limit.
    • L1 (~85%): The "AVX boost" limit. Soft-triggered by 256-bit "heavy" (floating-point unit: FP math and integer multiplication) instructions. Hard-triggered by "light" (all other) 512-bit instructions.
    • L2 (~60%): The "AVX-512 boost" limit. Soft-triggered by 512-bit heavy instructions.The frequency transition can be soft or hard. Hard transition means the frequency is reduced as soon as such an instruction is spotted; soft transition means that the frequency is reduced only after reaching a threshold number of matching instructions. The limit is per-thread.

    Downclocking means that using AVX in a mixed workload with an Intel processor can incur a frequency penalty despite it being faster in a "pure" context. Avoiding the use of wide and heavy instructions help minimize the impact in these cases. AVX-512VL is an example of only using 256-bit operands in AVX-512, making it a sensible default for mixed loads.


    另见
  • On the dangers of Intel's frequency scaling .
  • Gathering Intel on Intel AVX-512 Transitions .
  • How to Fix Intel? .
  • 关于linux - 在编译时启用 AVX512 支持会显着降低性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63484266/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com