1 / 7

Dependence Analysis

Dependence Analysis. Important and difficult Parallelize Optimize memory hierarchy Loop --- and non-loops ? Application to program transformation Should yield “better” code Should NOT alter code semantics . Which Loop(s) Parallelizable ?. 1) Do I = 1, n

bvictoria
Download Presentation

Dependence Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dependence Analysis • Important and difficult • Parallelize • Optimize memory hierarchy • Loop --- and non-loops ? • Application to program transformation • Should yield “better” code • Should NOT alter code semantics

  2. Which Loop(s) Parallelizable ? 1) Do I = 1, n A[I] = 5 * B[I] + A[I] Enddo 2) Do I = 1, n A[I-1] = 5 * B[I] + A[I] Enddo 3) Do I = 1, n temp = 5 * B[I] A[I] = temp Enddo 4) Do I = 1, n A[I+1] = 5 * B[I] + A[I] Enddo

  3. Data Dependence • Statement S2 is dependent on S1 iff • S2 follows S1 in execution • S2, S1 access same memory location, M • One of S2 or S1 write to M • Dependence “types” • True (or flow) -- S2 reads M set by S1 • Anti- -- S2 writes M read by S1 • Output -- S1 and S2 write M • Dependence Graph

  4. Example S1: a = 3.14 S2: b = 5.0 S3: c = a * b * b S1 S2 S3

  5. Example S1: a = 3.14 S2: b = 5.0 S3: c = a * b * b S4: b = a * c S1 S2 S3 S4

  6. Program Order, Dependence • Sequential order of imperative programs is too restrictive • Partial order of dependences needed to ensure “correctness” • Reordering transformations should not violate dependence • Can we always determine dependence?

  7. Dependence in Loops • Parameterize stmts by loop iterations • Loop nesting level: number of surrounding loops + 1 • Iteration number: value of iteration (index) variable • Iteration vector,I, of loop isthe value of all index variables for outerloop(s) for a particular iteration of innermost loop • Iteration space is set of all possible iteration vectors for a statement

More Related