How do programs utilize new CPU instructions (e.g. AVX-512, Intel Quick Sync Video) while still being able to run on older CPUs?

314 views

New instruction sets can improve performance but it is difficult to distribute your program if most people’s computers cannot run the program. When compiling an executable to distribute, it either has code that uses or doesn’t certain CPU instructions. The only way around it I can think of is compiling multiple libraries for every function that may use a new instruction set, one with the new instruction set and other without. Then you detect which CPU you have and dynamically load the proper library at runtime.

In: 2

3 Answers

Anonymous 0 Comments

You have it basically right. If a program has to run on both new and older CPUs, they check the CPU capabilities at run time and run code with or without the new extensions as appropriate.

Sometimes code is written so that it requires certain extensions, for instance MMX is pretty much standard these days. For these programs, they don’t include non-MMX versions of libraries and such. They may perform a check when the program launches to display an error message, or if no check is done then the program will crash when attempting to run the unsupported code.

You are viewing 1 out of 3 answers, click here to view all answers.