public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Darius Rad <darius@bluespec.com>
To: Andrew Waterman <andrew@sifive.com>
Cc: Vincent Chen <vincent.chen@sifive.com>,
	libc-alpha@sourceware.org, Palmer Dabbelt <palmer@dabbelt.com>,
	DJ Delorie <dj@redhat.com>
Subject: Re: [RFC patch 0/5] RISC-V: Add vector ISA support
Date: Wed, 10 Nov 2021 06:39:57 -0500	[thread overview]
Message-ID: <YYuvja/dHesSvW/g@bruce.bluespec.com> (raw)
In-Reply-To: <CA++6G0DGzU6q47UwDtKypih+R4ywBYWDQOVUqNSxZ6zp6-igUQ@mail.gmail.com>

On Tue, Nov 09, 2021 at 02:18:17PM -0800, Andrew Waterman wrote:
> On Tue, Nov 9, 2021 at 2:04 PM Darius Rad <darius@bluespec.com> wrote:
> >
> > On Tue, Nov 09, 2021 at 11:30:49AM -0800, Andrew Waterman wrote:
> > > On Tue, Nov 9, 2021 at 11:21 AM Darius Rad <darius@bluespec.com> wrote:
> > > >
> > > > On Mon, Sep 13, 2021 at 09:41:13AM +0800, Vincent Chen wrote:
> > > > > This patchset adds required ports to support RISC-V Vector (RVV) extension.
> > > > >
> > > > > Since the length of the vector register in RVV (the theoretical maximum
> > > > > is 2^XLEN-1 bits) is variable, a huge and flexible space is needed to back
> > > > > up all vector registers in the signal context. This patchset expands the
> > > > > default SIGSTKSZ, MINSIGSTKSZ, and PTHREAD_STACK_MIN to ensure the stack
> > > > > size is enough for the normal case (VLENB <= 128 bytes). Linux kernel also
> > > > > places the exact minimum signal stack size in AT_MINSIGSTKSZ entry of the
> > > > > auxiliary vector to inform user, so user still can know the sutible minimum
> > > > > signal stack size by sysconf (_SC_MINSIGSTKSZ) if the VLENB is greater
> > > > > than 128 bytes.
> > > > >
> > > > > In addition, according to the specification, the VCSR that combines VXRM and
> > > > > VXSAT has thread storage duration, so this patchset adds the required user
> > > > > context operation for it.
> > > > >
> > > > > Finally, the RISC-V glibc customized sigcontext.h has been removed in this
> > > > > patchset. to reduce the synchronization work when new extension support is
> > > > > introduced to the Linux environment. However, it may bring some backward
> > > > > incompatible issues. Therefore, I sent an RFC patch
> > > > > (https://sourceware.org/pipermail/libc-alpha/2020-June/115549.html)
> > > > > to discuss this modification before this patchset. As I mentioned in the
> > > > > RFC patch thread, I used OpenEmbeded to evaluate the impact. During the
> > > > > tests, I didn't get any compiler errors. Therefore, I infer that this
> > > > > modification may not cause server backward incompatible issues at this
> > > > > moment.
> > > > >
> > > > > 1. The RISC-V V-extension draft v1.0 can be found in
> > > > > https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc
> > > > > 2. The associated kernel implementation can be found in
> > > > > http://lists.infradead.org/pipermail/linux-riscv/2021-September/008249.html
> > > > > 3. QEMU with RISC-V V-extension support can be found in
> > > > > https://github.com/sifive/qemu/tree/rvv-1.0
> > > > >
> > > >
> > > > For the record on libc-alpha, I object to these changes.  In particular,
> > > > the lack of a user space API for the corresponding Linux support.  More
> > > > discussion on linux-riscv:
> > > >
> > > > https://lists.infradead.org/pipermail/linux-riscv/2021-September/thread.html#8361
> > >
> > > I do not agree with that analysis.  The vector extension scales down
> > > to having potentially very little state (512 bytes on RV64) and we
> > > expect typical applications-processor implementations to land in the
> > > 512 - 2048-byte range.  This matches AVX, not AMX.  Furthermore, we
> > > want all implementations to take advantage of vectorized C
> > > string/memory functions without having to explicitly opt in.  Not
> > > doing this would put RISC-V at a significant competitive disadvantage
> > > vs. other architectures with SIMD units.
> > >
> >
> > The vector extension also scales up to 256 kiB, which, for comparison sake,
> > is considerably more than AMX.
> 
> We have good reason to believe that apps/server processors will not
> get anywhere near an order of magnitude of that limit, and that huge
> vector regfiles will be the province of HPC.
> 
> >
> > There are those that believe AVX should have had some sort of user space
> > control [1], as well.
> >
> > [1] https://lore.kernel.org/lkml/87k0ntazyn.ffs@nanos.tec.linutronix.de/
> >
> > I don't see how having user space control either prevents glibc from using
> > vector by default when it is available or how it puts RISC-V at a
> > significant competitive disadvantage.
> 
> My "competitive advantage" comment was about the need to do the
> following (quoting from your other message):
> 
> "A process (or thread) must specifically request the desire to use
> vector extensions (perhaps with some new arch_prctl() API)"
> 
> I had assumed you meant that programmers must do this
> explicitly--which would clearly put RISC-V at a competitive
> disadvantage.  If glibc initialization code makes this API call, then
> I withdraw my comment. (But then I question the value of the API call
> vs. the kernel automatically enabling the vector unit, since
> essentially all processes will invoke the API call anyway.)

The benefit to having the API call is that it allows the kernel to report a
failure.  This is necessary now, because memory allocation for context
state can fail, and in some circumstances there is no other way to report
that error.  It is also useful for the future, as a way for the kernel to
provide a policy enforcement mechanism whereby the system administrator can
control which tasks are permitted to use vector extensions.

      reply	other threads:[~2021-11-10 11:40 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13  1:41 Vincent Chen
2021-09-13  1:41 ` [RFC patch 1/5] RISC-V: Remove riscv-specific sigcontext.h Vincent Chen
2021-09-13  1:41 ` [RFC patch 2/5] RISC-V: Reserve about 5K space in mcontext_t to support future ISA expansion Vincent Chen
2021-09-13 13:44   ` Florian Weimer
2021-09-13 13:52     ` Rich Felker
2021-09-16  8:02       ` Vincent Chen
2021-09-16  8:14         ` Florian Weimer
2021-09-18  3:04           ` Vincent Chen
2022-12-09  3:39             ` RISCV kernel struct sigcontext expansion for V regs and potential glibc ABI break (was Re: [RFC patch 2/5] RISC-V: Reserve about 5K space in mcontext_t to support future ISA expansion.) Vineet Gupta
2022-12-09  4:03               ` Vineet Gupta
2022-12-20 20:05               ` Adding V-ext regs to signal context w/o expanding kernel struct sigcontext to avoid glibc ABI break Vineet Gupta
2022-12-21 15:53                 ` Vincent Chen
2022-12-21 19:45                   ` Vineet Gupta
2022-12-21 19:52                     ` Vineet Gupta
2022-12-22  3:37                       ` Vincent Chen
2022-12-22 19:25                         ` Vineet Gupta
2022-12-23  2:27                           ` Vincent Chen
2022-12-23 19:42                             ` Vineet Gupta
2022-12-22  5:32                       ` Richard Henderson
2022-12-22 18:33                         ` Andy Chiu
2022-12-22 20:27                           ` Vineet Gupta
2022-12-28 10:53                             ` Andy Chiu
2023-01-03 19:17                               ` Vineet Gupta
2023-01-04 16:34                                 ` Andy Chiu
2023-01-04 20:46                                   ` Vineet Gupta
2023-01-04 21:29                                     ` Philipp Tomsich
2023-01-04 21:37                                       ` Andrew Waterman
2023-01-04 22:43                                       ` Vineet Gupta
2023-01-09 13:33                                         ` Kito Cheng
2023-01-09 19:16                                           ` Vineet Gupta
2023-01-10 13:21                                             ` Kito Cheng
2023-01-10 18:07                                               ` Auto-enabling V unit and/or use of elf attributes (was Re: Adding V-ext regs to signal context w/o expanding kernel struct sigcontext to avoid glibc ABI break) Vineet Gupta
2023-01-11  1:22                                                 ` Richard Henderson
2023-01-11  4:28                                                   ` Jeff Law
2023-01-11  4:57                                                     ` Richard Henderson
2023-01-11  5:07                                                       ` Jeff Law
2023-01-11  6:00                                                         ` Andy Chiu
2023-01-11  6:20                                                           ` Jeff Law
2023-01-11  9:28                                                             ` Andy Chiu
2023-01-11 12:13                                                               ` Andy Chiu
2023-01-23 12:17                                                                 ` Conor Dooley
2023-01-23 13:29                                                                   ` Andy Chiu
2023-01-11  5:05                                                   ` Anup Patel
2023-01-11  5:23                                                   ` Richard Henderson
2022-12-22 22:33                           ` Adding V-ext regs to signal context w/o expanding kernel struct sigcontext to avoid glibc ABI break Richard Henderson
2022-12-22 23:47                           ` Conor Dooley
2022-12-22 23:58                             ` Vineet Gupta
2022-12-22 20:30                         ` Vineet Gupta
2022-12-22 21:38                           ` Andrew Waterman
2022-12-22  1:50                     ` Vincent Chen
2022-12-22  5:34                     ` Richard Henderson
2021-09-16 23:56         ` [RFC patch 2/5] RISC-V: Reserve about 5K space in mcontext_t to support future ISA expansion Ben Woodard
2021-09-18  3:15           ` Vincent Chen
2021-09-20 16:41             ` DJ Delorie
2021-09-20 17:10               ` Florian Weimer
2021-10-01  1:43                 ` Vincent Chen
2021-10-01 12:08                   ` Adhemerval Zanella
2021-09-17 17:03         ` Rich Felker
2021-09-18  3:19           ` Vincent Chen
2021-09-13  1:41 ` [RFC patch 3/5] RISC-V: Save and restore VCSR when doing user context switch Vincent Chen
2021-09-14 23:48   ` Joseph Myers
2021-09-15  0:13     ` Andrew Waterman
2021-09-16  9:20       ` Vincent Chen
2021-10-01 13:04   ` Adhemerval Zanella
2021-09-13  1:41 ` [RFC patch 4/5] RISC-V: Extend MINSIGSTKSZ and SIGSTKSZ to backup RVV registers Vincent Chen
2021-09-13 13:51   ` Rich Felker
2021-09-16  9:25     ` Vincent Chen
2021-09-13  1:41 ` [RFC 5/5] RISC-V: Expand PTHREAD_STACK_MIN to support RVV environment Vincent Chen
2021-09-14 23:43   ` Joseph Myers
2021-09-15 10:42     ` Florian Weimer
2021-09-15 14:31       ` H.J. Lu
2021-09-16 10:21         ` Vincent Chen
2021-09-13 19:11 ` [RFC patch 0/5] RISC-V: Add vector ISA support Vineet Gupta
2021-09-15 19:37   ` Jim Wilson
2021-11-09 19:21 ` Darius Rad
2021-11-09 19:30   ` Andrew Waterman
2021-11-09 22:03     ` Darius Rad
2021-11-09 22:18       ` Andrew Waterman
2021-11-10 11:39         ` Darius Rad [this message]

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=YYuvja/dHesSvW/g@bruce.bluespec.com \
    --to=darius@bluespec.com \
    --cc=andrew@sifive.com \
    --cc=dj@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=palmer@dabbelt.com \
    --cc=vincent.chen@sifive.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).