On Wed, Jan 18, 2017 at 08:02:14PM +0300, Alexander Monakov wrote: > On Wed, 18 Jan 2017, Jakub Jelinek wrote: > > > It is, but I think my approach is compatible with inlining too (and has a > > > more > > > localized impact on the compiler). > > > > But your 2/5 patch disables inlining into the SIMT regions. Or do you mean > > the approach with some new IFN for the pointers to privatized vars? > > I think it can be done either in the current framework, or in that more > involved > approach with a new IFN. > > > How would that work with the inliner (all copies of addressable vars/params > > from functions inlined into the SIMT region would need to gain something > > similar)? > > Inlining needs to do just like omp-low; if we take the current framework, it > would need to collect addressable locals into one struct, replace references > to > those locals by field references in the inlined body. Then it needs to > appropriately increase allocation size/alignment in SIMT_ENTER() call > arguments. > And finally it would need to initialize the pointer to structure, either > immediately after SIMT_ENTER, or in a more fine-grained manner by a > __builtin_alloca_with_align-like function (__b_a_w_a is not usable for that > itself, because currently for known sizes gcc can make it a local variable).
One of the problems with that is that it means that you can't easily turn addressable private variables into non-addressable ones once you force them into such struct that can't be easily SRA split. In contrast, if you can get the variable flags/attributes work, if they become non-addressable (which is especially important to get rid of C++ abstraction penalties), you simply don't add them into the specially allocated block. Jakub