- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am optimizing an application. I am facing the below warning message in xxx.optrpt file.
(I gave -qopt-report=5 option.)
remark #25461: Imperfect Loop Unroll-Jammed by 2 (pre-vector)
What would be the general requirements of perfect loop unroll-jamming?
I don't see any kinds of explanations about this warning in icc reference manual.
Also, what is the meaning of (pre-vector)?
I am using icc 15.0.2 and unfortunately, I cannot upload the code here because it is very complex and large code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sunwoo,
Good question and I'll touch base with the doc team to ensure that the message/section on it is made more clearer. That said, what you're getting is a "remark" per-se and not a warning and should be interpreted as "imperfect loop, unroll-jam" as well. Basically, it's telling the user that unroll and jam transformation occurred which is applied to an imperfect loop nest before vectorizer. A loop nest is considered imperfect if there are statements between loops which may be a result of some earlier transformation by the compiler or due to the code itself in the program.
Example of a perfect and imperfect loops below where s<n> is a statement:
Perfect loop example
for(){
for(){
s1; s2; s3;
}
}
Imperfect loop example
for(){
s0;
for(){
s1; s2; s3;
}
}
Besides the imperfect loop nest, ICC can perform unroll and jam for the following two perfect loop nests.
1) The outer two level loop i, j are unroll-jammed.
do i
do j
do k
s1; s2; s3;
end do
end do
end do
2) The outer loop i is unroll-jammed.
do i
do j
s1; s2; s3;
end do
end do
Hope the above helps
_Kittur
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An imperfect loop nest might be one with operations inside outer levels of loop nest. Presumably, the compiler decided to perform the fancy unrolling prior to vectorization. Nothing here to indicate a problem, since you don't want to give enough detail (maybe just the loop nest in question) for further comment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sunwoo,
Good question and I'll touch base with the doc team to ensure that the message/section on it is made more clearer. That said, what you're getting is a "remark" per-se and not a warning and should be interpreted as "imperfect loop, unroll-jam" as well. Basically, it's telling the user that unroll and jam transformation occurred which is applied to an imperfect loop nest before vectorizer. A loop nest is considered imperfect if there are statements between loops which may be a result of some earlier transformation by the compiler or due to the code itself in the program.
Example of a perfect and imperfect loops below where s<n> is a statement:
Perfect loop example
for(){
for(){
s1; s2; s3;
}
}
Imperfect loop example
for(){
s0;
for(){
s1; s2; s3;
}
}
Besides the imperfect loop nest, ICC can perform unroll and jam for the following two perfect loop nests.
1) The outer two level loop i, j are unroll-jammed.
do i
do j
do k
s1; s2; s3;
end do
end do
end do
2) The outer loop i is unroll-jammed.
do i
do j
s1; s2; s3;
end do
end do
Hope the above helps
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BTW, I forgot to add that "pre-vector" in the remark means that the transformation happened before the vectorizer and hence pre-vector noted in the remark.
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Tim Prince and Kittur Ganesh!
Because there is no statement between loops in my code, I guess compiler automatically moved some statements between the loops. Is there any way to check whether some statements are located between the loops?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's indeed not easy to decipher what exactly the compiler is finding in the context of the code during the transformation. That said, if your application doesn't have any statements between the inner and outer loops it might be the case that the inner loop may have some loop invariant computation and the compiler may have moved that out of the inner loop as part of the optimization per-se. Also, if the outer loop has any non-trivial loop control it may show up as as separate statement during the course of the compilation and the end and increment expressions are evaluated with every iteration as well. With such a scenario the perfect loop can become an imperfect loop and hence the corresponding remark output by the compiler.
_Kittur

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page