找回密码
 新注册用户
搜索
查看: 6248|回复: 6

[转帖] [物理减速] PhysX 以 x87 代码来拖慢 CPU

[复制链接]
发表于 2010-7-7 22:27:13 | 显示全部楼层 |阅读模式
原文:http://techreport.com/discussions.x/19216

Nvidia has long promoted its PhysX game physics middleware as an example of a computing problem that benefits greatly from GPU acceleration, and a number of games over the past couple of years have featured PhysX with GPU acceleration.  Those games have often included extra physics effects that, when enabled without the benefit of GPU acceleration, slow frame rates to a crawl.  With the help of an Nvidia GPU, though, those effects can usually be produced at fluid frame rates.

Nvidia 一直在推广它的 PhysX 物理游戏引擎作为 GPU 加速及其所带来的好处。过去几年有一些游戏应用了 PhysX 的 GPU 加速。这些游戏往往包括额外的物理效果,当没有 GPU 加速下开启此效果,帧速会变得非常缓慢。随着Nvidia的图形处理器的帮助,这些物理效果通常会变得顺畅。


We have noted in the past that some games implement PhysX using only a single thread, leaving additional cores and hardware threads on today's fastest CPUs sitting idle. That's true despite the fact that physics solvers are inherently parallel and are highly multithreaded by nature when executing on a GPU.

在过去我们注意到一些执行 PhysX 的游戏只使用一个线程,而拥有多核与多硬件线程的 CPU 变成其余核心闲置着。这是真的,尽管事实上 GPU 运行时物理运算器本身是具有高度的并行性和多线程的。


Now, David Kanter at RealWorld Technologies has added a new twist to the story by analyzing the execution of several PhysX games using Intel's VTune profiling tool.  Kanter discovered that when GPU acceleration is disabled and PhysX calculations are being handled by the CPU, the vast majority of the code being executed uses x87 floating-point math instructions rather than SSE. Here's Kanter's summation of the problem with that fact:

如今,RealWorld Technologies 的 David Kanter 为故事展现了更多曲折之处,他通过使用英特尔 VTune 分析器工具分析了几个 PhysX 物理游戏。Kanter 发现,当 GPU 加速被禁用而 PhysX 物理计算由 CPU 处理时,绝大多数被运行的代码是使用 x87 浮点运算指令,而不是极为常用的 SSE。这里是 Kanter 对问题概括:

x87 has been deprecated for many years now, with Intel and AMD recommending the much faster SSE instructions for the last 5 years. On modern CPUs, code using SSE instructions can easily run 1.5-2X faster than similar code using x87.  By using x87, PhysX diminishes the performance of CPUs, calling into question the real benefits of PhysX on a GPU.

x87 已经被废弃了很多年,英特尔和 AMD 在过去的 5 年都建议使用更快的 SSE 指令。在现代的 CPU,使用 SSE 指令的代码可以很容易的比使用 x87 类似代码时运行快 1.5 - 2 倍的速度。通过使用 x87,PhysX 物理削弱了 CPU 的性能,这让人质疑 GPU 对 PhysX 物理真正所带来的好处。


Kanter notes that there's no technical reason not to use SSE on the PC—no need for additional mathematical precision, no justifiable requirement for x87 backward compatibility among remotely modern CPUs, no apparent technical barrier whatsoever.  In fact, as he points out, Nvidia has PhysX layers that run on game consoles using the PowerPC's AltiVec instructions, which are very similar to SSE.  Kanter even expects using SSE would ease development: "In the case of PhysX  on the CPU, there are no significant extra costs (and frankly  supporting SSE is easier than x87 anyway)."

So even single-threaded PhysX code could be roughly twice as fast as it is with very little extra effort.

Kanter 指出在技术上没有任何阻碍,在电脑上使用 SSE指令集的 CPU 不须要额外为 x87 向后兼容的需要而付出性能损耗,更重要的是SSE并不是一个封闭的技术壁垒。事实上,他指出 NVIDIA 的 PhysX 引擎已经在游戏机使用与 SSE 非常类似的 PowerPC 的 AltiVec 指令。Kanter 还预计使用 SSE 将使开发更容易:“在 CPU 运行 PhysX 物理的情况下,没有明显的额外性能损耗(坦白地说支持 SSE 反正是比 x87 容易)。”

因此,即使单线程 PhysX 物理代码也可以很容易的实现两倍的速度。


Between the lack of multithreading and the predominance of x87 instructions, the PC version of Nvidia's PhysX middleware would seem to be, at best, extremely poorly optimized, and at worst, made slow through willful neglect.  Nvidia, of course, is free to engage in such neglect, but there are consequences to be paid for doing so.  Here's how Kanter sums it up:

在缺乏多线程和已经老掉牙的 x87 指令集支持下,PC 版本的 NVIDIA的 PhysX 物理引擎似乎是连最简单的优化都没有做,用更坏点的揣测,它是通过故意的措施造成CPU运行缓慢。 Nvidia,当然可以继续这种做法,但是要为此付出代价的。以下是 Kanter 的总结:

The bottom line is that Nvidia is free to hobble PhysX on the CPU by  using single threaded x87 code if they wish.  That choice, however, does  not benefit developers or consumers though, and casts substantial  doubts on the purported performance advantages of running PhysX on a  GPU, rather than a CPU.

Nvidia 当然可以继续运行 PhysX 物理时用单线程的 x87 代码来拖慢 CPU,如果这是他们想要的。然而这种选择将不利于开发商或者消费者,使人们对 GPU 对比 CPU 运行 PhysX 物理时的性能优势产生怀疑。


Indeed.  The PhysX logo is intended as a selling point for games taking full advantage of Nvidia hardware, but it now may take on a stronger meaning: intentionally slow on everything else.

事实上。PhysX 引擎的商标本来就是作为 Nvidia 硬件在游戏应用上的一个很大的卖点,但它现在可能暗示着另一个更重要的含义:在其他一切(非它自己的)硬件上故意拖慢。
回复

使用道具 举报

发表于 2010-7-8 15:54:03 | 显示全部楼层
本帖最后由 WiZarD811 于 2010-7-8 15:59 编辑
原文:

事实上。PhysX 引擎的商标本来就是作为 Nvidia 硬件在游戏应用上的一个很大的卖点,但它现在可能暗示着另一个更重要的含义:在其他一切(非它自己的)硬件上故意拖慢。
射命丸 文 发表于 2010-7-7 22:27




跟我想的一样!以前微机杂志上就有人用a卡欺骗phyx驱动跑虚幻竞技场(单A卡不混交)……和N卡的效果一模一样……也就是说,Phyx和架构无关



原文:

Kanter 指出在技术上没有任何阻碍,在电脑上使用 SSE指令集的 CPU 不须要额外为 x87 向后兼容的需要而付出性能损耗,更重要的是SSE并不是一个封闭的技术壁垒。事实上,他指出 NVIDIA 的 PhysX 引擎已经在游戏机使用与 SSE 非常类似的 PowerPC 的 AltiVec 指令。Kanter 还预计使用 SSE 将使开发更容易:“在 CPU 运行 PhysX 物理的情况下,没有明显的额外性能损耗(坦白地说支持 SSE 反正是比 x87 容易)。”
射命丸 文 发表于 2010-7-7 22:27



这就能解释为什么XBOX360用了ati显卡却能跑出Phyx特效
回复

使用道具 举报

发表于 2010-7-8 17:31:40 | 显示全部楼层
聪明的英伟达 就和AMD 和INTEL一样。大家都差不多,谁也别笑谁。消费者爱买谁是谁。
回复

使用道具 举报

头像被屏蔽
发表于 2010-7-8 18:59:59 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2010-7-8 19:32:13 | 显示全部楼层
企业界做这些都太常见了

FAH可能是基于精度考虑用x87。x86平台只有x87能提供80bit浮点
回复

使用道具 举报

上边和下边 该用户已被删除
发表于 2010-7-10 02:14:34 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

徐杨数码 该用户已被删除
发表于 2010-7-10 02:14:55 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 新注册用户

本版积分规则

论坛官方淘宝店开业啦~

Archiver|手机版|小黑屋|中国分布式计算总站 ( 沪ICP备05042587号 )

GMT+8, 2024-4-28 15:37

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表