|
关于在CELL上消除分支的方法:
http://www.cellperformance.com/a ... elimination_pa.html
其实上次我就问过你说的AI到底是指哪种?专家系统还是图形分析系统,如果是专家系统,Cell可能不如XCPU,如果是图形分析系统,Cell还是非常适合的,例如Influence Mapping,在现在的游戏中,Pathfinding是最消耗AI资源的,如果对若干个点作lines of sight侦测,传统的CPU都会消耗很多的资源。
在CELL上面如果要侦测A是否看到B,可以以A视点到B窗口的中心渲染一个低分辨的render target纹理,例如64X64,然后对同样的窗口用伪色渲染,这个用来侦测Window中B的“部分“是否暴露了,这就是电脑可视化计算了,SPE的强项,IBM当初的几个CELL实例文件中就有一个关于监控系统。这里的轮廓,也可以是阴影、烟雾、伪装等。
而且对大多数的游戏来说,AI是允许一定的延时,不需要在0.00X秒内马上作出反应。
H Peter Hofstee是这样回答我的:
- It is an easy misperception to think of an SPE as a SIMD(vector) only processor. IT IS NOT. Just because we have unified the register file does not mean you have to use SIMD. ( An x86 with SSE or a 970 with VMX is still perfectly ok to use for scalar code and so is the SPE). Compilers support scalar code just fine.
- This SPE implementation has only trivial hardware branch prediction (because large branch prediction structures do not provide a good return on investment in terms of area and power ... better to have more SPEs). Still we do care a lot about idle cycles due to branches, so there is a nice branch hint instruction (architecturally a no-op) that notifies the instruction fetch unit that at address x a branch will end up at address y. Also we support the select instruction that often allows one to eliminate a branch altogether.
- With respect to AI, I don't have the answers, but I have good hope. I think AI is usually not bound by computation but by memory access penalties (on high-frequency processors). I can imagine tree search algorithms for the SPEs that absolutely rock, by getting a lot of memory accesses in flight concurrently. There may be a patent out there by M. Necker and myself that describes some of this for the case of routing table accesses ( also a kind of tree search ). |
|