Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7650 Discussions

Virtual Machine, Hypervisor and Architecture detection

Guillaume_A_
New Contributor I
484 Views

Hello,

Accordingly to this post "When running in a virtual machine, you may never be sure which physical CPU you are running on - a hypervisor can pass anything as CPUID to its guests".

I have a code compiled with icl.exe with options /arch:AVX /QaxCORE-AVX512,CORE-AVX2. Some parts contain loops (compilation log shows that they are vectorized). Other parts of my code call MKL functions (with static link). From my point of view: my program is able to run on several architectures (with AVX compatibility at least) and the best instructions to use will be detected at runtime.

In case of running in VM with an hypervisor, I wonder what happens if:

  • The physical CPU is AVX-512 compatible (Cascade Lake) but the hypervisor says that it is only AVX2 compatible.
  • The physical CPU is only AVX2 compatible (Haswell) but the hypervisor claims that it is AVX-512.

In both cases: which instruction level will be used (AVX2, AVX-512, ...) at runtime? Will my loops compiled with icl.exe and the MKL functions use the same instructions? Will it crashed?

I precise that do not know how an hypervisor works.

I also wonder if there is any case where the "detection of the best instructions to use at runtime" could failed and what will be the behavior in this case (defaulting, crash,...)?

Config:

  • Virtual Machine in Azure cloud: Windows server 2016.
  • Intel Composer 2020.1.216

Thank in advance for your help,

Guillaume A.

0 Kudos
1 Solution
Viet_H_Intel
Moderator
396 Views

From the post, sounds like they “downgrade” CPUs, not “upgrade”. Meaning less capabilities. 

It would only be a problem if hypervisor adds features that are not part of the cpu (your second case). And I would consider that a bug in the hypervisor.

The 1st case: AVX2 code path would be selected to execute. The 2nd case would get "illegal instructions" if AVX512 was chosen to be executed

 

 

View solution in original post

2 Replies
RahulV_intel
Moderator
426 Views

Hi,


Thanks for raising your issue. We are working on this internally and will get back to you.


Regards,

Rahul


Viet_H_Intel
Moderator
397 Views

From the post, sounds like they “downgrade” CPUs, not “upgrade”. Meaning less capabilities. 

It would only be a problem if hypervisor adds features that are not part of the cpu (your second case). And I would consider that a bug in the hypervisor.

The 1st case: AVX2 code path would be selected to execute. The 2nd case would get "illegal instructions" if AVX512 was chosen to be executed

 

 

Reply