vxiiduu / VxKex

Windows 7 API Extensions
869 stars 47 forks source link

AVX-512 instructions #52

Open CommanderLake opened 1 year ago

CommanderLake commented 1 year ago

Some applications use AVX-512 instructions if the CPU supports them without checking for OS support and windows 7 does not support them, would it be possible to filter the instruction set check to indicate that AVX-512 is not available?

Smu1zel commented 1 year ago

Isn't this OS independent? For example, Windows XP predated SSE3+, but can use it on systems that would eventually support it just fine. I also haven't found any apps that use AVX 512 in the wild unless you're compiling all your stuff manually with AVX 512 enabled. There might be another underlying issue with what you're trying to run, not a CPU SIMD.

CommanderLake commented 1 year ago

iirc The OS kernel needs to swap out the registers or something like that which requires explicit support for the register size, XMM YMM ZMM etc. and some programs only check for CPU support and just assume you have the latest version of windows.

Smu1zel commented 1 year ago

iirc The OS kernel needs to swap out the registers or something like that which requires explicit support for the register size, XMM YMM ZMM etc. and some programs only check for CPU support and just assume you have the latest version of windows.

Oh I get what you're saying, not sure if this is doable, but of course all I do really is report issues and reply to them, I wouldn't have a clue.

win32ss commented 1 year ago

Windows 7's API is not aware of AVX-512. If it were used to detect supported CPU features it would return "false" or ERROR_INVALID_PARAMETER or something.

They are probably using cpuid which would expose the CPU's AVX-512 support.

It wouldn't be easy to implement context switching support for the 512-bit zmm registers as there are probably internal structs containing the context information that lack entries for zmm registers. But NT 4 SP5 managed to implement SSEx using an external driver instead of writing code in ntoskrnl directly.

Another option is to write a user-mode emulator for context switching and AVX-512 instructions, using Windows' debugging API. This would also be useful for CPUs without AVX-512 support. I may implement a similar solution on Vista to cover all of AVX, as my main desktop CPU doesn't support AVX and some emulators now require AVX.