Liu, Yaxun (Sam) via llvm-dev
2016-May-10 21:17 UTC
[llvm-dev] [OpenCL] Question about pre-linking passes required to build OpenCL program
+ llvm-dev From: Sumner, Brian Sent: Tuesday, May 10, 2016 3:11 PM To: Anastasia Stulova <Anastasia.Stulova at arm.com>; Liu, Yaxun (Sam) <Yaxun.Liu at amd.com>; cfe-dev (cfe-dev at lists.llvm.org) <cfe-dev at lists.llvm.org>; Pan, Xiuli <xiuli.pan at intel.com>; Bader, Alexey (alexey.bader at intel.com) <alexey.bader at intel.com> Cc: Stellard, Thomas <Tom.Stellard at amd.com>; Mekhanoshin, Stanislav <Stanislav.Mekhanoshin at amd.com>; nd <nd at arm.com> Subject: RE: [OpenCL] Question about pre-linking passes required to build OpenCL program Hi Anastasia, I'm glad to hear there could be some support for such a mechanism. On our side, we use such pre-link passes to interface with the specifics of our built-in function library. For example, we transform printf calls into a form that interacts with our library. We also transform calls to pipe functions, kernel enqueue related functions, and transform calls to the atomic functions to corresponding LLVM atomic instructions (and keep track of the memory scope elsewhere currently). You may have noticed that we have a proposal out to enable the atomic instructions to directly carry a memory scope. Thanks, Brian From: Anastasia Stulova [mailto:Anastasia.Stulova at arm.com] Sent: Tuesday, May 10, 2016 11:45 AM To: Liu, Yaxun (Sam); cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>); Pan, Xiuli; Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>) Cc: Stellard, Thomas; Sumner, Brian; Mekhanoshin, Stanislav; nd Subject: RE: [OpenCL] Question about pre-linking passes required to build OpenCL program Hi Sam, It seems to be generally useful to the community. Could you give some examples of those transformations that can be shared? Also I am guessing this will be a part of LLVM code base. Do you intend it to be publically available on the master branch? If yes, perhaps llvm-dev should be added to the discussion too. Cheers, Anastasia From: Liu, Yaxun (Sam) [mailto:Yaxun.Liu at amd.com] Sent: 09 May 2016 21:14 To: cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>); Anastasia Stulova; Pan, Xiuli; Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>) Cc: Stellard, Thomas; Sumner, Brian; Mekhanoshin, Stanislav Subject: [OpenCL] Question about pre-linking passes required to build OpenCL program Hi, We typically need to apply some transformations to the IR between clang and the standard linker. I am wondering if other OpenCL platforms require the same as well? I'm wondering if we all need such transformations (likely target specific). Is there any way to collaborate on a common infrastructure for pre-linking transformation that would reduce the size of the additions we have to make? Thanks. Sam -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160510/a527acd1/attachment.html>
Anastasia Stulova via llvm-dev
2016-May-11 16:50 UTC
[llvm-dev] [OpenCL] Question about pre-linking passes required to build OpenCL program
Hi Brian,> For example, we transform printf calls into a form that interacts with our library. We also transform calls to pipe functions, kernel enqueue related functions, and transform calls to the atomic functions to corresponding LLVM atomic instructions (and keep track of the memory scope elsewhere currently).Sounds like most of the transformation are affecting OpenCL 2.0. It would be nice to see progress with the latest standards on LLVM side too.> You may have noticed that we have a proposal out to enable the atomic instructions to directly carry a memory scope.Yes, but probably need to look more into this. Thanks, Anastasia From: Liu, Yaxun (Sam) [mailto:Yaxun.Liu at amd.com] Sent: 10 May 2016 22:17 To: Sumner, Brian; Anastasia Stulova; cfe-dev (cfe-dev at lists.llvm.org); Pan, Xiuli; Bader, Alexey (alexey.bader at intel.com); llvm-dev at lists.llvm.org Cc: Stellard, Thomas; Mekhanoshin, Stanislav; nd Subject: RE: [OpenCL] Question about pre-linking passes required to build OpenCL program + llvm-dev From: Sumner, Brian Sent: Tuesday, May 10, 2016 3:11 PM To: Anastasia Stulova <Anastasia.Stulova at arm.com<mailto:Anastasia.Stulova at arm.com>>; Liu, Yaxun (Sam) <Yaxun.Liu at amd.com<mailto:Yaxun.Liu at amd.com>>; cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>) <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>; Pan, Xiuli <xiuli.pan at intel.com<mailto:xiuli.pan at intel.com>>; Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>) <alexey.bader at intel.com<mailto:alexey.bader at intel.com>> Cc: Stellard, Thomas <Tom.Stellard at amd.com<mailto:Tom.Stellard at amd.com>>; Mekhanoshin, Stanislav <Stanislav.Mekhanoshin at amd.com<mailto:Stanislav.Mekhanoshin at amd.com>>; nd <nd at arm.com<mailto:nd at arm.com>> Subject: RE: [OpenCL] Question about pre-linking passes required to build OpenCL program Hi Anastasia, I'm glad to hear there could be some support for such a mechanism. On our side, we use such pre-link passes to interface with the specifics of our built-in function library. For example, we transform printf calls into a form that interacts with our library. We also transform calls to pipe functions, kernel enqueue related functions, and transform calls to the atomic functions to corresponding LLVM atomic instructions (and keep track of the memory scope elsewhere currently). You may have noticed that we have a proposal out to enable the atomic instructions to directly carry a memory scope. Thanks, Brian From: Anastasia Stulova [mailto:Anastasia.Stulova at arm.com] Sent: Tuesday, May 10, 2016 11:45 AM To: Liu, Yaxun (Sam); cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>); Pan, Xiuli; Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>) Cc: Stellard, Thomas; Sumner, Brian; Mekhanoshin, Stanislav; nd Subject: RE: [OpenCL] Question about pre-linking passes required to build OpenCL program Hi Sam, It seems to be generally useful to the community. Could you give some examples of those transformations that can be shared? Also I am guessing this will be a part of LLVM code base. Do you intend it to be publically available on the master branch? If yes, perhaps llvm-dev should be added to the discussion too. Cheers, Anastasia From: Liu, Yaxun (Sam) [mailto:Yaxun.Liu at amd.com] Sent: 09 May 2016 21:14 To: cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>); Anastasia Stulova; Pan, Xiuli; Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>) Cc: Stellard, Thomas; Sumner, Brian; Mekhanoshin, Stanislav Subject: [OpenCL] Question about pre-linking passes required to build OpenCL program Hi, We typically need to apply some transformations to the IR between clang and the standard linker. I am wondering if other OpenCL platforms require the same as well? I'm wondering if we all need such transformations (likely target specific). Is there any way to collaborate on a common infrastructure for pre-linking transformation that would reduce the size of the additions we have to make? Thanks. Sam -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160511/19f0fa20/attachment.html>
Jeff Fifield via llvm-dev
2016-May-11 21:26 UTC
[llvm-dev] [cfe-dev] [OpenCL] Question about pre-linking passes required to build OpenCL program
On Tue, May 10, 2016 at 3:17 PM, Liu, Yaxun (Sam) via cfe-dev < cfe-dev at lists.llvm.org> wrote:> + llvm-dev > > > > *From:* Sumner, Brian > *Sent:* Tuesday, May 10, 2016 3:11 PM > *To:* Anastasia Stulova <Anastasia.Stulova at arm.com>; Liu, Yaxun (Sam) < > Yaxun.Liu at amd.com>; cfe-dev (cfe-dev at lists.llvm.org) < > cfe-dev at lists.llvm.org>; Pan, Xiuli <xiuli.pan at intel.com>; Bader, Alexey ( > alexey.bader at intel.com) <alexey.bader at intel.com> > *Cc:* Stellard, Thomas <Tom.Stellard at amd.com>; Mekhanoshin, Stanislav < > Stanislav.Mekhanoshin at amd.com>; nd <nd at arm.com> > > *Subject:* RE: [OpenCL] Question about pre-linking passes required to > build OpenCL program > > > > Hi Anastasia, > > > > I’m glad to hear there could be some support for such a mechanism. On our > side, we use such pre-link passes to interface with the specifics of our > built-in function library. For example, we transform printf calls into a > form that interacts with our library. We also transform calls to pipe > functions, kernel enqueue related functions, and transform calls to the > atomic functions to corresponding LLVM atomic instructions (and keep track > of the memory scope elsewhere currently). You may have noticed that we > have a proposal out to enable the atomic instructions to directly carry a > memory scope. >Hi Sam / Brian, We have similar passes related to builtin functions but they are rather specific to our implementation and not too complex. We don't do much else before linking. What do you envision as the common infrastructure here? Thanks, Jeff> Thanks, > > Brian > > > > *From:* Anastasia Stulova [mailto:Anastasia.Stulova at arm.com > <Anastasia.Stulova at arm.com>] > *Sent:* Tuesday, May 10, 2016 11:45 AM > *To:* Liu, Yaxun (Sam); cfe-dev (cfe-dev at lists.llvm.org); Pan, Xiuli; > Bader, Alexey (alexey.bader at intel.com) > *Cc:* Stellard, Thomas; Sumner, Brian; Mekhanoshin, Stanislav; nd > *Subject:* RE: [OpenCL] Question about pre-linking passes required to > build OpenCL program > > > > Hi Sam, > > > > It seems to be generally useful to the community. Could you give some > examples of those transformations that can be shared? > > > > Also I am guessing this will be a part of LLVM code base. Do you intend it > to be publically available on the master branch? If yes, perhaps llvm-dev > should be added to the discussion too. > > > > Cheers, > > Anastasia > > > > *From:* Liu, Yaxun (Sam) [mailto:Yaxun.Liu at amd.com <Yaxun.Liu at amd.com>] > *Sent:* 09 May 2016 21:14 > *To:* cfe-dev (cfe-dev at lists.llvm.org); Anastasia Stulova; Pan, Xiuli; > Bader, Alexey (alexey.bader at intel.com) > *Cc:* Stellard, Thomas; Sumner, Brian; Mekhanoshin, Stanislav > *Subject:* [OpenCL] Question about pre-linking passes required to build > OpenCL program > > > > Hi, > > > > We typically need to apply some transformations to the IR between clang > and the standard linker. I am wondering if other OpenCL platforms require > the same as well? > > > > I’m wondering if we all need such transformations (likely target > specific). Is there any way to collaborate on a common infrastructure for > pre-linking transformation that would reduce the size of the additions we > have to make? > > > > Thanks. > > > > Sam > > _______________________________________________ > cfe-dev mailing list > cfe-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160511/b6e252cd/attachment.html>
Liu, Yaxun (Sam) via llvm-dev
2016-May-12 15:16 UTC
[llvm-dev] [cfe-dev] [OpenCL] Question about pre-linking passes required to build OpenCL program
Hi Jeff, Here is a rough idea for adding pre-linking passes to Clang. Currently the linking/opt/llvm-codegen is performed by BackendConsumer::HandleTranslationUnit in CodeGenAction.cpp. Basically, · There is no pre-linking passes. · BackendConsumer::HandleTranslationUnit links with modules provided by command line. · Then it calls EmitBackendOutput to do opt/llvm-codegen, where o It creats EmitAssemblyHelper o EmitAssemblyHelper creates all passes for opt and llvm-codegen o It then run all these passes EmitAssemblyHelper knows about the target and uses hooks TargetMachine::addPassesToEmitFile to add passes for llvm-codegen. There are two types of pre-linking passes: · Target specific, which should stay in each target’s own directory · Shared by different targets, which may be added to proper directories under llvm/lib For target-specific pre-linking pass, we may add a hook TargetMachine::addPrelinkingPasses, which adds these passes. We can move the linking step into EmitAssemblyHelper. And let EmitAssemblyHelper add common pre-linking passes and target-specific pre-linking passes. Sam From: Jeff Fifield [mailto:fifield at mtnhigh.net] Sent: Wednesday, May 11, 2016 5:26 PM To: Liu, Yaxun (Sam) <Yaxun.Liu at amd.com> Cc: Sumner, Brian <Brian.Sumner at amd.com>; Anastasia Stulova <Anastasia.Stulova at arm.com>; cfe-dev (cfe-dev at lists.llvm.org) <cfe-dev at lists.llvm.org>; Pan, Xiuli <xiuli.pan at intel.com>; Bader, Alexey (alexey.bader at intel.com) <alexey.bader at intel.com>; llvm-dev at lists.llvm.org; Mekhanoshin, Stanislav <Stanislav.Mekhanoshin at amd.com>; nd <nd at arm.com>; Stellard, Thomas <Tom.Stellard at amd.com> Subject: Re: [cfe-dev] [OpenCL] Question about pre-linking passes required to build OpenCL program On Tue, May 10, 2016 at 3:17 PM, Liu, Yaxun (Sam) via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote: + llvm-dev From: Sumner, Brian Sent: Tuesday, May 10, 2016 3:11 PM To: Anastasia Stulova <Anastasia.Stulova at arm.com<mailto:Anastasia.Stulova at arm.com>>; Liu, Yaxun (Sam) <Yaxun.Liu at amd.com<mailto:Yaxun.Liu at amd.com>>; cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>) <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>; Pan, Xiuli <xiuli.pan at intel.com<mailto:xiuli.pan at intel.com>>; Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>) <alexey.bader at intel.com<mailto:alexey.bader at intel.com>> Cc: Stellard, Thomas <Tom.Stellard at amd.com<mailto:Tom.Stellard at amd.com>>; Mekhanoshin, Stanislav <Stanislav.Mekhanoshin at amd.com<mailto:Stanislav.Mekhanoshin at amd.com>>; nd <nd at arm.com<mailto:nd at arm.com>> Subject: RE: [OpenCL] Question about pre-linking passes required to build OpenCL program Hi Anastasia, I’m glad to hear there could be some support for such a mechanism. On our side, we use such pre-link passes to interface with the specifics of our built-in function library. For example, we transform printf calls into a form that interacts with our library. We also transform calls to pipe functions, kernel enqueue related functions, and transform calls to the atomic functions to corresponding LLVM atomic instructions (and keep track of the memory scope elsewhere currently). You may have noticed that we have a proposal out to enable the atomic instructions to directly carry a memory scope. Hi Sam / Brian, We have similar passes related to builtin functions but they are rather specific to our implementation and not too complex. We don't do much else before linking. What do you envision as the common infrastructure here? Thanks, Jeff Thanks, Brian From: Anastasia Stulova [mailto:Anastasia.Stulova at arm.com] Sent: Tuesday, May 10, 2016 11:45 AM To: Liu, Yaxun (Sam); cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>); Pan, Xiuli; Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>) Cc: Stellard, Thomas; Sumner, Brian; Mekhanoshin, Stanislav; nd Subject: RE: [OpenCL] Question about pre-linking passes required to build OpenCL program Hi Sam, It seems to be generally useful to the community. Could you give some examples of those transformations that can be shared? Also I am guessing this will be a part of LLVM code base. Do you intend it to be publically available on the master branch? If yes, perhaps llvm-dev should be added to the discussion too. Cheers, Anastasia From: Liu, Yaxun (Sam) [mailto:Yaxun.Liu at amd.com] Sent: 09 May 2016 21:14 To: cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>); Anastasia Stulova; Pan, Xiuli; Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>) Cc: Stellard, Thomas; Sumner, Brian; Mekhanoshin, Stanislav Subject: [OpenCL] Question about pre-linking passes required to build OpenCL program Hi, We typically need to apply some transformations to the IR between clang and the standard linker. I am wondering if other OpenCL platforms require the same as well? I’m wondering if we all need such transformations (likely target specific). Is there any way to collaborate on a common infrastructure for pre-linking transformation that would reduce the size of the additions we have to make? Thanks. Sam _______________________________________________ cfe-dev mailing list cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160512/624bc921/attachment.html>