public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Jiang, Haochen" <haochen.jiang@intel.com>
Cc: "hjl.tools@gmail.com" <hjl.tools@gmail.com>,
	"binutils@sourceware.org" <binutils@sourceware.org>
Subject: Re: [PATCH 2/5] Support Intel SHA512
Date: Fri, 14 Jul 2023 09:12:09 +0200	[thread overview]
Message-ID: <dd39e28d-0155-6f97-3996-45874047b4f3@suse.com> (raw)
In-Reply-To: <SA1PR11MB5946F3E0406D3F632404352CEC34A@SA1PR11MB5946.namprd11.prod.outlook.com>

On 14.07.2023 05:40, Jiang, Haochen wrote:
>> Up-front question on title and naming in the patch: Doc indeed says just
>> SHA512 (same for SM3 and SM4), but are you (including those who assigned
>> those names) sure that's going to stay this way by the time this is merged
>> into the SDM? Considering other ISA names, AVX-SHA512 would seem more
>> consistent to me.
> 
> SHA512 is not an ISA under AVX set.

I'm afraid I don't understand. How is it not? It uses YMM registers.
And conceivably there could be EVEX encodings of these (allowing the
full 32 register set to be used), which I'd then call AVX512-SHA512.

It's also not possible to potentially express the same thing in
legacy encodings (unlike e.g. GFNI). Even for SM3, where only 128-
bit operations are used, that's not possible, as the insns have 3
inputs (the destination is r/w).

> So AVX-SHA512 is not used.
> 
> The actual meaning in SDM/ISE is that we need to check both AVX and SHA512
> feature bit to use the instruction.
> 
> I could drop the imply in implementation and change to checking both ISA bit
> set. But since it will use xmm/ymm register, in current implementation, we
> choose to imply AVX for SHA512 for convenience.
> 
> Whether it should be AVX/AVX2 will be mentioned below.
>[...]
>>> --- a/opcodes/i386-gen.c
>>> +++ b/opcodes/i386-gen.c
>>> @@ -168,6 +168,8 @@ static const dependency isa_dependencies[] =
>>>      "LKGS" },
>>>    { "AVX_VNNI_INT16",
>>>      "AVX2" },
>>> +  { "SHA512",
>>> +    "AVX" },
>>
>> Like for the earlier patch this wants to move up a little. I also question that it's
>> AVX that's the baseline feature here. While correct for SM3, I expect it needs
>> to be AVX2 both here and for SM4, for AVX offering no real 256-bit integer
>> operations. (Obviously this wants taking care of in the doc as well.)
> 
> You got a point here.
> 
> I will check with the design and HW team since it is actually AVX2 introduces the
> 256-bit integer operations to see if this is a misuse.
> 
> One reason I can think of using AVX only is that SHA512 and SM4 actually do not
> need other integer operations to help with. It only needs VMOV, which is introduced
> by AVX. So when hardware checking XSTATE, AVX is enough.

So for a feature check requirement referencing just AVX may be okay. But
there's not going to be any SHA512 without AVX anyway, for there not
being any YMM registers without AVX; you wouldn't be able to fill the
register operands. Hence the extra feature check is redundant (and would
hence better be omitted).

As to implying baseline functionality, using AVX (rather than AVX2) makes
little sense, so even if the feature check remained (note that various
other extensions, including e.g. AVX-VNNI-INT<n>, don't have such a
secondary requirement), I'd still be fairly insistent on having the
base feature named here (and for SM4) be AVX2 (to be in line with other
similar baseline selections).

Jan

  reply	other threads:[~2023-07-14  7:12 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13  6:32 [PATCH 0/5] Support Intel Arrow Lake/Lunar Lake ISAs Haochen Jiang
2023-07-13  6:32 ` [PATCH 1/5] Support Intel AVX-VNNI-INT16 Haochen Jiang
2023-07-13  9:29   ` Jan Beulich
2023-07-14  5:51     ` Jiang, Haochen
2023-07-13  6:33 ` [PATCH 2/5] Support Intel SHA512 Haochen Jiang
2023-07-13 10:02   ` Jan Beulich
2023-07-14  3:40     ` Jiang, Haochen
2023-07-14  7:12       ` Jan Beulich [this message]
2023-07-18  7:20         ` Jiang, Haochen
2023-07-18  7:54           ` [PATCH v2] " Haochen Jiang
2023-07-18  7:59             ` Jiang, Haochen
2023-07-18  8:51             ` Jan Beulich
2023-07-20  8:32               ` Jiang, Haochen
2023-07-20 10:37                 ` Jan Beulich
2023-07-20  8:32               ` [PATCH] " Haochen Jiang
2023-07-20 11:07                 ` [PATCH v3] " Jan Beulich
2023-07-27  5:52                   ` Jiang, Haochen
2023-07-18  8:11           ` [PATCH 2/5] " Jan Beulich
2023-07-13  6:33 ` [PATCH 3/5] Support Intel SM3 Haochen Jiang
2023-07-13 10:20   ` Jan Beulich
2023-07-18  8:09     ` [PATCH v2] " Haochen Jiang
2023-07-18  9:03       ` Jan Beulich
2023-07-24  2:54         ` Jiang, Haochen
2023-07-13  6:33 ` [PATCH 4/5] Support Intel SM4 Haochen Jiang
2023-07-13 10:25   ` Jan Beulich
2023-07-18  7:21     ` Jiang, Haochen
2023-07-18  8:13       ` [PATCH v2] " Haochen Jiang
2023-07-18  9:11         ` Jan Beulich
2023-07-13  6:33 ` [PATCH 5/5] Support Intel PBNDKB Haochen Jiang
2023-07-13 10:29   ` Jan Beulich
2023-07-14  7:15     ` Jiang, Haochen

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=dd39e28d-0155-6f97-3996-45874047b4f3@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=haochen.jiang@intel.com \
    --cc=hjl.tools@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).