13.07.2015 Views

automatically exploiting cross-invocation parallelism using runtime ...

automatically exploiting cross-invocation parallelism using runtime ...

automatically exploiting cross-invocation parallelism using runtime ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Algorithm 5: Pseudo-code for SPECCROSS Library Function Calls Insertion1: Input P arallelLoops: Doallable or Localwritable loops in a SPECCROSS code region2: Input CrossInvocationDeps: <strong>cross</strong>-<strong>invocation</strong> dependences3: for all Loop l ∈ P arallelLoops do4: blocks = getBasicBlocks(l)5: // get the loop preheader and header6: preheader = getLoopP reheader(l)7: header = getLoopHeader(l)8: // get the loop exit basic blocks9: loopExits = getLoopExitBlocks(l)10: // get the basic blocks containing the loop backedge11: backEdgeBlocks = getBackEdgeBlocks(l)12: // insert enter barrier13: insertP t = BeginningOfBlock(preheader);14: insertEnterBarrier(insertP t);15: // insert enter task16: insertP t = BeginningOfBlock(header);17: insertEnterT ask(insertP t);18: // insert exit task19: for all basic block block ∈ blocks do20: termInst = getT erminatorInst(block)21: inertP t = Before(termInst);22: if block ∈ loopExits then23: if isUnconditional(termInst) ‖ block ∈ backEdgeBlocks then24: insertExitT ask(insertP t);25: else26: insertInvokeExitT askW henExitT aken(insertP t);27: end if28: else if block ∈ backEdgeBlocks then29: if isUnconditional(termInst) then30: insertExitT ask(insertP t);31: else32: insertInvokeExitT askW henBackEdgeT aken(insertP t);33: end if34: end if35: end for36: end for37: // insert spec access38: for all Dependence dep ∈ CrossInvocationDeps do39: srcInst = getSrcInstruction(dep);40: dstInst = getDstinstruction(dep);41: srcAddress = getAddress(srcInst);42: dstAddress = getAddress(dstInst);43: insertP t = Before(srcInst);44: insertSpecAccess(insertP t);45: insertP t = Before(dstinst);46: insertSpecAccess(insertpt);47: end for72

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!