Saw this article on Tech Report and thought it was interesting. I’ve always wondered why PhysX couldn’t be implemented on the CPU and it looks like there’s no real reason.
In this Real Time World Technologies article, the author discovered that a majority of the code for PhysX used x87 floating point instructions.
What is x87?
The x87 floating point instructions are positively ancient, and have been long since deprecated in favor of the much more efficient SSE2 instructions (and soon AVX). Intel started discouraging the use of x87 with the introduction of the P4 in late 2000. AMD deprecated x87 since the K8 in 2003, as x86-64 is defined with SSE2 support; VIA’s C7 has supported SSE2 since 2005. In 64-bit versions of Windows, x87 is deprecated for user-mode, and prohibited entirely in kernel-mode. Pretty much everyone in the industry has recommended SSE over x87 since 2005 and there are no reasons to use x87, unless software has to run on an embedded Pentium or 486.
No Technical Reason to Run on x87
The truth is that there is no technical reason for PhysX to be using x87 code. PhysX uses x87 because Ageia and now Nvidia want it that way. Nvidia already has PhysX running on consoles using the AltiVec extensions for PPC, which are very similar to SSE. It would probably take about a day or two to get PhysX to emit modern packed SSE2 code, and several weeks for compatibility testing. In fact for backwards compatibility, PhysX could select at install time whether to use an SSE2 version or an x87 version – just in case the elusive gamer with a Pentium Overdrive decides to try it.
It may not be as effective as running on a fast GPU, but it would be better than it is now if it were properly optimized and not running on x87 instructions. Multi-threaded CPUs are already underutilized in modern PC gaming and proprietary tactics like this (intentional or not) do not help things.
Of course, this is NVIDIA’s baby and they could raise it however they wish. The real takeaway from this little debacle is the need for some kind of physics standard like what we have for graphics. I wonder who will step up.