On Tue, May 28, 2024 at 09:23:41PM +0200, Tobias Burnus wrote: > -fopenmp-force-usm can be useful for some badly written code. Explicity > using 'omp requires' makes more sense but still. It might also make sense > for testing purpose. > > Unfortunately, I did not see a simple way of testing it. When trying it > manually, I looked at the 'a.xamdgcn-amdhsa.c' -save-temps file, where > gcn_data has the omp_requires_mask as second argument and testing showed > that an explicit pragma and the -f... argument have the same result. > > Alternative would be to move this code later, e.g. to lto-cgraph.cc's > omp_requires_mask, which might be safer (as it avoids changing as many > locations). On the other hand, it might require more special cases > elsewhere.* > > Comment, suggestions? > > Tobias > > *I am especially thinking about a global variable and "#pragma omp declare > target". At least with 'omp requires self_maps' of OpenMP 6, it seems as if > 'declare target enter(global_var)' should become 'link(global_var)' where > the global_var pointer is updated to point to the host version.
How is that option different from echo '#pragma omp requires unified_shared_memory' > omp-usm.h gcc -include omp-usm.h ? I mean with -include you can add anything you want, not just one particular directive, and adding a separate option for each is just weird. Jakub