Training
Module
Learn how the semantic kernel SDK connects native code to large language models to create smart applications.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This information is intended for developers and build engineers who compile kernel-mode drivers for Windows. In Microsoft Visual Studio Professional 2012, the default architecture for the Visual C++ (VC++) compiler changed from IA32 to the Streaming SIMD Extensions 2 (SSE2) instruction set. As a result of this change, SSE2 floating point (FP) instructions injected into the binary at compile time can generate floating-point errors if not accounted for. The issue can be encountered by those who use the Microsoft VC++ compiler, or a custom build environment to develop Windows drivers. However, the issue does not affect developers who use the Microsoft Visual Studio development environment, or who use the MSbuild utility to build drivers with an unmodified toolset.
If you compile a driver without using the WDK, Visual Studio, and the recommended platform toolset for Windows drivers (WindowsKernelModeDriver8.0), the driver might not manage floating point operations correctly, even if the driver compiles without errors.
The Visual Studio Professional 2012 VC++ compiler emits code that uses the SSE2 instruction set by setting the /arch:sse2 compiler option. Starting with Visual Studio Professional 2012, this is the default option for x86 VC++ compiler code generation. Specifically, the default value changes from /arch:ia32 to /arch:sse2.
For applications this change generates code that performs better and uses less processor time during execution. However, for kernel-mode drivers this change will not manage the floating point (FP) state properly. This is due to the VC++ compiler introducing FP instruction sequences in places where the context has not been saved. Any binary floating-point system can represent only a finite number of floating-point values in exact form, with the rest being approximations. The floating-point control state, such as, rounding mode or precision, is what keeps FP operations in sync with each other. When the state is undefined, this leads to FP calculation errors. These calculation errors are hard to detect because in most cases application state corruption is the only sign of this issue. This corruption can manifest itself in many ways, ranging from random crashes to data corruption.
To avoid these problem with floating-point calculations, add the /kernel flag to the C++ compiler and linker command lines to prevent generating SSE2 instructions. The /kernel flag changes the default /arch:sse2 value back to /arch:ia32.
In addition, if you build a driver using the WDK and the Visual Studio Professional 2012 development environment, or use MSBuild, in a Visual Studio Command prompt window, the Microsoft provided platform toolset (WindowsKernelModeDriver8.0) sets the /kernel flag. As a result, floating-point generation errors are avoided.
msbuild myProject.vcxproj /p:PlatformToolset=WindowsKernelModeDriver8.0
Here are the recommended solutions based on the type of development environment you use:
Training
Module
Learn how the semantic kernel SDK connects native code to large language models to create smart applications.
Documentation
_get_FMA3_enable, _set_FMA3_enable
Learn more about: _get_FMA3_enable, _set_FMA3_enable
64-Bit Compiler - Windows drivers
64-Bit Compiler