I have a process running on an Intel machine that supports AVX-512, but this process doesn't directly use any AVX-512 instructions (asm or intrinsics) and is compiled with -mno-avx512f
so that the compiler doesn't insert any AVX-512 instructions.
Yet, it is running indefinitely at the reduced AVX turbo frequency. No doubt there is an AVX-512 instruction sneaking in somewhere, via a library, (very unlikely) system call or something like that.
Rather than try to "binary search" down where the AVX-512 instruction is coming from, is there some way I can find it immediately, e.g., trapping on such an instruction?
OS is Ubuntu 16.04.
As suggested in comments, you may search all ELF files of your system and disassemble them in order to check if they use AVX-512 instructions:
(BTW, libc and ld.so do include AVX-512 instructions, they are not the ones you are looking for?)
However, you may find binary that you do not even execute and miss code dynamically uncompressed, etc...
If you have a doubt on process (because
perf
reportCORE_POWER.LVL*_TURBO_LICENSE
events), I suggest to generate a core-dump if this process and disassemble it (notice first line allows to also dump code):Next, you can easily write a small python script to add a breakpoint (or a tracepoint) on every AVX-512 instructions. Something like
Sure it will create multiple hundreds (or thousands) of breakpoints. However, overhead of a breakpoint is small enough for gdb to support that (I think <1kB for each breakpoint).
One another way would be to run your code in a a virtual machine. Especially, I suggest libvex. libvex is used to dynamically instrument code (memory leak, memory profiling, etc..). libvex interpret machine code, translate it to an intermediate representation and re-encode machine code for CPU execution. The most famous project using libvex is valgrind (to be fair, libvex is back-end of valgrind).
Therefore, you can run your application with libvex without any instrumentation with:
Now you have to write a tool around libvex in order to detect AVX-512 usage. However, libVEX does NOT (yet) support AVX-512. So, as soon as it have to execute AVX-512 instruction, it will fail with an Illegal instruction.
Note: this answer has been tested with: