Some background: We have an issue with in loop values being correctly marked uniform but the out of loop uses can be non-uniform. Currently the out of loop users are not marked as divergent because the in loop value is uniform inside the loop. We have gotten around this problem for the moment by applying LCSSA which inserts a PHI in the loop exit for the in loop uniform value that allows the divergent info to be passed onto isel. The LCSSA is being inserted into XXXDAGToDAGISel class but this causes a pass scheduling conflict with StackProtector. So what we've done is try to preserve StackProtector in LCSSA, the issue is that the linker fails in Debug build (but not Release build). StackProtector lies in CodeGen while LCSSA lies in Tranforms/Utils. Matt had mentioned to me that you can't refer to a preserved pass if it's not on the same library and that it might make sense to move the transform IDs into a separate library. We need a way to mark transforms/analyses as preserved without depending on linking the transform itself. Thanks, Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190514/058eda13/attachment.html>
Nicolai Hähnle-Montoro via llvm-dev
2019-Jun-03 08:35 UTC
[llvm-dev] [RFC] Expressing preserved-relations between passes from different modules (was: Re: Linker issue)
Hi all, re-upping and renaming this thread to get some attention, as we'd like some feedback on a change that affects the future design direction. The concrete problem: We would like to mark the LCSSA pass as preserving the StackProtector pass in order to be able to properly express all dependencies we have. Unfortunately, those passes are defined in different modules that do not (and should not) depend on each other, which causes linking to fail. Our proposal is to introduce a collection of cross-module pass IDs in the core module (lib/IR) to work around such issues. This is done by the RFC patch at https://reviews.llvm.org/D62802. The only potential alternative I can see would be to generate the IDs using some kind of template magic and then rely on (runtime) linker magic to common the generated symbols. That feels like a bit too much magic for a fundamentally simple problem to me, hence the more low-tech proposal in the linked Phabricator review. Please let us know your thoughts! Thanks, Nicolai On Tue, May 14, 2019 at 3:55 PM Ryan Taylor via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Some background: We have an issue with in loop values being correctly marked uniform but the out of loop uses can be non-uniform. Currently the out of loop users are not marked as divergent because the in loop value is uniform inside the loop. We have gotten around this problem for the moment by applying LCSSA which inserts a PHI in the loop exit for the in loop uniform value that allows the divergent info to be passed onto isel. > > The LCSSA is being inserted into XXXDAGToDAGISel class but this causes a pass scheduling conflict with StackProtector. So what we've done is try to preserve StackProtector in LCSSA, the issue is that the linker fails in Debug build (but not Release build). > > StackProtector lies in CodeGen while LCSSA lies in Tranforms/Utils. > > Matt had mentioned to me that you can't refer to a preserved pass if it's not on the same library and that it might make sense to move the transform IDs into a separate library. We need a way to mark transforms/analyses as preserved without depending on linking the transform itself. > > Thanks, > > Ryan > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Lerne, wie die Welt wirklich ist, aber vergiss niemals, wie sie sein sollte.
Nicolai Hähnle-Montoro via llvm-dev
2019-Jun-06 08:27 UTC
[llvm-dev] [RFC] Expressing preserved-relations between passes from different modules (was: Re: Linker issue)
Any comments at all on this? Chandler perhaps? I've since dug a bit further, and it seems like the template-based solution wouldn't work anyway because DLL loading on Windows can't do the required commoning. So the general approach taken in https://reviews.llvm.org/D62802 seems to be the only technically viable path forward, though it would still be good to get an outside look at the concrete details. Thanks, Nicolai On Mon, Jun 3, 2019 at 10:35 AM Nicolai Hähnle-Montoro <nhaehnle at gmail.com> wrote:> > Hi all, > > re-upping and renaming this thread to get some attention, as we'd like > some feedback on a change that affects the future design direction. > > The concrete problem: We would like to mark the LCSSA pass as > preserving the StackProtector pass in order to be able to properly > express all dependencies we have. Unfortunately, those passes are > defined in different modules that do not (and should not) depend on > each other, which causes linking to fail. > > Our proposal is to introduce a collection of cross-module pass IDs in > the core module (lib/IR) to work around such issues. This is done by > the RFC patch at https://reviews.llvm.org/D62802. > > The only potential alternative I can see would be to generate the IDs > using some kind of template magic and then rely on (runtime) linker > magic to common the generated symbols. That feels like a bit too much > magic for a fundamentally simple problem to me, hence the more > low-tech proposal in the linked Phabricator review. > > Please let us know your thoughts! > > Thanks, > Nicolai > > On Tue, May 14, 2019 at 3:55 PM Ryan Taylor via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > Some background: We have an issue with in loop values being correctly marked uniform but the out of loop uses can be non-uniform. Currently the out of loop users are not marked as divergent because the in loop value is uniform inside the loop. We have gotten around this problem for the moment by applying LCSSA which inserts a PHI in the loop exit for the in loop uniform value that allows the divergent info to be passed onto isel. > > > > The LCSSA is being inserted into XXXDAGToDAGISel class but this causes a pass scheduling conflict with StackProtector. So what we've done is try to preserve StackProtector in LCSSA, the issue is that the linker fails in Debug build (but not Release build). > > > > StackProtector lies in CodeGen while LCSSA lies in Tranforms/Utils. > > > > Matt had mentioned to me that you can't refer to a preserved pass if it's not on the same library and that it might make sense to move the transform IDs into a separate library. We need a way to mark transforms/analyses as preserved without depending on linking the transform itself. > > > > Thanks, > > > > Ryan > > > > > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > > -- > Lerne, wie die Welt wirklich ist, > aber vergiss niemals, wie sie sein sollte.-- Lerne, wie die Welt wirklich ist, aber vergiss niemals, wie sie sein sollte.
Reasonably Related Threads
- [RFC] Expressing preserved-relations between passes from different modules (was: Re: Linker issue)
- Why MachineBasicBlcok doesn't have transferPredecessors() ?
- atomic ops are optimized with incorrect semantics .
- Condition code in DAGCombiner::visitFADDForFMACombine?
- Eliminate some two entry PHI nodes - SimplifyCFG