-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[Clang][OpenMP] Clang aborts for collapse clause with imprefect nested loops #60768
Comments
@llvm/issue-subscribers-clang-codegen |
@llvm/issue-subscribers-openmp |
Verified with trunk: https://godbolt.org/z/K4Mob595f |
Does it meet the requirements for the canonical loop nest? |
As i understand there is a change in the standard from 5.0 to 5.1 OpenMP 5.0: Restrictions under "2.9.2 Worksharing-Loop Construct": ... IMO, It means the loop has to be perfectly nested loop. Where as this restriction has been removed in OpenMP 5.1: Restrictions under "2.11.4 Worksharing-Loop Construct". There is a corresponding code change in clang as well: I means, Non perfectly nested loops are allowed. All GNU based compilers and intel proprietary compiler throw an error for this test case:
What should compiler do for this test case? |
It is not only nob-perfectly nested. According to 4.4.1 Canonical Loop Nest Form, lb/ub (jb in this example) "Expressions of a type compatible with the type of var that are loop invariant with respect to the outermost loop.". In this example jb is not outermost loop invariant. |
According to this "Expressions of a type compatible with the type of var that are loop invariant with respect to the outermost loop." statement from the standard, type of lb or ub used in nested loops should be compatible with type of var that is a loop invariant in outermost loop. Here type of jb and type of var that are loop invariant with respect to outermost loop are compatible. Both are of type integer. Hence the test case should be valid right? |
It is not a type issue, jb is not a outer loop invariant. Crashing is not good, though, need to emit error message. |
@alexey-bataev Are you planning to fix this issue? |
No, you can do it. |
I don't think this ever prohibited imperfectly nested loops. The restriction requires that there are at least as many loops as specified by the collapse clause. Nothing is said about whether they are perfectly or imperfectly nested. |
So the compiler should be allowing the test case to pass? |
By no means should the compiler crash, so definitely it is an issue. |
Definitely. |
My comment was to argue that the input was already valid OpenMP since 5.01, not just since Open 5.1. Footnotes
|
What do you mean by "valid"? That it should not crash the compiler? In this case it should be "valid" as soon as multi-collapsing is supported. The fact here that the input is "invalid" because |
@alexey-bataev Correct, I missed that the crashing case was referring to a loop-variant local variable that is not a loop iteratation variable. I was only trying address the misunderstanding that collapsing non-perfectly loops was new in OpenMP 5.1. |
Am, I still think the crash should be fixed, the compiler still crashes |
The crash should definitely be fixed. So the compiler should be throwing an error about the variable right. |
#101305 (apologies for my confusion about GitHub issue numbers vs. PR numbers...) |
Variable
jb
defined in outer loop causing the Clang to abort:Initial investigation showed that the variable
jb
was not registered inLocalDeclMap
.The text was updated successfully, but these errors were encountered: