版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、提升循環(huán)級并行IntelCopyright 2002 Intel Corporation1AgendaIntroductionWho Cares?DefinitionLoop Dependence and RemovalDependency Identification LabSummary2IntroductionLoops must meet certain criteriaIteration IndependenceMemory DisambiguationHigh Loop CountEtc3Who Cares實現(xiàn)真正的并行: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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 北部灣大學(xué)《數(shù)據(jù)結(jié)構(gòu)理論教學(xué)》2023-2024學(xué)年第一學(xué)期期末試卷
- 保山中醫(yī)藥高等??茖W(xué)?!吨兴幏治觥?023-2024學(xué)年第一學(xué)期期末試卷
- 2025版建筑項目風(fēng)險管理體系建設(shè)服務(wù)合同補(bǔ)充協(xié)議3篇
- 保山學(xué)院《食品工廠設(shè)計概論》2023-2024學(xué)年第一學(xué)期期末試卷
- 2025版古建筑修繕與保護(hù)施工合同2篇
- 2025年二零二五年度桉樹撫育與林業(yè)科技示范工程承包合同3篇
- 二零二五年度2025版特色二婚離婚房產(chǎn)分割協(xié)議示范
- 保定學(xué)院《港口與海岸水工建筑物》2023-2024學(xué)年第一學(xué)期期末試卷
- 2024年綜合型人才聘用協(xié)議范本一
- 保定學(xué)院《修復(fù)生態(tài)學(xué)》2023-2024學(xué)年第一學(xué)期期末試卷
- 采購合同范例壁布
- 公司員工出差車輛免責(zé)協(xié)議書
- 2024年陜西榆林市神木市公共服務(wù)輔助人員招聘775人歷年管理單位遴選500模擬題附帶答案詳解
- 2024年度抖音短視頻拍攝制作服務(wù)合同范本3篇
- 2024-2025學(xué)年高二上學(xué)期期末數(shù)學(xué)試卷(提高篇)(含答案)
- 安全生產(chǎn)事故案例分析
- 2024年07月22208政治學(xué)原理期末試題答案
- 期末檢測卷(一)(試卷)-2024-2025學(xué)年外研版(三起)英語六年級上冊(含答案含聽力原文無音頻)
- 《客戶開發(fā)技巧》課件
- 《防范于心反詐于行》中小學(xué)防范電信網(wǎng)絡(luò)詐騙知識宣傳課件
- 口腔執(zhí)業(yè)醫(yī)師定期考核試題(資料)帶答案
評論
0/150
提交評論