The Intel® Software Development Emulator (Intel® SDE) includes a software validation mechanism to restrict executed instructions to a particular microprocessor. This is intended to be a helpful diagnostic tool for use when deploying new software. Use chip check when you want to make sure that your program is not using instruction features that are not present on a specific microarchitecture implementation.
In the output of "sde -long-help" there is a section describing the controls for this feature:
-chip_check [default ] Restrict to a specific XED chip. -chip_check_die [default 1] Die on errors. 0=warn, 1=die -chip_check_disable [default 0] Disable the chip checking mechanism. -chip_check_emit_file [default 0] Emit messages to a file. 0=no file, 1=file -chip_check_file [default sde-chip-check.txt] Output file chip-check errors. -chip_check_jit [default 0] Check during JIT'ing only. Checked code might not be executed due to speculative JIT'ing, but this mode is a little faster. -chip_check_list [default 0] List valid chip names and exit. -chip_check_stderr [default 1] Try to emit messages to stderr. 0=no stderr, 1=stderr -chip_check_vsyscall [default 0] Enable the chip checking checking in the vsyscall area.
To list all the chips that Intel SDE knows about, you can use "sde -chip-check-list". The output will vary depending on the version of Intel SDE you use. For the current version, you will see this output:
% kits/current/sde -chip-check-list -- /bin/ls INVALID I86 I86FP I186 I186FP I286REAL I286 I2186FP I386REAL I386 I386FP I486REAL I486 PENTIUMREAL PENTIUM PENTIUMMMXREAL PENTIUMMMX ALLREAL PENTIUMPRO PENTIUM2 PENTIUM3 PENTIUM4 P4PRESCOTT P4PRESCOTT642 P4PRESCOTT2M CORE2 PENRYN PENRYN_E NEHALEM WESTMERE BONNELL SALTWELL SILVERMONT AMD KNL IVYBRIDGE SANDYBRIDGE SKYLAKE BROADWELL HASWELL GOLDMONT ALL
To limit instructions to the Intel Westmere microarchitecture, use "sde -chip-check WESTMERE -- yourapp". If you do not want to limit instructions to a particular chip, "-chip-check ALL". To limit the allowed instructions to just those implemented on on the current Intel(R) Quark processors, use "-chip-check PENTIUM".
By default, Intel SDE emits warnings to a file called sde-chip-check.txt and also to stderr (if the application has not closed stderr). This behavior can be customized using the above knobs.
On linux, there are instructions in the virtual system call area that are not under direct user control. To avoid flagging those instructions, the chip check mechanism defaults to ignoring instructions that region. If you wanted to check the instructions in the vsyscall area for some reason, use "-chip-check-vsyscall".
There is a performance cost for using the chip-check feature. At instrumentation (JIT) time, we must do an extra check on each instruction. And at run time every instruction that is not valid for particular chip gets code inserted before it to trigger the error (or warning). There is also a JIT time code to finding the function symbols (if any) associated with the unwanted instructions.
Using the "-chip-check-jit" option, the JIT instrumentor can report disallowed instructions at JIT instrumentation time. This may be too aggressive as the JIT speculates and the JITted code may never execute due to the dynamic control flow in the program. It is more conservative though if you want to be sure there are no unwanted instructions.
Here is a little example of the error message you get when your program does not have symbols:
% kits/current/sde -chip-check PENTIUM -- /bin/ls TID 0 SDE-ERROR: Executed instruction not valid for specified chip (PENTIUM): 0x2b3db3fdc447: cmovnbe rdx, rax Instruction bytes are: 48 0f 47 d0
If your program was compiled in debug mode or has function symbols, Intel SDE tries to provide additional information when it reports problems. This can be very useful for figuring out where the unwanted instructions are coming from.
kits/current/sde -chip-check IVYBRIDGE -- tests/a.out TID 0 SDE-ERROR: Executed instruction not valid for specified chip (IVYBRIDGE): 0x400623: vfmadd231sd xmm1, xmm2, xmm3 Function: main File Name: /tmp/fma1.c:36 Instruction bytes are: c4 e2 e9 b9 cb
In binaries without debug symbols, sde will still show the function name when it can be located.
By default, Intel SDE issues the above error message and terminates when it encounters an unwanted instruction. Sometimes there are more than one unwanted instruction in large program. By using the "-chip-check-die 0" option, Intel SDE will continue to execute after reporting the error.
If an unwanted instruction is not executed, it will not be flagged by Intel SDE. Intel SDE is built upon the Pin dynamic binary instrumentation system. Pin is JIT for the application being run. As with all path-based checking mechanisms, you must exercise any code paths if you want them to be checked.
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.
Notice revision #20110804