Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some types of loop carried dependencies cannot be detected #41

Open
travisdowns opened this issue Oct 12, 2019 · 0 comments
Open

Some types of loop carried dependencies cannot be detected #41

travisdowns opened this issue Oct 12, 2019 · 0 comments

Comments

@travisdowns
Copy link

As described in more detail in this gist not all types of loop carried dependencies (LCDs) can be detected. E.g., the carried dependency in this loop cannot be detected:

add eax, 1  ; A (deps: E-previous)
add eax, 1  ; B (deps: A)
add eax, 1  ; C (deps: B)

; swap eax, ebx (exploded version of xchg eax, ebx)
mov ecx, eax ; D (deps: C)
mov eax, ebx ; E (deps: F-previous)
mov ebx, ecx ; F (deps: D)

... since it takes two iterations for the loop to complete.

I think this can be fixed fairly simply - you just keep unrolling copies until for each node in the current copy the set of original nodes that feed into every node (i.e., the "reachable from" or "depends on" set) is the same as the previous iteration. So you'll need 3 copies rather than 2 in the common case (where there are no skipped a generation things like the above) - the 3rd copy just verifies that iteration is complete. In this case you'd need 4 copies. In general, the number of copies you need to create should be bounded by the size of the loop (although I don't have a proof of that), so small in practice.

@JanLJL JanLJL added this to Backlog in OSACA Kanban May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
OSACA Kanban
  
Backlog
Development

No branches or pull requests

1 participant