qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Huang Tao <eric.huang@linux.alibaba.com>
To: Richard Henderson <richard.henderson@linaro.org>,
	Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
	qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, zhiwei_liu@linux.alibaba.com,
	liwei1518@gmail.com,  bin.meng@windriver.com,
	alistair.francis@wdc.com, palmer@dabbelt.com,
	Christoph Muellner <christoph.muellner@vrull.eu>
Subject: Re: [PATCH] target/riscv: Implement dynamic establishment of custom decoder
Date: Fri, 8 Mar 2024 17:41:25 +0800	[thread overview]
Message-ID: <04d8070b-04ec-4993-9418-5bb982f0433b@linux.alibaba.com> (raw)
In-Reply-To: <dc9f673a-3f5a-4703-b171-b8599bdec22e@linaro.org>

Hello, Richard and Daniel,

Thanks to your review, the suggestions about decoder_table_size and 
decoder's place will be adopted in the next version of the patch.

But I would not agree that this patch is a wash or worse. On average, 
though, the two approaches may be comparable. However, as more and more 
vendors join in, this approach will have scalability issues.

For example, if you add 10 vendors, it is not fair to treat the 10th 
vendor with the lowest performance. Our approach works for most 
scenarios, which are basic RV extensions + vendor-specific extensions.

Thanks,

Huang Tao


在 2024/3/8 04:35, Richard Henderson 写道:
>>>> -        for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i) {
>>>> -            if (decoders[i].guard_func(ctx->cfg_ptr) &&
>>>> -                decoders[i].decode_func(ctx, opcode32)) {
>>>> +        for (size_t i = 0; i < decoder_table_size; ++i) {
>>>> +            if (ctx->decoder[i](ctx, opcode32)) {
>>>>                   return;
>
> By the way, you're adding layers of pointer chasing, so I suspect 
> you'll find all of this is a wash or worse, performance-wise.
>
> Indeed, since some of the predicates are trivial, going the other way 
> might help: allow everything to be inlined:
>
>     if (decode_insn32(...)) {
>         return;
>     }
>     if (has_xthead_p(...) && decode_xthead(...)) {
>         return;
>     }
>     ...
>
> Even if there are 10 entries here, so what?  All of the code has to be 
> compiled into QEMU.  You're not going to somehow add truly dynamic 
> code that you've loaded from a module.
>
> You could perhaps streamline predicates such as has_xthead_p to not 
> test 11 variables by adding an artificial "ext_xthead_any" 
> configuration entry that is the sum of all of those.
>
>
> r~



  reply	other threads:[~2024-03-08  9:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06  9:33 [PATCH] target/riscv: Implement dynamic establishment of custom decoder Huang Tao
2024-03-07 19:55 ` Daniel Henrique Barboza
2024-03-07 20:11   ` Richard Henderson
2024-03-07 20:35     ` Richard Henderson
2024-03-08  9:41       ` Huang Tao [this message]
2024-03-08 11:56       ` Christoph Müllner
2024-03-07 21:43     ` Daniel Henrique Barboza

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=04d8070b-04ec-4993-9418-5bb982f0433b@linux.alibaba.com \
    --to=eric.huang@linux.alibaba.com \
    --cc=alistair.francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=christoph.muellner@vrull.eu \
    --cc=dbarboza@ventanamicro.com \
    --cc=liwei1518@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=zhiwei_liu@linux.alibaba.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 NNTP newsgroup(s).