I've attached some IR which shows what I'm asking about. If you run this through opt "inner" will be inlined and both loops in "outer" will have the same loop id metadata.. paul On 2013-02-21, at 2:07 PM, Hal Finkel wrote:> ----- Original Message ----- >> From: "Paul Redmond" <paul.redmond at intel.com> >> To: "Pekka Jääskeläinen" <pekka.jaaskelainen at tut.fi> >> Cc: "llvmdev at cs.uiuc.edu Dev" <llvmdev at cs.uiuc.edu> >> Sent: Thursday, February 21, 2013 12:36:50 PM >> Subject: Re: [LLVMdev] Parallel Loop Metadata >> >> The documentation isn't clear about the uniqueness of loop identifier >> metadata. Should every loop have a unique loop id metadata? I think >> the answer is yes but I'm not sure how this can be enforced. >> >> A particular case I'm thinking of is something like: >> >> void foo() { >> for (...) { >> } >> } >> >> void bar() { >> for (...) { >> foo(); >> } >> } >> >> If the loops in foo and bar have the same loop id metadata and foo is >> inlined then you have two loops with the same id. > > Is that what really happens? I thought the self-referential metadata design prevented this problem? > > -Hal > >> >> paul >> >> On 2013-02-13, at 1:13 PM, Pekka Jääskeläinen wrote: >> >>> On 02/12/2013 11:59 PM, Nadav Rotem wrote: >>>> LGTM. Please commit. >>> >>> Committed in r175060. Thanks all for the feedback. >>> >>> Yes, let's see what evolves as the best way to keep the metadata >>> updated after "non-serializing optimizations". >>> >>> This metadata is produced by pocl for the "work-item loops" in >>> the work group functions. Perhaps the #pragma ivdep support in >>> Clang is >>> going to be the next producer. >>> >>> -- >>> --Pekka >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>-------------- next part -------------- A non-text attachment was scrubbed... Name: foo2.ll Type: application/octet-stream Size: 1460 bytes Desc: foo2.ll URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130221/9e9299a1/attachment.obj>
On 02/21/2013 10:12 PM, Redmond, Paul wrote:> I've attached some IR which shows what I'm asking about. If you run this > through opt "inner" will be inlined and both loops in "outer" will have the > same loop id metadata..In your test case the two loops illegally share a loop id MD (!0) the first place, thus the bug is in the producer of the loop MD that created that loop metadata. The idea of the loop ID metadata is that it truly is a unique MDNode per loop, *universally* (stay unique even after Module linkage). I.e., you need to create a new self-referential ID metadata for each loop. -- --Pekka
Hi Pekka, On 2013-02-21, at 4:10 PM, Pekka Jääskeläinen wrote:> On 02/21/2013 10:12 PM, Redmond, Paul wrote: >> I've attached some IR which shows what I'm asking about. If you run this >> through opt "inner" will be inlined and both loops in "outer" will have the >> same loop id metadata.. > > In your test case the two loops illegally share a loop id MD (!0) the first > place, thus the bug is in the producer of the loop MD that created that > loop metadata. >Ok, that was really what I was trying to ask--do the loop ids need to be unique? There is nothing preventing this from happening and the documentation doesn't state this requirement. paul> The idea of the loop ID metadata is that it truly is a unique MDNode per > loop, *universally* (stay unique even after Module linkage). I.e., you > need to create a new self-referential ID metadata for each loop. > > -- > --Pekka