Avx2、avx support question

qiuyang: <p>Pytorch has been compiled and installed on a CPU that supports AVX2 instruction. What would it be like to run on a CPU that does not support the AVX2 instruction but only supports the AVX instruction?</p>
<p>this is my avx2 cpu：<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/5/b/5ba09ba5f0784898b84940a412623a2fb5ddf4e6.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/5ba09ba5f0784898b84940a412623a2fb5ddf4e6" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/5/b/5ba09ba5f0784898b84940a412623a2fb5ddf4e6_2_690x260.jpeg" alt="image" data-base62-sha1="d4zy9wGG8Suqu4UaMSpvjHX3gtE" width="690" height="260" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/5/b/5ba09ba5f0784898b84940a412623a2fb5ddf4e6_2_690x260.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/5/b/5ba09ba5f0784898b84940a412623a2fb5ddf4e6_2_1035x390.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/5/b/5ba09ba5f0784898b84940a412623a2fb5ddf4e6_2_1380x520.jpeg 2x" data-dominant-color="070605"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1920×724 68.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>this is my avx cpu:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/9/f/9f3a2079030bd6731d13b6f941393602b9dea930.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/9f3a2079030bd6731d13b6f941393602b9dea930" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/9/f/9f3a2079030bd6731d13b6f941393602b9dea930_2_690x194.jpeg" alt="image" data-base62-sha1="mIAs99SpXUDvrOjRgIe4UCuZhny" width="690" height="194" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/9/f/9f3a2079030bd6731d13b6f941393602b9dea930_2_690x194.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/9/f/9f3a2079030bd6731d13b6f941393602b9dea930_2_1035x291.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/9/f/9f3a2079030bd6731d13b6f941393602b9dea930_2_1380x388.jpeg 2x" data-dominant-color="060404"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1920×540 47.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

qiuyang: <p>Did pytorch supported AVX instruction?</p>

ptrblck: <p>In a current nightly binary <code>print(torch.__config__.show())</code> returns:</p>
<pre><code class="lang-python">PyTorch built with:
  - GCC 9.3
  - C++ Version: 201703
  - Intel(R) oneAPI Math Kernel Library Version 2022.2-Product Build 20220804 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v2.7.3 (Git Hash 6dbeffbae1f23cbbeae17adb7b5b13f1f37c080e)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 11.8
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_90,code=sm_90
  - CuDNN 8.7
  - Magma 2.6.1
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=8.7.0, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=ON, TORCH_VERSION=2.0.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, 
</code></pre>
<p>which shows <code>CPU capability usage: AVX2</code> and <code>PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1</code> in the build settings, so I would assume <code>AVX</code> is supported.</p>

qiuyang: <aside class="quote no-group" data-username="ptrblck" data-post="3" data-topic="173849">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/48/1823_2.png" class="avatar"> ptrblck:</div>
<blockquote>
<p><code>PU capability usage: AVX2</code></p>
</blockquote>
</aside>
<p>I got a result:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/d/2/d2b5663dec0b949d2d2b0fda7a8a4b4470a9da71.png" data-download-href="https://discuss.pytorch.org/uploads/default/d2b5663dec0b949d2d2b0fda7a8a4b4470a9da71" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/d/2/d2b5663dec0b949d2d2b0fda7a8a4b4470a9da71.png" alt="image" data-base62-sha1="u40UJWGcdaMy3C08kIgcN4QRYtz" width="690" height="210" data-dominant-color="141414"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1080×330 23.4 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
so in my host, avx is not supported?</p>