From: Andy Lutomirski <luto@kernel.org>
To: Len Brown <lenb@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>, Willy Tarreau <w@1wt.eu>,
Florian Weimer <fweimer@redhat.com>,
"Bae, Chang Seok" <chang.seok.bae@intel.com>,
Dave Hansen <dave.hansen@intel.com>, X86 ML <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-abi@vger.kernel.org,
"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
Rich Felker <dalias@libc.org>, Kyle Huey <me@kylehuey.com>,
Keno Fischer <keno@juliacomputing.com>
Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features
Date: Tue, 13 Apr 2021 15:58:58 -0700 [thread overview]
Message-ID: <CALCETrUe4_DvSdq7CRJsUxZm8DSwfHevagxJEbHv88UjcC1Hkg@mail.gmail.com> (raw)
In-Reply-To: <CAJvTdKmDb3TOHbb4w1YNcdYH2Pzr+RsAS_o0q3AFP1Xz55R37g@mail.gmail.com>
On Tue, Apr 13, 2021 at 3:47 PM Len Brown <lenb@kernel.org> wrote:
>
> On Tue, Apr 13, 2021 at 4:16 PM Andy Lutomirski <luto@kernel.org> wrote:
> >
> > On Mon, Apr 12, 2021 at 4:46 PM Len Brown <lenb@kernel.org> wrote:
> > >
> > > On Mon, Apr 12, 2021 at 11:21 AM Andy Lutomirski <luto@kernel.org> wrote:
> > >
> > > > AMX: Multiplying a 4x4 matrix probably looks *great* in a
> > > > microbenchmark. Do it once and you permanently allocate 8kB (is that
> > > > even a constant? can it grow in newer parts?), potentially hurts all
> > > > future context switches, and does who-knows-what to Turbo licenses and
> > > > such.
> > >
> > > Intel expects that AMX will be extremely valuable to key workloads.
> > > It is true that you may never run that kind of workload on the machine
> > > in front of you,
> > > and so you have every right to be doubtful about the value of AMX.
> >
> > I fully believe that AMX will be amazing when used for the right
> > workload. The problem is that a library may have no way to tell
> > whether a workload is the type of computationally intensive workload
> > for which it makes sense. Imagine you have a little function:
> >
> > int matrix_times_vector(int dim, float *out, const float *matrix,
> > const float *vector);
> >
> > A clever library might use AMX for this. If dim == 4 and the caller
> > is planning to call it in a long, tight loop, maybe this even makes
> > sense. If dim == 4 and it's being called once, AMX is probably a
> > losing proposition. With previous technologies, at least the impact
> > was limited to the function itself and maybe once per call to the
> > caller. But now, with AMX, the program that invoked this takes a
> > performance and memory hit *forever* if it uses AMX once.
>
> Again...
>
> As this is a "clever" library, built with a clever toolchain, and the
> result is that
> TILERELEASE was properly issued at the end of computation.
> Thus the hardware knows that the (volatile) AMX registers are no longer live.
My argument has *nothing* to do with TILERELEASE. Let me try again.
Suppose I write some user code an call into a library that uses AMX
because the library authors benchmarked it and determined that using
AMX is faster when called in a loop. But I don't call it in a loop.
Then I take the transition penalty into and out of AMX code (I'll
believe there is no penalty when I see it -- we've had a penalty with
VEX and with AVX-512) and my program runs *slower*. And, to top it
off, I've just permanently allocated 8kB of extra FPU state buffer,
*and* I'm taking either an XCR0 or an XFD write penalty on every
future context switch.
Someone or something needs to make a decision as to whether AMX should
actually be used for a given algorithm. The user library community
has swept this under the rug by declaring that libraries should use
the best-in-a-tight-loop code for the entire existence of extensions
beyond XMM, and the cost keeps getting higher.
> > Beyond that, we have the signal handling issue.
>
> I'm unaware of any unresolved feedback on the signal handling series
> other than a wistful "wouldn't a new SIGFAIL be more clear (for future apps)
> than the existing SIGSEGV?" I agree with this sentiment, but I don't
> think we should hold up a patch to prevent corrupting user data
> because a new signal number to describe the scenario doesn't exit.
> Particularly since the new code that knows about the new SIGFAIL
> will also be new code that has been compiled with the new glibc
> that for most cases will prevent this scenario in the first place...
>
> > One solution, going
> > off of what WIlly mentioned, is:
> >
> > bool amx_begin(void *signal_save_buffer);
> > void amx_end();
> >
> > In the amx_begin() region, if you get a signal, the AMX state is saved
> > in the buffer. Outside the region, if you get a signal and AMX is in
> > use, the kernel will either unceremoniously kill the task or will
> > deliver SIGYOUBLEWIT. [0]
>
> I think it is clear that if a new signal ABI is going to be invented,
> that it should be opt-in on state, so that it can run fast on machines
> far into the future by not choosing to opt-in on anything.
>
> It isn't clear that changing the signal save state around critical regions
> (in multiple threads) so that a single (per process definition) of a signal
> handler gets a different result at different times is going to make that
> (new) signal handler author especially happy. More likely they
> either always want the state, or they do not.
Perhaps some form of decision should be reached before AMX lands?
Landing AMX in its current form is a decision, and we should make a
credible effort to decide if it's the right one.
--Andy
next prev parent reply other threads:[~2021-04-13 22:59 UTC|newest]
Thread overview: 130+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 23:12 Candidate Linux ABI for Intel AMX and hypothetical new related features Andy Lutomirski
2021-03-26 23:18 ` Andy Lutomirski
2021-03-27 3:39 ` Len Brown
2021-03-27 9:14 ` Borislav Petkov
2021-03-27 9:58 ` Greg KH
2021-03-29 15:47 ` Len Brown
2021-03-29 16:38 ` Len Brown
2021-03-29 16:48 ` Florian Weimer
2021-03-29 18:14 ` Andy Lutomirski
2021-03-29 18:16 ` Andy Lutomirski
2021-03-29 22:38 ` Len Brown
2021-03-30 5:08 ` Andy Lutomirski
2021-03-30 5:50 ` Noah Goldstein
2021-03-30 17:01 ` Len Brown
2021-03-30 17:05 ` Andy Lutomirski
2021-03-30 17:56 ` Len Brown
2021-03-30 19:12 ` Dave Hansen
2021-03-30 20:20 ` Andy Lutomirski
2021-03-30 20:42 ` Len Brown
2021-03-30 22:01 ` David Laight
2021-03-31 16:31 ` Len Brown
2021-03-31 16:53 ` Andy Lutomirski
2021-03-31 21:42 ` Robert O'Callahan
2021-03-31 22:11 ` Len Brown
2021-03-31 22:28 ` Len Brown
2021-03-31 22:45 ` Andy Lutomirski
2021-04-09 20:52 ` Len Brown
2021-04-09 21:44 ` Andy Lutomirski
2021-04-11 19:07 ` Len Brown
2021-04-12 7:59 ` David Laight
2021-04-12 12:19 ` Borislav Petkov
2021-04-12 17:14 ` Sean Christopherson
2021-03-31 22:52 ` Borislav Petkov
2021-04-09 20:55 ` Len Brown
2021-03-28 0:53 ` Thomas Gleixner
2021-03-29 7:27 ` Peter Zijlstra
2021-03-29 15:06 ` Dave Hansen
2021-03-31 8:24 ` Borislav Petkov
[not found] ` <87lf9nk2ku.fsf@oldenburg.str.redhat.com>
2021-04-12 14:31 ` Borislav Petkov
2021-04-12 14:38 ` Florian Weimer
2021-04-12 15:08 ` Borislav Petkov
2021-04-12 15:10 ` Andy Lutomirski
2021-04-12 15:21 ` Andy Lutomirski
2021-04-12 23:46 ` Len Brown
2021-04-13 0:17 ` Thomas Gleixner
2021-04-13 1:25 ` Len Brown
2021-04-13 3:43 ` Willy Tarreau
2021-04-13 19:51 ` Len Brown
2021-04-14 9:58 ` Borislav Petkov
2021-04-14 10:06 ` Willy Tarreau
2021-04-14 10:08 ` Borislav Petkov
2021-04-14 21:57 ` Len Brown
2021-04-15 4:43 ` Borislav Petkov
2021-04-15 5:29 ` Willy Tarreau
2021-04-15 5:47 ` Borislav Petkov
2021-04-16 22:05 ` Len Brown
2021-04-19 14:14 ` Borislav Petkov
2021-04-19 18:18 ` Len Brown
2021-04-19 19:15 ` Borislav Petkov
2021-04-19 21:33 ` Len Brown
2021-04-19 21:58 ` Borislav Petkov
2021-04-23 19:35 ` Len Brown
2021-04-23 19:57 ` Borislav Petkov
2021-05-02 15:27 ` Len Brown
2021-05-03 5:18 ` Florian Weimer
2021-05-03 13:43 ` Dave Hansen
2021-05-03 13:47 ` Florian Weimer
2021-05-03 14:14 ` Dave Hansen
2021-05-07 18:44 ` Thomas Gleixner
2021-05-07 18:50 ` Andy Lutomirski
2021-05-07 19:22 ` Thomas Gleixner
2021-05-08 9:45 ` Thomas Gleixner
2021-05-18 20:39 ` Len Brown
2021-05-19 23:29 ` Andy Lutomirski
2021-05-20 19:16 ` Len Brown
2021-05-17 9:45 ` Thomas Gleixner
2021-05-17 9:56 ` Florian Weimer
2021-05-17 10:18 ` Thomas Gleixner
2021-05-21 16:29 ` Len Brown
2021-05-17 13:49 ` Arjan van de Ven
2021-05-20 15:35 ` Len Brown
2021-05-20 20:54 ` Thomas Gleixner
2021-05-20 21:13 ` Dave Hansen
2021-05-20 21:41 ` Len Brown
2021-05-20 22:53 ` Dave Hansen
2021-05-21 9:41 ` Thomas Gleixner
2021-05-21 14:44 ` Florian Weimer
2021-05-21 14:49 ` Peter Zijlstra
2021-06-23 15:06 ` Florian Weimer
2021-06-23 23:11 ` Len Brown
2021-06-28 10:14 ` Enrico Weigelt, metux IT consult
2021-06-28 12:49 ` Florian Weimer
2021-06-30 12:22 ` Enrico Weigelt, metux IT consult
2021-06-30 12:41 ` Willy Tarreau
2021-06-30 13:55 ` Arjan van de Ven
2021-06-30 15:20 ` Len Brown
2021-06-30 15:25 ` Enrico Weigelt, metux IT consult
2021-05-21 16:14 ` Dave Hansen
2021-05-21 16:19 ` Florian Weimer
2021-05-21 16:26 ` Len Brown
2021-05-21 16:28 ` Dave Hansen
2021-05-21 16:31 ` Andy Lutomirski
2021-05-21 19:10 ` Thomas Gleixner
2021-05-21 20:07 ` Andy Lutomirski
2021-05-21 21:43 ` Thomas Gleixner
2021-05-21 22:07 ` Len Brown
2021-05-21 22:46 ` Thomas Gleixner
2021-05-21 23:31 ` Len Brown
2021-05-22 7:16 ` Florian Weimer
2021-05-22 23:55 ` Andy Lutomirski
2021-05-21 23:06 ` Dave Hansen
2021-05-21 23:08 ` Len Brown
2021-05-21 19:05 ` Thomas Gleixner
2021-05-20 21:22 ` Len Brown
2021-05-20 21:41 ` Thomas Gleixner
2021-05-20 21:49 ` Len Brown
2021-05-21 9:26 ` Thomas Gleixner
2021-04-19 23:52 ` Paul Eggert
2021-04-13 20:16 ` Andy Lutomirski
2021-04-13 22:47 ` Len Brown
2021-04-13 22:58 ` Andy Lutomirski [this message]
2021-04-14 21:48 ` Len Brown
2021-04-15 16:24 ` Andy Lutomirski
2021-04-15 17:00 ` Dave Hansen
2021-04-15 17:38 ` Andy Lutomirski
2021-04-16 21:54 ` Len Brown
2021-04-16 22:03 ` Andy Lutomirski
2021-04-16 22:10 ` Len Brown
2021-04-16 22:14 ` Andy Lutomirski
2021-04-17 1:57 ` Len Brown
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=CALCETrUe4_DvSdq7CRJsUxZm8DSwfHevagxJEbHv88UjcC1Hkg@mail.gmail.com \
--to=luto@kernel.org \
--cc=chang.seok.bae@intel.com \
--cc=dalias@libc.org \
--cc=dave.hansen@intel.com \
--cc=fweimer@redhat.com \
--cc=keno@juliacomputing.com \
--cc=lenb@kernel.org \
--cc=libc-alpha@sourceware.org \
--cc=linux-abi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=me@kylehuey.com \
--cc=w@1wt.eu \
--cc=x86@kernel.org \
/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).