Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

BIOS and AVX/AVX2/AVX512

Cao__Henry
Beginner
21,115 Views

Hi,

I noticed that some motherboards have an option to disable "AVX/AVX2/AVX512".

What does it really do?  Given that we can't disable AVX/AVX2/AVX512 support in the CPU.

I asked the vendor and they said given a CPU supports AVX/AVX2/AVX512, in the BIOS, if "AVX/AVX2/AVX512" is disabled, and the application executes some AVX/AVX2/AVX512 instructions, then the CPU wouldn't attempt to lower the frequency to execute the exact instructions requested but would convert the AVX/AVX2/AVX512 instructions requested into multiple non-AVX/AVX2/AVX512 instructions, (potentially) taking longer to process.

Does it make any sense?  How could BIOS tell CPU to break AVX/AVX2/AVX512 instructions?  The only way I could imagine is that the BIOS has a way to tell the CPU that the voltage couldn't be changed and so the frequency would stay.

Any insight?

Thanks in advance!

0 Kudos
9 Replies
andysem
New Contributor III
21,115 Views

My understanding is that the BIOS/UEFI modifies CPUID instruction behavior. It is known that OS kernel, SDE or hypervisors can do it to limit userland/guest processes from using certain instructions. For the userland/guest processes, it appears as if the CPU does not support a given instruction set extension and they have to fall back to scalar code path or use a smaller vector size (e.g. by using SSE instead of AVX). Note that it doesn't allow AVX/AVX-512 code to be executed, even at a reduced performance. It is the process' responsibility to execute a different, non-AVX code path when AVX is not enabled or available, and the performance will depend on how efficient that code path is.

As to exactly how CPUID behavior can be modified, I don't know. I'm guessing, BIOS/UEFI can configure the CPU so that whenever CPUID is executed, a trap is triggered and a handler function in the BIOS/UEFI is called. That handler implements the required CPUID behavior and returns to the code that originally executed CPUID.

 

0 Kudos
Cao__Henry
Beginner
21,115 Views

Thanks for your insight, Andy.

I am not very familiar with CPUID instruction besides I used it to serialize instructions.

I looked up CPUID instruction here:
https://c9x.me/x86/html/file_module_x86_id_45.html

It seems like CPUID instruction is used to query CPU to get more info about the CPU.

You mentioned, "Note that it doesn't allow AVX/AVX-512 code to be executed, even at a reduced performance".  Who is "it"?  You referring to CPU? Kernel? BIOS? Or?

You mentioned, "It is the process' responsibility to execute a different, non-AVX code path when AVX is not enabled or available, and the performance will depend on how efficient that code path is".  Are you suggesting that the application should detect whether AVX instruction set is supported and then select the code path accordingly?

Thanks!

0 Kudos
andysem
New Contributor III
21,115 Views

You mentioned, "Note that it doesn't allow AVX/AVX-512 code to be executed, even at a reduced performance".  Who is "it"?  You referring to CPU? Kernel? BIOS? Or?

By "it" I mean the whole approach, and in particular the component that alters CPUID behavior.

Are you suggesting that the application should detect whether AVX instruction set is supported and then select the code path accordingly?

Yes. Any piece of software wishing to use any instructions beyond the basic instruction set should first verify that the CPU (and, in some cases like AVX/AVX-512, OS) supports them. On x86 this is done with the CPUID instruction (and, to check for OS support, a system call or XGETBV instruction). If the software doesn't do that, it will fail to execute (most likely crash) on a CPU or OS that doesn't support that instruction set extension.

 

0 Kudos
McCalpinJohn
Honored Contributor III
21,115 Views

I asked the vendor and they said given a CPU supports AVX/AVX2/AVX512, in the BIOS, if "AVX/AVX2/AVX512" is disabled, and the application executes some AVX/AVX2/AVX512 instructions, then the CPU wouldn't attempt to lower the frequency to execute the exact instructions requested but would convert the AVX/AVX2/AVX512 instructions requested into multiple non-AVX/AVX2/AVX512 instructions, (potentially) taking longer to process.

The processors behave *almost* this way while waiting for the functional units in the "upper" parts of the SIMD pipelines to be activated, but as far as I know Intel has never discussed this in public....

I discussed some of my observations in this forum and others:

 

0 Kudos
Cao__Henry
Beginner
21,115 Views

Thanks for your links John!  A lot more info about how AVX2/AVX512 instructions affect the frequency.

But it seems like not all AVX2/AVX512 instructions will lower the frequency.

Now, it makes me curious whether disabling AVX2/AVX512 support in BIOS would make the CPU (supporting AVX2/AVX512 instructions) convert *only* those instructions in AVX2/AVX512 instruction sets causing lower frequency to other instructions?  Or CPU won't be that smart?

0 Kudos
McCalpinJohn
Honored Contributor III
21,115 Views

But it seems like not all AVX2/AVX512 instructions will lower the frequency.

That is correct....  The Intel Xeon processor "specification update" documents include tables of maximum Turbo boost frequencies that are labelled as "non-AVX", "AVX-2.0", and "AVX-512", but these are not precisely correct.  The SKX core performance monitors include an event called "CORE_POWER" (EventSelect=0x28) with Umask fields to select "LVL[012]_TURBO_LICENSE".   The descriptions at https://download.01.org/perfmon/SKX/skylakex_core_v1.12.json says that the levels correspond to:

  • Level 0: "This includes non-AVX codes, SSE, AVX 128-bit, and low-current AVX 256-bit codes."
  • Level 1: "This includes high current AVX 256-bit instructions as well as low current AVX 512-bit instructions."
  • Level 2: "This includes high current AVX 512-bit instructions."

I don't know of any "official" listing of which instructions are in each category -- and would not expect to see one, since Intel may change the categorization at any time.  From limited testing, I found that 256-bit and 512-bit packed SIMD bit instructions (AND, OR, XOR, etc) are "low-current", while 256-bit and 512-bit packed SIMD floating-point arithmetic operations are all "high-current".  

I don't know what happens if you disable an instruction set extension in the BIOS -- the mechanisms to do that are not visible to me....

0 Kudos
levicki
Valued Contributor I
21,115 Views
From what I read in system programmer's guide it seems possible to disable individual SIMD instruction set extensions using XCR0 register. BIOS being a component which initializes the CPU should able to do so and in that case CPUID (and accompanying cpu information gathering mechanisms) would report them as supported but disabled. Manual says what happens if state management if disabled -- "Otherwise, an attempt to execute an instruction in AVX extensions (including an enhanced 128-bit SIMD instructions using VEX encoding) will cause a #UD exception." where #UD means an illegal instruction. I highly doubt that your BIOS vendor has added an SDE emulator in their BIOS to allow for execution of AVX512 using AVX2 and lower, that wouldn't make much sense and it would incur larger performance penalty than just allowing the instructions to run at reduced clock speed. If you are curious by how much your clock multiplier is reduced by running AVX512 use HWInfo to read this information from the CPU. As an example, Core i7-9800X has the following multipliers: IA/SSE -> 45x (1-2c), 42x (3-4c), 40x (5-8c) AVX2 -> 39x (1-2c), 38x (3-8c) AVX512 -> 37x (1-2c), 36x (3-8c) Those are the fused (default) values for my CPU, but my mainboard's BIOS (ASUS PRIME X299-A) allows me to override them and set different multipliers for each of those states (IA/SSE, AVX2, and AVX512). I can even set them all to the same frequency (for example 40x which is 4 GHz) if I can provide adequate power and cooling to the CPU so it doesn't throttle.
0 Kudos
G__Anand
Beginner
21,114 Views

Hi,

Is there any option in BIOS to disable the AVX2?. I didn't find any option to disable the AVX on the bios menu. 

Can someone help me with this?

Server model - IBM x3550 M4 

Thanks in Advance.

Thanks,

Anand G

0 Kudos
G__Anand
Beginner
21,095 Views

Quick question - How to disable the AVX2 in the bios because I don't see any option to disable the AVX in the bios menu.

Could you please help me on this.

Thanks in Advance.

0 Kudos
Reply