























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concept of predicated execution and its effective compiler support through the use of hyperblocks. The authors, s. Mahlke et al., present the concept of predicated code and the assumptions required to make it work. They also discuss the use of or-type predicates and their importance in generating predicated code. The document also covers the handling of arbitrary complex graphs and the steps involved in control dependence analysis, backedge coalescing, and control flow substitution.
Typology: Study notes
1 / 31
This page cannot be seen from the preview
Don't miss anything!
























Reading Material^ Y^ Today’s class
Recap: CMPP Action Specifiers
Recap: OR-type, AND-type Predicates^ p1 = 0^ p1 = cmpp_ON (r1 < r2) if T^ p1 = cmpp_OC (r3 < r4) if T^ p1 = cmpp_ON (r5 < r6) if T^ p1 = (r1 < r2) | (!(r3 < r4)) |^ (r5 < r5)^ Wired-OR into p
Generating predicated code for some source code requires OR-type predicates
Talk about these later – used for control height reduction
Class Problem^ w = w + 1^ if (a == 0 || b <= 1)
If-conversion^ Y^ Algorithm for generating predicated code
But, acyclic subgraph only!! y Need a branch to get you back to the top of a loop
Step 1: Backedge Coalescing^ Y^ Recall – Loop backedge is branch from inside the loopback to the loop header^ Y^ This step only applicable for a loop body
Running Example – Backedge Coalescing
BB2c > 0^ c <= 0 b <= 13
c <= 25^
c > 25 d++ b++^
c++
c > 25 c <= 25 c++
BB1 b < 0 b >= 0^ BB3^ BB b > 13
e < 34 e >= 34 a++
e++^ BB
BB2c > 0^ c <= 0 BB4b <= 13^ BB
BB1 b < 0 b >= 0^ BB
e++
b > 13 b++
d++^ BB^
a++ e < 34
e >= 34
Control Dependences^ Y^ Recall
Control Dependence Example
Control dependences BB1: BB2: BB3: BB4: BB5: BB6: BB7: BB
Notation positive BB number = fallthru direction^ negative BB number = taken direction BB
Algorithm for Control Dependence Analysis^ for each
basic block x in region for each^ outgoing control flow edge e of x y = destination basic block of e if (y not in pdom(x)) then lub = ipdom(x) if^ (e corresponds to a taken branch) then^ x_id = -x.id else^ x_id = x.id endif t = y while^ (t != lub) do^ cd(t) += x_id;^ t = ipdom(t) endwhile endif endfor endfor
Notes Compute cd(x) which contains those BBs which x is control dependent on^ Iterate on per edge basis, adding^ edge to each cd set it is a member of
Running Example – Post Dominators^ Entry
b < 0^
b >= 0 BB2c > 0^ c <= 0 b <= 13
c <= 25^
c > 25 d++
e++ BB3 (^) c++
BB4 b > 13 BB^
b++
a++^ BB
e < 34^
Exit
Running Example – CDs Via Algorithm (2)
x = 3e = taken edge 3
y = 8y not in pdom(x)lub = 9x_id = -3t = 88 != 9cd(8) += -3t = 99 == 9 3 Æ^ 8 edge (aka -3)
Entry^
BB1 b < 0 b >= 0 BB2 c <= 0 c > 0
b <= 13
c <= 25^
c > 25 d++
e++ BB3 (^) c++
BB4 b > 13 BB^
b++
Class Problem: 1
Æ^ 3 edge (aka 1)
a++^ BB
e < 34^
Exit
Running Example – CDs Via Algorithm (3)^ Entry
b < 0^
b >= 0 BB2c > 0^ c <= 0 b <= 13
c <= 25^
c > 25 d++
e++ BB3 (^) c++
BB4 b > 13 BB^
b++
a++^ BB
e < 34^
Exit