This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libgomp, openacc, openmp, PR83046] Prune removed funcs from offload table
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 28 Dec 2017 17:14:38 +0100
- Subject: Re: [libgomp, openacc, openmp, PR83046] Prune removed funcs from offload table
- Authentication-results: sourceware.org; auth=none
- References: <048f596a-75d5-c897-2630-d6230640cf40@mentor.com> <20171228160657.GJ1833@tucnak>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Dec 28, 2017 at 05:06:57PM +0100, Jakub Jelinek wrote:
> This has O(n^2) complexity for n == vec_safe_length (offload_funcs).
> Can't you instead just have 2 IVs, one for where we read the vector elt and
> one for where we write it if the 2 are different, then truncate the vector
> if needed at the end?
>
> Another thing, I think you can safely remove elts from the vector (== from
> the host and offloading target arrays) only when !flag_lto, because we rely
> on the two arrays being the same. So you can't remove elts only on the host
> and not on the device, or vice versa. The output_offload_tables function
> has:
> /* In WHOPR mode during the WPA stage the joint offload tables need to be
> streamed to one partition only. That's why we free offload_funcs and
> offload_vars after the first call of output_offload_tables. */
> if (flag_wpa)
> {
> vec_free (offload_funcs);
> vec_free (offload_vars);
> }
> so at least with flag_wpa, if we remove anything in there, it won't be
> reflected by the other tables. So, can we do something different in case
> we can't easily remove stuff from the vector anymore? Either store some
> placeholder in the tables (dunno if NULL would work or what), or instead
> ensure corresponding functions can't be removed?
Maybe this removal if (!flag_lto) could be done earlier, e.g. at the
beginning of lto_output, and for nodes we keep around in the table
past that point set DECL_PRESERVE_P to 1 on the fndecl, so that we then
stream that flag.
Jakub