PCDVD數位科技討論區
PCDVD數位科技討論區   註冊 常見問題 標記討論區為已讀

回到   PCDVD數位科技討論區 > 電腦硬體討論群組 > 顯示卡討論區
帳戶
密碼
 

回應
 
主題工具
jordanpchome
Senior Member
 
jordanpchome的大頭照
 

加入日期: Jan 2007
文章: 1,023
PhysX hobbled on the CPU by x87 code (PhysX 以 x87 代码来拖慢 CPU)

轉自CHH論壇

原文: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線程,而擁有多核與多硬件線程的 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 硬件在遊戲應用上的一個很大的賣點,但它現在可能暗示著另一個更重要的含義:在其他一切(非它自己的)硬件上故意拖慢。

----------------------------

這就是為啥NV要砲Intel的原因嗎
     
      
__________________
懷念ATI,懷念第一次的感動

~燦坤卡號歡迎取用~
60061360

----------------------
2022/03/27

CPU:AMD Ryzen 9 5950X
MB:ASUS ProArt X570-Creator WiFi
RAM:A-DATA DDR4 3200 ECC 32G*4
VGA:AMD Radeon Vega Frontier Edition*2
SSD:PLEXTOR M9PeGn 512GB
Power:Leadex Titanium 1000W
舊 2010-07-10, 04:56 PM #1
回應時引用此文章
jordanpchome離線中  
seafood&rush
Junior Member
 

加入日期: Jun 2005
文章: 786
應該是反過來~intel砲nv的原因,
因為是cpu沒發揮能力
 
舊 2010-07-10, 06:59 PM #2
回應時引用此文章
seafood&rush離線中  
u3350829
Master Member
 

加入日期: Jun 2002
文章: 2,332
Red face

這應該不是故意用FPU的舊指令集來拖慢CPU...
純粹是Physx被N家收購之後就停止了一切對CPU加速的研發,
畢竟對N家一點好處都沒有,所以就變成現在這樣的情況,反
正N家覺得錢都是我在花怎麼可能爽到別人...商業手段很正常.
不過有一點在下不知道有沒有記錯...太久沒有寫組語了,印象
中如果程式使用了FPU的舊指令集那SSE/SSE2那邊會無法使
用得等這些指令跑完(無法同時平行跑),如果沒記錯的話可能
還不只是拖慢而已根本是慢車路隊長了XD~
__________________
Es muss sein!
舊 2010-07-10, 07:43 PM #3
回應時引用此文章
u3350829離線中  
okana
Power Member
 

加入日期: Nov 2005
文章: 604
SSE早在P4時代就很流行了
到AGEIA開發時沒有道理不用SSE
而去用失敗的X87
舊 2010-07-10, 07:52 PM #4
回應時引用此文章
okana離線中  
chowtom
Master Member
 

加入日期: Sep 2001
文章: 2,462
引用:
作者okana
SSE早在P4時代就很流行了
到AGEIA開發時沒有道理不用SSE
而去用失敗的X87

AGEIA也"很有可能"基於跟NV相同的原因而選擇使用較慢的X87指令來開發
想想看 要是CPU就能跑得很好的話
AGEIA當初卡要賣誰?(雖然當初也是賣得很差.....)
舊 2010-07-10, 08:58 PM #5
回應時引用此文章
chowtom離線中  
chowtom
Master Member
 

加入日期: Sep 2001
文章: 2,462
引用:
作者u3350829
這應該不是故意用FPU的舊指令集來拖慢CPU...
純粹是Physx被N家收購之後就停止了一切對CPU加速的研發,
畢竟對N家一點好處都沒有,所以就變成現在這樣的情況,反
正N家覺得錢都是我在花怎麼可能爽到別人...商業手段很正常.
不過有一點在下不知道有沒有記錯...太久沒有寫組語了,印象
中如果程式使用了FPU的舊指令集那SSE/SSE2那邊會無法使
用得等這些指令跑完(無法同時平行跑),如果沒記錯的話可能
還不只是拖慢而已根本是慢車路隊長了XD~

既然這樣的話 把PhysX的執行緒鎖死給一個核心
遊戲執行緒鎖定給其他核心不要來用PhysX用的核心
這樣不曉得能不能達到"加速效果" 反正現在CPU核心多
您文中所述"如果程式使用了FPU的舊指令集那SSE/SSE2那邊會無法使用得等這些指令跑完(無法同時平行跑)"應該是針對單一核心而言吧? 總不會是整個OS一起影響?
舊 2010-07-10, 09:02 PM #6
回應時引用此文章
chowtom離線中  
GT2 RS
*停權中*
 

加入日期: Jul 2010
文章: 68
http://www.coolaler.com/showthread.php?t=242776

老黃是虧心事幹太多嗎?要出新顯卡被爆料
舊 2010-07-10, 09:57 PM #7
回應時引用此文章
GT2 RS離線中  
u3350829
Master Member
 

加入日期: Jun 2002
文章: 2,332
Red face

引用:
作者okana
SSE早在P4時代就很流行了
到AGEIA開發時沒有道理不用SSE
而去用失敗的X87


AGEIA開發時比2005年之前還要早,而且PhysX有部份dll裡面包的根本
是超古早以前的東西,可見的有很多部份根本沒有改過XD~


引用:
作者okana
既然這樣的話 把PhysX的執行緒鎖死給一個核心
遊戲執行緒鎖定給其他核心不要來用PhysX用的核心
這樣不曉得能不能達到"加速效果" 反正現在CPU核心多
您文中所述"如果程式使用了FPU的舊指令集那SSE/SSE2那邊會無法使用得等這些指令跑完(無法同時平行跑)"應該是針對單一核心而言吧? 總不會是整個OS一起影響?


這有相當的困難度...要看遊戲本身怎麼寫/
會有這種問題主因應該是當初PhysX本身的開發對象不僅僅是針對X86架構
的CPU,應該是想要包山包海能跨平台,開發出基礎第一代之後根本沒有繼
續針對X86 CPU做最佳化造成的吧! NV收買之後又只對GPU加速有興趣XD

--------------------------------------------------------------------------
現在PhysX在遊戲裡面最大的問題是很多標榜有應用此技術的game卻不是
用GPU去運算PhysX,很大部份還是CPU慢慢算算到死XD,相信這部份才是
大家應該要去酸NV的,如果未來PhysX能真的是GPU運算80%以上,然後
純CPU去跑PhysX爆慢的話,在下覺得就沒什麼好酸好抱怨的了,畢竟出錢
出力的NV....但是現在這種情況來說...請繼續酸
__________________
Es muss sein!
舊 2010-07-11, 01:07 AM #8
回應時引用此文章
u3350829離線中  


回應


POPIN
主題工具

發表文章規則
不可以發起新主題
不可以回應主題
不可以上傳附加檔案
不可以編輯您的文章

vB 代碼打開
[IMG]代碼打開
HTML代碼關閉



所有的時間均為GMT +8。 現在的時間是01:15 AM.


vBulletin Version 3.0.1
powered_by_vbulletin 2025。