Moritz Angermann via llvm-dev
2017-Mar-14 00:23 UTC
[llvm-dev] Distributing llc and opt with own package?
> On Mar 14, 2017, at 3:02 AM, Mehdi Amini <mehdi.amini at apple.com> wrote: > >> >> On Mar 11, 2017, at 4:30 PM, Moritz Angermann via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Hi Matthias, >> >> what I’m observing right now is that replacing opt+llc with an clang invocation, and >> subsequently fewer intermediate files, increases the consumed time with -O0 by 200%. >> We used to always run opt with -mem2reg -globalopt, and I believe those are not part >> of -O0 (is there an easy way to list all passes that -OX flags to clang imply for the >> optimizer and code gen?). > > No there isn’t. > > >> Could the IR imply certain optimization passes to be required? Could llvm be taught >> that say a certain calling convention needs a pass to run? > > This could be done, but we’d need to here more about the motivation. I suspect the solution may end up different if we understand the exact use-case.Sure. This is all about the ghccc. Here the original discussion between Chris Lattner and David Terei who initially implemented the llvm backend for ghc: http://www.nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt Cheers, moritz> — > Mehdi > > > >> >> Cheers, >> Moritz >> >>> On Mar 12, 2017, at 3:41 AM, Matthias Braun <matze at braunis.de> wrote: >>> >>> -mllvm xxx will pass options directly to the llvm libraries though for that the same caveats apply in that they are more of a developer/debug tool than a stable interface. >>> The stable interface to clang is the usual flags like -O0/-O3/-fXXX/-mXXX ... >>> >>> If you find yourself in a position that you want to control the pass pipeline down to single passes (why would you want to enable/disable mem2reg really?) then you are relying on LLVM internals anyway. If you need/want that level of control then your best bet would be to link against the LLVM libraries or I guess shipping and relying on llc/opt is similarily good/bad. It will work but you will have to do more work to keep track with llvm releases, development of new passes, new behaviors, ... >>> >>> - Matthias >>> >>>> Am 10.03.2017 um 23:50 schrieb Moritz Angermann <moritz.angermann at gmail.com>: >>>> >>>> Hi Matthias, >>>> >>>> I’m trying to see if I can make do with the clang interface only. >>>> How do I pass flags to opt or llc? Say I want to enable/disable tbaa, >>>> which could be done with `--enable-tbaa=true/false` or `-mem2reg` or >>>> `-globalopt`? Would the `-llvm` switch be, what I’m looking for or the >>>> `-Xclang`, or something else entirely? >>>> >>>> Cheers, >>>> Moritz >>>> >>>>> On Mar 11, 2017, at 2:26 AM, Matthias Braun <mbraun at apple.com> wrote: >>>>> >>>>> Just a word of warning: >>>>> >>>>> llc and opt are primarily developed as debugging tools to support LLVM testing. They are not intended to be shipped or used as code generators for frontends. They do often work in these settings but you may hit rough edges that nobody will care to fix and the behavior or commandline interface may change every release... A more stable alternative is usually to feed .ir/.bc files to clang or better link to the llvm libraries and generate the code from there. >>>>> >>>>> - Matthias >>>>> >>>>>> On Mar 10, 2017, at 6:31 AM, Moritz Angermann via llvm-dev <llvm-dev at lists.llvm.org> wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> I was wondering, if someone could point me into the right direction, >>>>>> towards building just llc and opt (potentially 4.0 + patches) to distribute >>>>>> them in the interim with compiler? The idea is that we’d like to pin our >>>>>> llvm ir code generator to a specific set of llc and opt tools, with >>>>>> potential patches applied, until we manage to get all those patches >>>>>> upstreamed. >>>>>> >>>>>> I’d like to find answers to the following question: >>>>>> - How trivially can I build just llc and opt into (maybe static?) >>>>>> distributable binaries? >>>>>> - Would generating them for multiple architectures pose any specific >>>>>> complications? >>>>>> >>>>>> Cheers, >>>>>> Moritz >>>>>> _______________________________________________ >>>>>> LLVM Developers mailing list >>>>>> llvm-dev at lists.llvm.org >>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>>>> >>>> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Matthias Braun via llvm-dev
2017-Mar-14 00:32 UTC
[llvm-dev] Distributing llc and opt with own package?
> On Mar 13, 2017, at 5:23 PM, Moritz Angermann <moritz.angermann at gmail.com> wrote: > >> >> On Mar 14, 2017, at 3:02 AM, Mehdi Amini <mehdi.amini at apple.com> wrote: >> >>> >>> On Mar 11, 2017, at 4:30 PM, Moritz Angermann via llvm-dev <llvm-dev at lists.llvm.org> wrote: >>> >>> Hi Matthias, >>> >>> what I’m observing right now is that replacing opt+llc with an clang invocation, and >>> subsequently fewer intermediate files, increases the consumed time with -O0 by 200%. >>> We used to always run opt with -mem2reg -globalopt, and I believe those are not part >>> of -O0 (is there an easy way to list all passes that -OX flags to clang imply for the >>> optimizer and code gen?). >> >> No there isn’t. >> >> >>> Could the IR imply certain optimization passes to be required? Could llvm be taught >>> that say a certain calling convention needs a pass to run? >> >> This could be done, but we’d need to here more about the motivation. I suspect the solution may end up different if we understand the exact use-case. > > Sure. This is all about the ghccc. Here the original discussion between Chris Lattner > and David Terei who initially implemented the llvm backend for ghc: > http://www.nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt <http://www.nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt>From that discussion I don't see why you need mem2reg or globalopt. Sure those things are desirable to eliminate the extra copies and get performant code, but for that you wouldn't use -O0 anyway... - Matthias> > Cheers, > moritz > > >> — >> Mehdi >> >> >> >>> >>> Cheers, >>> Moritz >>> >>>> On Mar 12, 2017, at 3:41 AM, Matthias Braun <matze at braunis.de> wrote: >>>> >>>> -mllvm xxx will pass options directly to the llvm libraries though for that the same caveats apply in that they are more of a developer/debug tool than a stable interface. >>>> The stable interface to clang is the usual flags like -O0/-O3/-fXXX/-mXXX ... >>>> >>>> If you find yourself in a position that you want to control the pass pipeline down to single passes (why would you want to enable/disable mem2reg really?) then you are relying on LLVM internals anyway. If you need/want that level of control then your best bet would be to link against the LLVM libraries or I guess shipping and relying on llc/opt is similarily good/bad. It will work but you will have to do more work to keep track with llvm releases, development of new passes, new behaviors, ... >>>> >>>> - Matthias >>>> >>>>> Am 10.03.2017 um 23:50 schrieb Moritz Angermann <moritz.angermann at gmail.com>: >>>>> >>>>> Hi Matthias, >>>>> >>>>> I’m trying to see if I can make do with the clang interface only. >>>>> How do I pass flags to opt or llc? Say I want to enable/disable tbaa, >>>>> which could be done with `--enable-tbaa=true/false` or `-mem2reg` or >>>>> `-globalopt`? Would the `-llvm` switch be, what I’m looking for or the >>>>> `-Xclang`, or something else entirely? >>>>> >>>>> Cheers, >>>>> Moritz >>>>> >>>>>> On Mar 11, 2017, at 2:26 AM, Matthias Braun <mbraun at apple.com> wrote: >>>>>> >>>>>> Just a word of warning: >>>>>> >>>>>> llc and opt are primarily developed as debugging tools to support LLVM testing. They are not intended to be shipped or used as code generators for frontends. They do often work in these settings but you may hit rough edges that nobody will care to fix and the behavior or commandline interface may change every release... A more stable alternative is usually to feed .ir/.bc files to clang or better link to the llvm libraries and generate the code from there. >>>>>> >>>>>> - Matthias >>>>>> >>>>>>> On Mar 10, 2017, at 6:31 AM, Moritz Angermann via llvm-dev <llvm-dev at lists.llvm.org> wrote: >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I was wondering, if someone could point me into the right direction, >>>>>>> towards building just llc and opt (potentially 4.0 + patches) to distribute >>>>>>> them in the interim with compiler? The idea is that we’d like to pin our >>>>>>> llvm ir code generator to a specific set of llc and opt tools, with >>>>>>> potential patches applied, until we manage to get all those patches >>>>>>> upstreamed. >>>>>>> >>>>>>> I’d like to find answers to the following question: >>>>>>> - How trivially can I build just llc and opt into (maybe static?) >>>>>>> distributable binaries? >>>>>>> - Would generating them for multiple architectures pose any specific >>>>>>> complications? >>>>>>> >>>>>>> Cheers, >>>>>>> Moritz >>>>>>> _______________________________________________ >>>>>>> LLVM Developers mailing list >>>>>>> llvm-dev at lists.llvm.org >>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>>>>> >>>>> >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170313/aa575f44/attachment-0001.html>
Matthias Braun via llvm-dev
2017-Mar-14 00:38 UTC
[llvm-dev] Distributing llc and opt with own package?
> On Mar 13, 2017, at 5:32 PM, Matthias Braun <matze at braunis.de> wrote: > >> >> On Mar 13, 2017, at 5:23 PM, Moritz Angermann <moritz.angermann at gmail.com <mailto:moritz.angermann at gmail.com>> wrote: >> >>> >>> On Mar 14, 2017, at 3:02 AM, Mehdi Amini <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>> wrote: >>> >>>> >>>> On Mar 11, 2017, at 4:30 PM, Moritz Angermann via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >>>> >>>> Hi Matthias, >>>> >>>> what I’m observing right now is that replacing opt+llc with an clang invocation, and >>>> subsequently fewer intermediate files, increases the consumed time with -O0 by 200%. >>>> We used to always run opt with -mem2reg -globalopt, and I believe those are not part >>>> of -O0 (is there an easy way to list all passes that -OX flags to clang imply for the >>>> optimizer and code gen?). >>> >>> No there isn’t. >>> >>> >>>> Could the IR imply certain optimization passes to be required? Could llvm be taught >>>> that say a certain calling convention needs a pass to run? >>> >>> This could be done, but we’d need to here more about the motivation. I suspect the solution may end up different if we understand the exact use-case. >> >> Sure. This is all about the ghccc. Here the original discussion between Chris Lattner >> and David Terei who initially implemented the llvm backend for ghc: >> http://www.nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt <http://www.nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt> > > From that discussion I don't see why you need mem2reg or globalopt. Sure those things are desirable to eliminate the extra copies and get performant code, but for that you wouldn't use -O0 anyway...I haven't checked, but conceptually this looks very similar to the C++ "this parameter" which we probably load/store like crazy as well in -O0. - Matthias> > - Matthias > >> >> Cheers, >> moritz >> >> >>> — >>> Mehdi >>> >>> >>> >>>> >>>> Cheers, >>>> Moritz >>>> >>>>> On Mar 12, 2017, at 3:41 AM, Matthias Braun <matze at braunis.de <mailto:matze at braunis.de>> wrote: >>>>> >>>>> -mllvm xxx will pass options directly to the llvm libraries though for that the same caveats apply in that they are more of a developer/debug tool than a stable interface. >>>>> The stable interface to clang is the usual flags like -O0/-O3/-fXXX/-mXXX ... >>>>> >>>>> If you find yourself in a position that you want to control the pass pipeline down to single passes (why would you want to enable/disable mem2reg really?) then you are relying on LLVM internals anyway. If you need/want that level of control then your best bet would be to link against the LLVM libraries or I guess shipping and relying on llc/opt is similarily good/bad. It will work but you will have to do more work to keep track with llvm releases, development of new passes, new behaviors, ... >>>>> >>>>> - Matthias >>>>> >>>>>> Am 10.03.2017 um 23:50 schrieb Moritz Angermann <moritz.angermann at gmail.com <mailto:moritz.angermann at gmail.com>>: >>>>>> >>>>>> Hi Matthias, >>>>>> >>>>>> I’m trying to see if I can make do with the clang interface only. >>>>>> How do I pass flags to opt or llc? Say I want to enable/disable tbaa, >>>>>> which could be done with `--enable-tbaa=true/false` or `-mem2reg` or >>>>>> `-globalopt`? Would the `-llvm` switch be, what I’m looking for or the >>>>>> `-Xclang`, or something else entirely? >>>>>> >>>>>> Cheers, >>>>>> Moritz >>>>>> >>>>>>> On Mar 11, 2017, at 2:26 AM, Matthias Braun <mbraun at apple.com <mailto:mbraun at apple.com>> wrote: >>>>>>> >>>>>>> Just a word of warning: >>>>>>> >>>>>>> llc and opt are primarily developed as debugging tools to support LLVM testing. They are not intended to be shipped or used as code generators for frontends. They do often work in these settings but you may hit rough edges that nobody will care to fix and the behavior or commandline interface may change every release... A more stable alternative is usually to feed .ir/.bc files to clang or better link to the llvm libraries and generate the code from there. >>>>>>> >>>>>>> - Matthias >>>>>>> >>>>>>>> On Mar 10, 2017, at 6:31 AM, Moritz Angermann via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> I was wondering, if someone could point me into the right direction, >>>>>>>> towards building just llc and opt (potentially 4.0 + patches) to distribute >>>>>>>> them in the interim with compiler? The idea is that we’d like to pin our >>>>>>>> llvm ir code generator to a specific set of llc and opt tools, with >>>>>>>> potential patches applied, until we manage to get all those patches >>>>>>>> upstreamed. >>>>>>>> >>>>>>>> I’d like to find answers to the following question: >>>>>>>> - How trivially can I build just llc and opt into (maybe static?) >>>>>>>> distributable binaries? >>>>>>>> - Would generating them for multiple architectures pose any specific >>>>>>>> complications? >>>>>>>> >>>>>>>> Cheers, >>>>>>>> Moritz >>>>>>>> _______________________________________________ >>>>>>>> LLVM Developers mailing list >>>>>>>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >>>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>>>>>> >>>>>> >>>> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170313/41119fb3/attachment.html>