-
Bug
-
Resolution: Not a Bug
-
Undefined
-
None
-
CentOS Stream 8
-
None
-
None
-
Low
-
TestCaseProvided
-
rhel-sst-virtualization-hwe
-
ssg_virtualization
-
None
-
False
-
-
None
-
None
-
None
-
None
-
x86_64
-
None
What were you trying to do that didn't work?
Set CPU-model Sandy Bridge is able to execute AVX2-instructions when host CPU is capable of doing so. Sadny Bridge does not support AVX2-instructions
Please provide the package NVR for which bug is seen:
qemu-kvm.x86_64 15:6.2.0-41.module_el8+690+3a5f4f4f
How reproducible:
source code using AVX2-instructions (refer to Intel 325383-sdm-vol-2abcd-2.pdf), build with: gcc -mavx2-o avx2 avx2.c
#include <stdio.h>
#include <string.h>
#include <immintrin.h>
void main(void) {
__m256i test1 = _mm256_set_epi32(1,2,3,4,5,6,7,8);
__m256i test2 = _mm256_set_epi32(1,2,3,4,5,6,7,8);
for (int count = 0; count < 8; count++)
{ printf("[%d] %d ", count, *((int*)(&test1) + count)); }printf("\n");
for (int count = 0; count < 8; count++) { printf("[%d] %d ", count, *((int*)(&test2) + count)); }
printf("\n");
test1 = _mm256_add_epi32(test1, test2);
test2 = _mm256_mullo_epi32(test1, test2);
for (int count = 0; count < 8; count++) { printf("[%d] %d ", count, *((int*)(&test1) + count)); }
printf("\n");
for (int count = 0; count < 8; count++)
{ printf("[%d] %d ", count, *((int*)(&test2) + count)); } printf("\n");
}
This executed on following CPUs yields following results:
Xeon E7-4880v2: "illegal instruction"
Ryzen 7 Pro 2700U: executes and prints
[0] 8 [1] 7 [2] 6 [3] 5 [4] 4 [5] 3 [6] 2 [7] 1
[0] 8 [1] 7 [2] 6 [3] 5 [4] 4 [5] 3 [6] 2 [7] 1
[0] 16 [1] 14 [2] 12 [3] 10 [4] 8 [5] 6 [6] 4 [7] 2
[0] 128 [1] 98 [2] 72 [3] 50 [4] 32 [5] 18 [6] 8 [7] 2
qemu-kvm-vm CentOS7 on Ryzen 7 Pro 2700U, emulated as Westmere: "illegal instruction"
qemu-kvm-vm CentOS7 on Ryzen 7 Pro 2700U, emulated as SandyBridge: executes and prints
[0] 8 [1] 7 [2] 6 [3] 5 [4] 4 [5] 3 [6] 2 [7] 1
[0] 8 [1] 7 [2] 6 [3] 5 [4] 4 [5] 3 [6] 2 [7] 1
[0] 16 [1] 14 [2] 12 [3] 10 [4] 8 [5] 6 [6] 4 [7] 2
[0] 128 [1] 98 [2] 72 [3] 50 [4] 32 [5] 18 [6] 8 [7] 2
qemu-kvm-vm CentOS7 on Ryzen 7 Pro 2700U, emulated as host: executes and prints
[0] 8 [1] 7 [2] 6 [3] 5 [4] 4 [5] 3 [6] 2 [7] 1
[0] 8 [1] 7 [2] 6 [3] 5 [4] 4 [5] 3 [6] 2 [7] 1
[0] 16 [1] 14 [2] 12 [3] 10 [4] 8 [5] 6 [6] 4 [7] 2
[0] 128 [1] 98 [2] 72 [3] 50 [4] 32 [5] 18 [6] 8 [7] 2
Neither avx-flag or avx2-flag is set when Westmere is emulated.
The avx2-flag is not set if SandyBridge is emulated, only avx is.
avx-flag and avx2-flag are set if "host" is emulated and host has both flags.
Steps to reproduce
- create file avx2.c with above source
- compile as stated above with gcc -mavx2 -o avx2 avx2.c
- run and get results as described above
Expected results
emulated SandyBridge must yield "illegal instruction" like real world Ivy Bridge (successor of Sandy Bridge).
Actual results
See above
As an additional info: I could see the same results using VMWare ESXi (6, i guess? don't know, not the person running it)