Enhancing the Role of Inlining in Effective Interprocedural Parallelization

40
Enhancing the Role of Inlining in Effective Interprocedural Parallelization Jichi Guo, Mike Stiles Qing Yi, Kleanthis Psarris

description

Enhancing the Role of Inlining in Effective Interprocedural Parallelization. Jichi Guo, Mike Stiles Qing Yi, Kleanthis Psarris. Problem. Inter-procedural parallelization Parallel after inlining Gain more parallelizable loops Lost of parallelized loops - PowerPoint PPT Presentation

Transcript of Enhancing the Role of Inlining in Effective Interprocedural Parallelization

Page 1: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Enhancing the Role of Inlining in

Effective Interprocedural Parallelization

Jichi Guo, Mike StilesQing Yi, Kleanthis Psarris

Page 2: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problem• Inter-procedural parallelization

o Parallel after inlining• Gain more parallelizable loops• Lost of parallelized loops

o Inlining messes up caller / callee• Missed parallel opportunities

o Inlining increases code complexity

Page 3: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Goal• Keep the gain parallelizable loops• Prevent the lost parallelism• Discover the missed opportunities

Page 4: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Solution• Summarize the code using annotation

o Express the underlying information• Inline the annotation before parallelization

o Pass the summarized information to the compiler• Reverse-inline after parallelization

o Revert inlining side effectso Maintain equivalence

Page 5: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Outline• Innovations• Problems of parallel + inline strategy• Annotation language• Annotation-based inlining technique• Experiments• Summary

Page 6: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Outline• Innovations• Problems of parallel + inline strategy• Annotation language• Annotation-based inlining technique• Experiments• Summary

Page 7: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problems of parallel + inlining

• Parallel + inliningo Conventional inlining with heuristics and pre-transformations

• Heuristics: code size• Transformations: linearization, forward substitution

o Intra-procedural loop parallelization• Fortran do-all loop

• Goalo Gain loops in caller

• Problemso Lost loops in caller / calleeo Missed loops in caller

Page 8: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problems of parallel + inlining

• Lost of parallelizable loops in caller/calleeo Transformations that cause the lost

• Forward substitution• Linearization

• Forward substitution of non-linear subscriptso Create indirect array references

• Linearization of array dimensionso Mess up array shapes

Page 9: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problems of parallel + inlining

• Forward substitution of non-linear subscriptso Create indirect array referencesX2(I) ⇒ T(IX(7) + I)Y2(I) ⇒ T(IX(8) + I)Z2(I) ⇒ T(IX(9) + I)

Page 10: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problems of parallel + inlining

• Linearization of array dimensionso Mess up array shapesPP(i, j, k) ⇒ PP(i + j*4 + k*16)

Page 11: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problems of parallel + inlining

• Missed parallelizable loops in callero Coding styles that cause the lost

• Opaque compositional subroutineso A calls B, B calls C, C calls D, …

• Array accesso When it is difficult to determine which part is killed

• Debugging and Error Checkingo Statement that breaks the dependency is never executed

• I/O statements• Indirect array references

o ID=IDX(I), X = A(ID)

Page 12: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problems of parallel + inlining

• Opaque compositional subroutineso A calls B, B calls C, C calls D, …

Page 13: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problems of parallel + inlining

• Array accesso Difficult to determine which part is killedCTR computed at runtime

Page 14: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problems of parallel + inlining

• Debugging and Error Checkingo Statement that breaks the dependency is never executed

• I/O statements

Page 15: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Problems of parallel + inlining

• Indirect array referencesIN=>NODENODE=>IRELIREL=>RHSB

Page 16: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Outline• Innovations• Problems of parallel + inline strategy• Annotation language• Annotation-based inlining technique• Experiments• Summary

Page 17: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

The annotation language

• Goalo Summarize informationo Avoid ambiguity

Page 18: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

The annotation language

• Restricted grammar• Special operators• Writing annotations

Page 19: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

The annotation language

• Restricted grammaro Do-all loop onlyo No goto

Page 20: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

The annotation language

• Special operatorsy = operator(x1, x2, …, xn)Purpose: abstract relation

o Unknown operator• Relation is unknown

o Generic functionso Unique operator

• Relation is one-to-one, from X to Y

Page 21: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

The annotation language

• Writing annotationso Eliminating adverse side effects

• Preserve caller and callee if inlining breaks the dependency o Summarize opaque subroutines

• Eliminate nested function callso Array access

• Specify exact range get read/modifiedo Debugging and error handling

• Aggressive strategy: ignore checking statementso Indirect array references

• Discover unique relation

Page 22: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

The annotation language

• Summarize opaque subroutineso Eliminate nested function calls

Page 23: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

The annotation language

• Array accesso Specify exact range get read/modified

Page 24: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

The annotation language

• Debugging and error handlingo Aggressive strategy: ignore checking statements

Page 25: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

The annotation language

• Indirect array referenceso Discover unique relation

Page 26: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Outline• Innovations• Problems of parallel + inline strategy• Annotation language• Annotation-based inlining technique• Experiments• Summary

Page 27: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Annotation-based inlining

• Goalo Pass annotated information to the compilero Eliminate inlining side effects

• Flowo Inline before parallelizationo Reverse-inlining after parallelizationo Verify and evaluate at last

• Implementationo POLARIS compiler for parallelizationo ROSE compiler for parsingo POET transformero PERFECT benchmark

Page 28: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Annotation-based inlining

• Workflowo Annotation inlining ⇒ Parallelization ⇒ Reverse-inlining

Page 29: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Annotation-based inlining

• Inlining annotationo Steps

• Annotation ⇒ source languageo Translating special operators

• Inlinining generated source languageo Avoiding linearization

o Translating special operators• Unknown: using uninitialized global arrays• Unique: using linear expression

o Avoiding linearization

Page 30: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Annotation-based inlining

• Inlining annotation

Page 31: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Annotation-based inlining

• Parallelize do-all loops

Page 32: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Annotation-based inlining

• Reverse inlining

Page 33: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Annotation-based inlining

• Reverse inlining is indispensibleo Inlinining is restored to function call

• Avoid lost of parallelism in caller / callee• Enable abstraction operators (unknown, unique)

Page 34: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Annotation-based inlining

• Verification and evaluationo Correctness, Efficiency, and Generality

Page 35: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Outline• Innovations• Problems of parallel + inline strategy• Annotation language• Annotation-based inlining technique• Experiments• Summary

Page 36: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Experiment• Purpose

o What does conventional lining bring to parallelization• Gain?• Lost?• Missed?

o How good is annotation-based inlining to avoid above issues• Design

o PERFECT benchmarks (except SPEC77)o Two machines

• 8 cores Intel Mac• 4 cores AMD Operon

o End compiler• GFortran 4.2.1• IFort 11.1

• Resulto Count of Loopso Performance

Page 37: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Experiment• Result: Loops

o Conventional inlining• Having loss

o Annotation-based inlining• No loss, more gain

Page 38: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Experiment• Result: Performance

o Average speeduplimited

o Annot-based inliningalways better

Page 39: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Summary• Inter-procedural parallelization• Summarize effects of conventional inlining

o Gaino Losto Missed

• Propose annotation-based inliningo Annotation summaryo Enhanced inlining strategyo Reverse inlining

Page 40: Enhancing the Role of  Inlining  in Effective  Interprocedural  Parallelization

Thanks!Questions?