On Wed, Jan 18, 2017 at 06:34:05PM +0300, Alexander Monakov wrote: > My main concern is that nothing indicates to optimization passes that after > SIMT_EXIT(), underlying storage is unavailable. What would prevent the > compiler > from transforming, say > > SIMT_ENTER(); > // originally omp simd private(inner) > for (...) > { ... } > outer = inner; > SIMT_EXIT(); > > into > > SIMT_ENTER(); > // omp simd private(inner) > for (...) > { ... } > SIMT_EXIT(); > outer = inner; // too late > > > Also, we'd need to ensure IPA-SRA propagates the magic flag when decomposing > structs.
We are talking here about addressable vars, right (so if we turn it into non-addressable, in the SIMT region we just use the normal PTX pseudos), right? We could emit inner ={v} {CLOBBER}; before SIMT_EXIT() to make it clear it shouldn't be moved afterwards. For the private vars used directly in SIMD region, for the vars from inlined functions I assume if they are addressable we emit clobbers for them too. Or perhaps the alias oracle can say that SIMT_EXIT ifn can clobber any addressable var with that flag/attribute. And yes, SRA would need to propagate it. But I believe it is worth it, because inlining is essential for good performance of the simd regions. Jakub