久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

        <bdo id='rYCZV'></bdo><ul id='rYCZV'></ul>

      1. <tfoot id='rYCZV'></tfoot>

        <i id='rYCZV'><tr id='rYCZV'><dt id='rYCZV'><q id='rYCZV'><span id='rYCZV'><b id='rYCZV'><form id='rYCZV'><ins id='rYCZV'></ins><ul id='rYCZV'></ul><sub id='rYCZV'></sub></form><legend id='rYCZV'></legend><bdo id='rYCZV'><pre id='rYCZV'><center id='rYCZV'></center></pre></bdo></b><th id='rYCZV'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='rYCZV'><tfoot id='rYCZV'></tfoot><dl id='rYCZV'><fieldset id='rYCZV'></fieldset></dl></div>

        <small id='rYCZV'></small><noframes id='rYCZV'>

        <legend id='rYCZV'><style id='rYCZV'><dir id='rYCZV'><q id='rYCZV'></q></dir></style></legend>

        使用 AVX CPU 指令:沒有“/arch:AVX"的性能不佳

        Using AVX CPU instructions: Poor performance without quot;/arch:AVXquot;(使用 AVX CPU 指令:沒有“/arch:AVX的性能不佳)

            <tbody id='BaQeV'></tbody>
            <tfoot id='BaQeV'></tfoot>
          • <legend id='BaQeV'><style id='BaQeV'><dir id='BaQeV'><q id='BaQeV'></q></dir></style></legend>
          • <small id='BaQeV'></small><noframes id='BaQeV'>

              • <bdo id='BaQeV'></bdo><ul id='BaQeV'></ul>
                <i id='BaQeV'><tr id='BaQeV'><dt id='BaQeV'><q id='BaQeV'><span id='BaQeV'><b id='BaQeV'><form id='BaQeV'><ins id='BaQeV'></ins><ul id='BaQeV'></ul><sub id='BaQeV'></sub></form><legend id='BaQeV'></legend><bdo id='BaQeV'><pre id='BaQeV'><center id='BaQeV'></center></pre></bdo></b><th id='BaQeV'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BaQeV'><tfoot id='BaQeV'></tfoot><dl id='BaQeV'><fieldset id='BaQeV'></fieldset></dl></div>

                  本文介紹了使用 AVX CPU 指令:沒有“/arch:AVX"的性能不佳的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我的 C++ 代碼使用 SSE,現在我想改進它以在可用時支持 AVX.所以我檢測 AVX 何時可用并調用一個使用 AVX 命令的函數.我使用 Win7 SP1 + VS2010 SP1 和一個帶 AVX 的 CPU.

                  My C++ code uses SSE and now I want to improve it to support AVX when it is available. So I detect when AVX is available and call a function that uses AVX commands. I use Win7 SP1 + VS2010 SP1 and a CPU with AVX.

                  要使用 AVX,必須包含這個:

                  To use AVX, it is necessary to include this:

                  #include "immintrin.h"
                  

                  然后你可以使用內在的 AVX 函數,比如 _mm256_mul_ps_mm256_add_ps 等.問題是,默認情況下,VS2010 生成的代碼運行速度非常慢并顯示警告:

                  and then you can use intrinsics AVX functions like _mm256_mul_ps, _mm256_add_ps etc. The problem is that by default, VS2010 produces code that works very slowly and shows the warning:

                  警告 C4752:發現英特爾(R) 高級矢量擴展;考慮使用/arch:AVX

                  warning C4752: found Intel(R) Advanced Vector Extensions; consider using /arch:AVX

                  似乎 VS2010 實際上不使用 AVX 指令,而是模擬它們.我在編譯器選項中添加了 /arch:AVX 并得到了不錯的結果.但是這個選項告訴編譯器在可能的情況下在任何地方使用 AVX 命令.所以我的代碼可能會在不支持 AVX 的 CPU 上崩潰!

                  It seems VS2010 actually does not use AVX instructions, but instead, emulates them. I added /arch:AVX to the compiler options and got good results. But this option tells the compiler to use AVX commands everywhere when possible. So my code may crash on CPU that does not support AVX!

                  所以問題是如何讓 VS2010 編譯器生成 AVX 代碼,但只有當我直接指定 AVX 內在函數時.對于 SSE,它可以工作,我只使用 SSE 內在函數并生成 SSE 代碼,而無需任何編譯器選項,例如 /arch:SSE.但是對于 AVX,由于某種原因它不起作用.

                  So the question is how to make VS2010 compiler to produce AVX code but only when I specify AVX intrinsics directly. For SSE it works, I just use SSE intrinsics functions and it produce SSE code without any compiler options like /arch:SSE. But for AVX it does not work for some reason.

                  推薦答案

                  2021 更新:現代版本的 MSVC 不需要手動使用 _mm256_zeroupper() 即使在沒有 的情況下編譯 AVX 內部函數/arch:AVX.VS2010 做到了.

                  2021 update: Modern versions of MSVC don't need manual use of _mm256_zeroupper() even when compiling AVX intrinsics without /arch:AVX. VS2010 did.

                  您所看到的行為是昂貴的狀態切換的結果.

                  The behavior that you are seeing is the result of expensive state-switching.

                  請參閱 Agner Fog 手冊的第 102 頁:

                  See page 102 of Agner Fog's manual:

                  http://www.agner.org/optimize/microarchitecture.pdf

                  每次您在 SSE 和 AVX 指令之間不正確地來回切換時,您都將付出極高的 (~70) 周期損失.

                  Every time you improperly switch back and forth between SSE and AVX instructions, you will pay an extremely high (~70) cycle penalty.

                  當你在沒有 /arch:AVX 的情況下編譯時,VS2010 將生成 SSE 指令,但在你有 AVX 內在函數的任何地方仍然會使用 AVX.因此,您將獲得同時具有 SSE 和 AVX 指令的代碼 - 這將具有那些狀態切換懲罰.(VS2010 知道這一點,所以它會發出您看到的警告.)

                  When you compile without /arch:AVX, VS2010 will generate SSE instructions, but will still use AVX wherever you have AVX intrinsics. Therefore, you'll get code that has both SSE and AVX instructions - which will have those state-switching penalties. (VS2010 knows this, so it emits that warning you're seeing.)

                  因此,您應該全部使用 SSE,或全部使用 AVX.指定 /arch:AVX 告訴編譯器使用所有 AVX.

                  Therefore, you should use either all SSE, or all AVX. Specifying /arch:AVX tells the compiler to use all AVX.

                  聽起來您正在嘗試創建多個代碼路徑:一個用于 SSE,另一個用于 AVX.為此,我建議您將 SSE 和 AVX 代碼分成兩個不同的編譯單元.(一個用 /arch:AVX 編譯,一個不用)然后將它們鏈接在一起,讓調度程序根據運行的硬件進行選擇.

                  It sounds like you're trying to make multiple code paths: one for SSE, and one for AVX. For this, I suggest you separate your SSE and AVX code into two different compilation units. (one compiled with /arch:AVX and one without) Then link them together and make a dispatcher to choose based on the what hardware it's running on.

                  如果您需要混合 SSE 和 AVX,請務必使用 _mm256_zeroupper()_mm256_zeroall()> 適當地避免狀態轉換懲罰.

                  If you need to mix SSE and AVX, be sure to use _mm256_zeroupper() or _mm256_zeroall() appropriately to avoid the state-switching penalties.

                  這篇關于使用 AVX CPU 指令:沒有“/arch:AVX"的性能不佳的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Why do two functions have the same address?(為什么兩個函數的地址相同?)
                  Why the initializer of std::function has to be CopyConstructible?(為什么 std::function 的初始化程序必須是可復制構造的?)
                  mixing templates with polymorphism(混合模板與多態性)
                  When should I use the keyword quot;typenamequot; when using templates(我什么時候應該使用關鍵字“typename?使用模板時)
                  Dependent name resolution amp; namespace std / Standard Library(依賴名稱解析命名空間 std/標準庫)
                  gcc can compile a variadic template while clang cannot(gcc 可以編譯可變參數模板,而 clang 不能)

                  • <small id='Lzmpd'></small><noframes id='Lzmpd'>

                    <tfoot id='Lzmpd'></tfoot>
                    <legend id='Lzmpd'><style id='Lzmpd'><dir id='Lzmpd'><q id='Lzmpd'></q></dir></style></legend>

                          <tbody id='Lzmpd'></tbody>
                      • <i id='Lzmpd'><tr id='Lzmpd'><dt id='Lzmpd'><q id='Lzmpd'><span id='Lzmpd'><b id='Lzmpd'><form id='Lzmpd'><ins id='Lzmpd'></ins><ul id='Lzmpd'></ul><sub id='Lzmpd'></sub></form><legend id='Lzmpd'></legend><bdo id='Lzmpd'><pre id='Lzmpd'><center id='Lzmpd'></center></pre></bdo></b><th id='Lzmpd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Lzmpd'><tfoot id='Lzmpd'></tfoot><dl id='Lzmpd'><fieldset id='Lzmpd'></fieldset></dl></div>

                          <bdo id='Lzmpd'></bdo><ul id='Lzmpd'></ul>

                          1. 主站蜘蛛池模板: 欧美日韩毛片 | 欧美精品日韩少妇 | 毛片av在线 | 黄色福利 | 久久精品黄色 | 国语av| 午夜精品久久久久久久久久久久 | 精品一区二区三区免费 | 日韩精品免费看 | 免费精品视频 | 国产小视频在线播放 | 日韩二三区 | 日韩成人免费视频 | 国产一级网站 | 亚洲精品在线免费 | 一级理论片 | aaaaa毛片| www.中文字幕 | 夜夜av | 国产一区中文字幕 | 青青草福利视频 | 国产欧美在线 | 一级看片免费视频 | 国产农村妇女aaaaa视频 | 精品欧美黑人一区二区三区 | 久久视频这里只有精品 | 亚洲激情在线视频 | 日本中文字幕一区 | 欧美做受| 精品无人国产偷自产在线 | 国产日韩精品一区二区 | 一区二区三区国产视频 | 国产裸体永久免费视频网站 | 欧美激情一区 | 国产日产精品一区二区三区的介绍 | 性av在线 | 国产福利91精品一区二区三区 | 国产69精品久久久久久 | 欧美成人激情 | 四虎三级 | 色黄视频在线观看 |