[PATCH 0/5] OpenMP/PTX: improve correctness in SIMD regions

Jakub Jelinek jakub@redhat.com
Wed Feb 1 15:05:00 GMT 2017


On Wed, Feb 01, 2017 at 04:28:14PM +0300, Alexander Monakov wrote:
> Hi,
> 
> Earlier Richard mentioned the possibility to special-case GOMP_SIMT_ENTER to
> allow passing privatized variables to it by reference without making them
> addressable.  I now see that such special-casing is already done for
> IFN_ATOMIC_COMPARE_EXCHANGE in tree-ssa.c: execute_update_addresses_taken ().
> If that's the only place in the compiler where such special casing needs to
> happen, and the rest of the compiler already tolerates it, can we indeed do:

IFN_ASAN_POISON is treated that way too.  That also means that if a
variable is previously addressable and the only spot that takes its address
is that IFN, it can be rewritten into SSA form, but the IFN has to be
adjusted to something different which no longer takes the address.  Perhaps for:

>   void *simtrec = GOMP_SIMT_ENTER (&var1, &var2, ...);
> 
>   for (...) { ... }
> 
>   var1 ={v} {CLOBBER};
>   var2 ={v} {CLOBBER};
>   ... ;
>   GOMP_SIMT_EXIT (simtrec, &var1, &var2, ...)'

that would just mean dropping that &varN from the two ifns (and the clobbers would
be as usually when rewriting something into SSA get removed).

That said, I understand how would you add these &varN arguments during
lowering, but don't understand what would you want to do during inlining,
if you have addressable vars in inlined function, you need to avoid
escaping those from the SIMT region.

I believe the abnormal edges turning the SIMT region into kind of loop that
it to some extent is would take care of this even without having to add
those addresses to the ifns, but if you don't want to go that way,
supposedly the inliner would need to find those GOMP_SIMT_* statements
around the inline caller if any and adjust those?

	Jakub



More information about the Gcc-patches mailing list