[libgomp, openacc, openmp, PR83046] Prune removed funcs from offload table
Jakub Jelinek
jakub@redhat.com
Thu Dec 28 16:14:00 GMT 2017
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
More information about the Gcc-patches
mailing list