Re: [PATCH] OpenMP: Ensure that offloaded variables are public

2021-12-09 Thread Jakub Jelinek via Gcc-patches
On Thu, Dec 09, 2021 at 11:41:46AM +, Andrew Stubbs wrote: > gcc/ChangeLog: > > * config/gcn/mkoffload.c (process_asm): Process the variable table > completely differently. > (process_obj): Encode the varaible data differently. > > include/ChangeLog: > > * gomp-consta

Re: [PATCH] OpenMP: Ensure that offloaded variables are public

2021-12-09 Thread Andrew Stubbs
On 02/12/2021 16:43, Jakub Jelinek wrote: On Thu, Dec 02, 2021 at 04:31:36PM +, Andrew Stubbs wrote: On 02/12/2021 16:05, Andrew Stubbs wrote: On 02/12/2021 12:58, Jakub Jelinek wrote: I've tried modifying offload_handle_link_vars but that spot doesn't catch the omp_data_sizes variables em

Re: [PATCH] OpenMP: Ensure that offloaded variables are public

2021-12-02 Thread Jakub Jelinek via Gcc-patches
On Thu, Dec 02, 2021 at 04:31:36PM +, Andrew Stubbs wrote: > On 02/12/2021 16:05, Andrew Stubbs wrote: > > On 02/12/2021 12:58, Jakub Jelinek wrote: > > > > I've tried modifying offload_handle_link_vars but that spot > > > > doesn't catch > > > > the omp_data_sizes variables emitted by > > > >

Re: [PATCH] OpenMP: Ensure that offloaded variables are public

2021-12-02 Thread Andrew Stubbs
On 02/12/2021 16:05, Andrew Stubbs wrote: On 02/12/2021 12:58, Jakub Jelinek wrote: I've tried modifying offload_handle_link_vars but that spot doesn't catch the omp_data_sizes variables emitted by libgomp.c-c++-common/target_42.c, which was one of the motivating examples. Why doesn't catch

Re: [PATCH] OpenMP: Ensure that offloaded variables are public

2021-12-02 Thread Andrew Stubbs
On 02/12/2021 12:58, Jakub Jelinek wrote: I've tried modifying offload_handle_link_vars but that spot doesn't catch the omp_data_sizes variables emitted by libgomp.c-c++-common/target_42.c, which was one of the motivating examples. Why doesn't catch it? Is the variable created only post-IPA? I

Re: [PATCH] OpenMP: Ensure that offloaded variables are public

2021-12-02 Thread Jakub Jelinek via Gcc-patches
On Thu, Dec 02, 2021 at 12:36:30PM +, Andrew Stubbs wrote: > On 30/11/2021 16:54, Jakub Jelinek wrote: > > > Why does the GCN plugin or runtime need to know those vars? > > > It needs to know the single array that contains their addresses of > > > course... > > With older LLVM there were issu

Re: [PATCH] OpenMP: Ensure that offloaded variables are public

2021-12-02 Thread Andrew Stubbs
On 30/11/2021 16:54, Jakub Jelinek wrote: Why does the GCN plugin or runtime need to know those vars? It needs to know the single array that contains their addresses of course... With older LLVM there were issues with relocations that made it impossible to link the the offload_var_table. This

Re: [PATCH] OpenMP: Ensure that offloaded variables are public

2021-11-30 Thread Jakub Jelinek via Gcc-patches
On Tue, Nov 30, 2021 at 05:24:49PM +0100, Jakub Jelinek via Gcc-patches wrote: > Consider in one TU > > static int a = 5; > static int baz (void) { static int b; > #pragma omp declare target to (b) > return ++b; } > int foo (void) { return ++a + baz (); } > #pragma omp declare target to (a, foo) >

Re: [PATCH] OpenMP: Ensure that offloaded variables are public

2021-11-30 Thread Jakub Jelinek via Gcc-patches
On Tue, Nov 16, 2021 at 11:49:18AM +, Andrew Stubbs wrote: > This patch is needed for AMD GCN offloading when we use the assembler from > LLVM 13+. > > The GCN runtime (libgomp+ROCm) requires that the location of all variables > in the offloaded variables table are discoverable at runtime (usi