If the compiler understands the nature of the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: occur before B to achieve correct behavior, Dhen there is a dependence t an Grossman Dan Grossman edge from A to B. Fall 2011 Fall 2011 –  Aà༎B means compiler can’t move B before A. –  Granularity of nodes varies. Depends on abstrac@on level of rest of IR. E.g., nodes could be loads/stores, or whole statements. –  E.g., a = 2; b = 2; c = a + 7; •  Where’s the dependence? Winter 2013 UW CSE 401 (Michael Ringenburg) 24 Types of dependencies CSE341: Programming Languages •  Read- aher- write CSE341: Programming Languages (RAW)/“flow dependence” –  E.g., a = 7; b = a + 1; Lecture 1 Lecture 1 –  The read of ‘a’ must follow the write to ‘a’, otherwise it won’t Course Course Mechanics Mechanics see the correct value. ML Variable Bindings •  Write- aher- read (WAR)/“an@ dependence” ML Variable Bindings –  E.g., b = a * 2; a = 5; D ead of ‘a’, otherwise the read –  The write to ‘a’ must follow the ran Grossman Dan Grossman Fall 2011 won’t see the correct 2011 value. Fall •  Write- aher- write (WAW)/“output dependence” –  E.g., a = 1; … a = 2; … –  The writes to ‘a’ must happen in the correct order, otherwise ‘a’ will have the wrong final value. •  What about RAR/”input dependence”?? Winter 2013 UW CSE 401 (Michael Ringenburg) 25 Loop- Carried Dependence CSE341: Programming CSE341: Programming dependence across •  Loop carried dependence: ALanguages Languages itera@ons of a loop Lecture 1 Lecture 1 Course for Course<Mechanics Mechanics (i = 0; i size; i++) Mx = foo(x); Bindings L Variable ML Variable Bindings Dan the read •  RAW loop carried dependence: Grossman of ‘x’ depends Dan Grossman Fall itera@on on the write of ‘x’ all 2011 previous 2011 in the F •  Iden@fying and understanding these is cri@cal for loop vectoriza@on and automa@c loop paralleliza@on, because these may effec@vely reorder loop itera@ons. –  If the compiler “understands” the nature of the dependence, it can some@mes be removed or dealt with –  Ohen use sophis@cated array subscript analysis for this Winter 2013 UW CSE 401 (Michael Ringenburg) 26 Dependence Graph Example CSE341: Programming CSE341: Programming Languages Languages Lecture 1 Lecture 1 C Course = 7;! ourse Mechanics a Mechanics ML Variable Bindings print(“hello”);! ML Variable Bindings while (a &lt...
View Full Document

This document was uploaded on 04/04/2014.

Ask a homework question - tutors are online