版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、提升循环级并行IntelCopyright 2002 Intel Corporation1AgendaIntroductionWho Cares?DefinitionLoop Dependence and RemovalDependency Identification LabSummary2IntroductionLoops must meet certain criteriaIteration IndependenceMemory DisambiguationHigh Loop CountEtc3Who Cares实现真正的并行:OpenMPAuto Parallelization显式的指
2、令级并行 ILP (Instruction Level Parallelism)Streaming SIMD (MMX, SSE, SSE2, )Software Pipelining on Intel Itanium ProcessorRemove Dependencies for the Out-of-Order CoreMore Instructions run in parallel on Intel Itanium-Processor自动编译器并行High Level Optimizations4Definitionint aMAX;for (J=0;JMAX;J+) aJ = bJ
3、;Loop Independence: Iteration Y of a loop is independent of when or whether iteration X happens5图例OpenMP: True ParallelismSIMD: VectorizationSWP: Software PipeliningOOO: Out-of-Order Core ILP: Instruction Level Parallelism Green: Benefits from concept Yellow: Some Benefits from Concept Red: No Benef
4、it from Concept 6AgendaDefinitionWho Cares?Loop Dependence and RemovalData DependenciesRemoving DependenciesData Ambiguity and the CompilerDependency Removal LabSummary7Flow DependencyRead After WriteCross-Iteration Flow Dependence: Variables written then read in different iterationsfor (J=1; JMAX;
5、J+) AJ=AJ-1;A1=A0;A2=A1;8Anti-DependencyWrite After ReadCross-Iteration Anti-Dependence: Variables written then read in different iterationsfor (J=1; JMAX; J+) AJ=AJ+1; A1=A2;A2=A3;9Output DependencyWrite After WriteCross-Iteration Output Dependence: Variables written then written again in a differe
6、nt iterationfor (J=1; JMAX; J+) AJ=BJ;AJ+1=CJ;A1=B1;A2=C1;A2=B1;A3=C1;10IntraIteration DependencyDependency within an iterationHurts ILPMay be automatically removed by compilerK = 1;for (J=1; JMAX; J+) AJ=AJ + 1;BK=AK + 1;K = K + 2; A1 = A1 + 1;B1= A1 + 1;11for (J=1; JMAX; J+) AJ= A0 + J;Remove Depe
7、ndenciesBest ChoiceRequirement for true ParallelismNot all dependencies can be removedfor (J=1; JMAX; J+) AJ=AJ-1 + 1;12for (J=1;JMAX;J+=2) AJ=AJ-1 + BJ;AJ+1=AJ-1 + (BJ + BJ+1);Increasing ILP, without removing dependencies Good: Unroll LoopMake sure the compiler cant or didnt do this for youCompiler
8、 should not apply common sub-expression elimination Also notice that if this is floating point data - precision could be alteredfor (J=1;JMAX;J+) AJ =AJ-1 + BJ;13Induction VariablesInduction variables are incremented on each trip through the loopFix by replacing increment expressions with pure funct
9、ion of loop indexi1 = 0;i2 = 0;for(J=0,JMAX,J+) i1 = i1 + 1; B(i1) = i2 = i2 + J; A(i2) = for(J=0,JMAX,J+) B(J) = . A(J*2 + J)/2)= .14ReductionsReductions collapse array data to scalar data via associative operations:Take advantage of associativity and compute partial sums or local maximum in privat
10、e storageNext, combine partial results into shared result, taking care to synchronize accessfor (J=0; JMAX; J+) sum = sum + cJ;15Data Ambiguity and the Compilervoid func(int *a, int *b) for (J=0;JMAX;J+) aJ = bJ;Are the loop iterations independent?The C+ compiler has no ideaNo chance for optimizatio
11、n - In order to run error free the compiler assumes that a and b overlap16Function Callsfor (J=0;J=0;J-) compute(J,.) A Simple TestReverse the loop order and rerun in serialIf results are unchanged, the loop is Independent*for(J=0;JMAX;J+) compute(J,.) *Exception: Loops with induction variablesReverse19SummaryLoop Independence: Loop Iterations are independent of each other.Explained its importanceILP and Para
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 丽江文化旅游学院《计算机组成原理》2023-2024学年第一学期期末试卷
- 疝气护理课件
- 我的家乡吉林四平
- 广东署山市2023-2024学年高二物理上学期开学考试含解析
- 千与千寻英语课件
- 腿骨折的临床特征
- 昆明理工大学《物流系统建模与仿真》2021-2022学年第一学期期末试卷
- 两高司法解释重点条款修订对涉税刑事辩护的影响
- 矛盾是事物发展的源泉和动力(课课件)
- 链球菌中毒性休克综合征的临床特征
- 个人和企业间资金拆借合同
- 重大火灾隐患判定方法
- 2024年除雪服务定制协议样本版
- 七年级地理上册 3.2海陆变迁说课稿 (新版)商务星球版
- 勿忘国耻 珍爱和平-9.18学生教育主题班会高中主题班会课件
- 地铁司机岗位招聘笔试题与参考答案
- 2024年电工(高级技师)考前必刷必练题库500题(含真题、必会题)
- 2024秋期国家开放大学专科《统计学原理》一平台在线形考(形成性考核一至三)试题及答案
- 2024年《浙江省政治学考必背内容》(修订版)
- 《工业产品销售单位落实质量安全主体责任监督管理规定》(60题)
- 反射疗法师理论考试复习题及答案
评论
0/150
提交评论