wsmoses / Tapir-LLVM

Tapir extension to LLVM for optimizing Parallel Programs
Other
132 stars 24 forks source link

tapir compiler does not terminate #83

Closed wheatman closed 5 years ago

wheatman commented 5 years ago

After manually in-lining a single function inside of a cilk_for loop the compiler no longer terminates. The code can be found here https://github.com/wheatman/extended-csr/tree/compilier-spin If you change OFM.cpp: 1615 - 1660 to add_edge_update_fast Which is the same thing just in its own function with a no inline attribute then the compiler will terminate with correct results.

wsmoses commented 5 years ago

Note this is not an issue on master, but rather with WIP-taskinfo @neboat assigning to you.

neboat commented 5 years ago

I think I've found the problem. On line 1638 of OFM.cpp, the code is performing a return in the body of a cilk_for loop. Such code is illegal — you can't return from the body of a cilk_for loop — but the front end doesn't currently report that this statement as illegal.

I think we've seen this error arise in other contexts, and it's definitely something we should fix.

wheatman commented 5 years ago

That does seem to be it, when I change the code to remove that, By simply moving the rest of the function into an else and getting rid of the return statement the code compiles and is correct.

neboat commented 5 years ago

Glad to hear it.

On my end I'm adding some checks in Tapir-Clang to detect return and break statements in cilk_for loops and to throw compiler errors when such statements are detected. We probably want more front-end checks as well, but these two should take care of several problems.

neboat commented 5 years ago

The latest version of the WIP-csi-tapir-exceptions branch of Tapir-Clang addresses the issue of return and break statements in cilk_for loops, so I'm closing this issue.