On Wed, 18 Jan 2017, Jakub Jelinek wrote:
> Can't it be e.g. recorded inside a flag on the VAR_DECLs or magic attributes
> on them during omplower time and then only finalized into the magic .local
> alloca in the pass_omp_device_lower pass?

No (see my adjacent response): it can't be a variable flag because one variable
can be private to one SIMD region but not others, and even if we make private
instances be separate variables, we need to be sure the compiler can't move
references to them outside of their SIMT_ENTER/EXIT SESE region.

> The inliner would need to be able to add those flags or magic attributes also
> when duplicating vars/parameters from inline functions into the SIMT region
> (perhaps some flag on GIMPLE_CALL stmts, or on bbs in the simt region, or
> something similar could turn that behavior on in the inliner)?

In patch 2/5 I've used loop properties for that (works nicely since loops are
persistent), but it's not perfect because SIMT regions are not really loops:
it's a combination of original SIMD loop, plus helper reduction loop, plus
lastprivate copying, plus calls to C++ constructors for private objects on
entry.  But that's the best approach I see at the moment.

Alexander

Reply via email to