CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2010
    Posts
    1

    how to identify dependency between statements automatically

    suppose if there are two statements in a for loop
    for(i=0;i<n;i++)
    {

    A(I) = B ( I ) + C(I)
    B(I + 2) = A(I - 1) + C(I -1)
    A(I + 1) = B(2*I + 3) + 1
    }
    suppose if we run these for I values like 1,2,3

    FOR I value 1
    S(2) :A(2) = B(2) + C(2)
    T(2) :B(4) = A(1) + C(1)
    U(2) :A(3) = B(7) + 1
    FOR I value 2
    S(3) :A(3) = B(3) + C(3)
    T(3) :B(5) = A(2) + C(2)
    U(3) :A(4) = B(9) + 1

    here in B(5) has to be wait for A(2).in sequential programming is concerned it is ok.suppose if it is parallel program it will create ambiguity.

    how to identify this types of loop automatically in a program

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: how to identify dependency between statements automatically

    If you unroll the loop a few times, then a relatively simple analysis should reveal that the same variable is being used as both a write destination and a read location in different iterations.

    However, the hard question is, how much should you unroll the loop? In this case once is enough, but in general it is difficult to know.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured