Introduction to Data-Oriented Design.ppt
《Introduction to Data-Oriented Design.ppt》由会员分享,可在线阅读,更多相关《Introduction to Data-Oriented Design.ppt(28页珍藏版)》请在麦多课文档分享上搜索。
1、Introduction to Data-Oriented Design,So what is this Data-Oriented Design?,Its about on shifting focus to how data is read and written,Why should we care?,Performance,A read from memory takes 600 cycles at 3.2 GHz,A read from memory takes 40 cycles at 300 MHz,Performance,Disks (Blu-ray/DVD/HDD),Main
2、 Memory,L2 Cache,L1 Cache,CPU / Registers,Latency,:(,600 cycles,40 cycles,1 2 cycles,Multithreading,Object,Read?,Write?,Object,update(),Object,Cannot multithread without knowing how data is touched Adding locks always protects data not code,Read?,Write?,Read?,Write?,Offloading to co-unit,?,SPU/GPU/A
3、PU,?,If data is unknown hard/impossible to run on co-unit,Better design,Data focus can lead to isolated, self-contained, interchangeable pieces of data and code This can make it easier to test data and code in isolation,Example - OOD,class Bot .Vec3 m_position;.float m_mod;.float m_aimDirection;.voi
4、d updateAim(Vec3 target)m_aimDirection = dot3(m_position, target) * m_mod; ,icache-miss,data-miss,Unused cached data,Very hard to optimize!,Example - OOD,void updateAim(Vec3 target) m_aimDirection = dot3(m_position, target) * m_mod; ,Lets say we call this code 4 times (4 diffrent Bots),iCache 600,m_
5、position 600,m_mod - 600,aimDir 100,20 cycles,iCache 600,m_position 600,m_mod - 600,aimDir 100,iCache 600,m_position 600,m_mod - 600,aimDir 100,iCache 600,m_position 600,m_mod - 600,aimDir 100,7680,Example - DOD,Design ”back to front” and focus on the output data Then add the minimal amount of data
6、needed to do the transform to create the correct output,Example - DOD,void updateAims(float* aimDir,const AimingData* aim,Vec3 target, uint count) for (uint i = 0; i positionsi,target) * aim-modi; ,Only read needed inputs,Write to linear array,Loop over all the data,Actual code unchanged,What has ch
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- INTRODUCTIONTODATAORIENTEDDESIGNPPT
