From: Richard Sandiford <richard.sandiford@arm.com>
To: Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Richard Biener <richard.guenther@gmail.com>,
Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH] [AVX512] [PR87767] Optimize memory broadcast for constant vector under AVX512
Date: Fri, 28 Aug 2020 17:07:11 +0100 [thread overview]
Message-ID: <mpt5z92zrdc.fsf@arm.com> (raw)
In-Reply-To: <20200828145325.GA18149@tucnak> (Jakub Jelinek via Gcc-patches's message of "Fri, 28 Aug 2020 16:53:25 +0200")
Thanks for doing this. I don't feel qualified to review the full
patch, but one thing:
Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> + auto_vec<target_unit, 128> buffer;
> + auto_vec<constant_descriptor_rtx_data *, 128> vec;
> + object_allocator<constant_descriptor_rtx_data>
> + data_pool ("constant_descriptor_rtx_data_pool");
> + int idx = 0;
> + size_t size = 0;
> + for (constant_descriptor_rtx *desc = pool->first; desc; desc = desc->next)
> + if (desc->mark > 0
> + && ! (SYMBOL_REF_HAS_BLOCK_INFO_P (desc->sym)
> + && SYMBOL_REF_BLOCK (desc->sym)))
> + {
> + buffer.truncate (0);
128 isn't big enough for all targets (e.g. aarch64 with
-msve-vector-bits=2048), so I think we still need a reserve
call here.
Thanks,
Richard
> + if (native_encode_rtx (desc->mode, desc->constant, buffer, 0,
> + GET_MODE_SIZE (desc->mode)))
> + {
> + constant_descriptor_rtx_data *data = data_pool.allocate ();
> + data->desc = desc;
> + data->bytes = NULL;
> + data->size = GET_MODE_SIZE (desc->mode);
> + data->offset = 0;
> + data->hash = idx++;
> + size += data->size;
> + vec.safe_push (data);
> + }
> + }
> + if (idx)
> + {
> + vec.qsort (constant_descriptor_rtx_data_cmp);
> + unsigned min_size = vec.last ()->size;
> + target_unit *bytes = XNEWVEC (target_unit, size);
> + unsigned int i;
> + constant_descriptor_rtx_data *data;
> + hash_table<const_rtx_data_hasher> * htab
> + = new hash_table<const_rtx_data_hasher> (31);
> + size = 0;
> + FOR_EACH_VEC_ELT (vec, i, data)
> + {
> + buffer.truncate (0);
> + native_encode_rtx (data->desc->mode, data->desc->constant,
> + buffer, 0, data->size);
> + memcpy (bytes + size, buffer.address (), data->size);
> + data->bytes = bytes + size;
> + data->hash = iterative_hash (data->bytes,
> + data->size * sizeof (target_unit), 0);
> + size += data->size;
> + constant_descriptor_rtx_data **slot
> + = htab->find_slot_with_hash (data, data->hash, INSERT);
> + if (*slot)
> + {
> + data->desc->mark = ~(*slot)->desc->labelno;
> + data->desc->offset = (*slot)->offset;
> + }
> + else
> + {
> + unsigned int sz = 1 << floor_log2 (data->size);
> +
> + *slot = data;
> + for (sz >>= 1; sz >= min_size; sz >>= 1)
> + for (unsigned off = 0; off + sz <= data->size; off += sz)
> + {
> + constant_descriptor_rtx_data tmp;
> + tmp.desc = data->desc;
> + tmp.bytes = data->bytes + off;
> + tmp.size = sz;
> + tmp.offset = off;
> + tmp.hash = iterative_hash (tmp.bytes,
> + sz * sizeof (target_unit), 0);
> + slot = htab->find_slot_with_hash (&tmp, tmp.hash, INSERT);
> + if (*slot == NULL)
> + {
> + *slot = data_pool.allocate ();
> + **slot = tmp;
> + }
> + }
> + }
> + }
> + delete htab;
> + XDELETE (bytes);
> + }
> + data_pool.release ();
> +}
> +
> /* Mark all constants that are used in the current function, then write
> out the function's private constant pool. */
>
> @@ -4251,6 +4425,10 @@ output_constant_pool (const char *fnname
> void
> output_shared_constant_pool (void)
> {
> + if (optimize
> + && TARGET_SUPPORTS_ALIASES)
> + optimize_constant_pool (shared_constant_pool);
> +
> output_constant_pool_contents (shared_constant_pool);
> }
> \f
>
>
> Jakub
next prev parent reply other threads:[~2020-08-28 16:07 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 8:33 Hongtao Liu
2020-07-10 9:24 ` Hongtao Liu
2020-07-17 7:24 ` Hongtao Liu
2020-07-23 8:39 ` Jan Hubicka
2020-07-23 13:53 ` Hongtao Liu
2020-07-24 2:37 ` Hongtao Liu
2020-08-04 6:05 ` Hongtao Liu
2020-08-26 21:23 ` Jeff Law
2020-08-27 11:09 ` Jan Hubicka
2020-08-27 12:24 ` Jakub Jelinek
2020-08-27 13:07 ` Richard Biener
2020-08-27 13:20 ` Jakub Jelinek
2020-08-28 6:47 ` Richard Biener
2020-08-28 8:52 ` Jakub Jelinek
2020-08-28 10:36 ` Richard Biener
2020-08-28 10:47 ` Jakub Jelinek
2020-08-28 11:06 ` Richard Biener
2020-08-28 11:26 ` Jakub Jelinek
2020-08-28 14:53 ` Jakub Jelinek
2020-08-28 16:07 ` Richard Sandiford [this message]
2020-08-28 16:25 ` Jakub Jelinek
2020-08-30 9:24 ` Jakub Jelinek
2020-08-31 8:18 ` Richard Biener
2020-08-28 17:18 ` Hongtao Liu
2020-09-01 9:55 ` Hongtao Liu
2020-09-01 10:11 ` Jakub Jelinek
2020-09-02 1:57 ` Hongtao Liu
2020-09-02 9:58 ` Jakub Jelinek
2020-09-03 2:11 ` Hongtao Liu
2020-09-03 7:27 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mpt5z92zrdc.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).