Re: Candidate Linux ABI for Intel AMX and hypothetical new related features
From: Len Brown
Date: Fri Apr 23 2021 - 15:35:46 EST
n Mon, Apr 19, 2021 at 5:58 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Mon, Apr 19, 2021 at 05:33:03PM -0400, Len Brown wrote:
> > For this to happen, every thread would not only have to include/link-with
> > code that uses AMX, but that code would have to *run*.
>
> ...the *library* does that decision automatically!
>
> Which means *every* possible thread on the system.
>
> Which means, *every* thread has a fat 8K buffer attached to it because
> the library uses AMX on its behalf by *default*.
Yes. If a library decides to execute AMX instructions on behalf
of a task, the kernel will allocate an 8KB context switch buffer
on behalf of that task.
True. Nothing prevents every user task in the system from executing AMX
instructions, whether explicitly or in a library, and the kernel will
transparently allocate an 8KB buffer for each one.
I do not know anybody who predicts or expects that every task in the system,
or a universally executed library routine, will find a reason to run
AMX instructions.
Again, if that were the expectation or the intent, the proposal would
be to statically
allocate an 8KB context switch buffer on AMX hardware, instead of
dynamic allocation.
Today, libraries routinely probe for what instructions are available
and decide to use them, or not. I think that most customers
consider that a desirable feature -- since it allows them to run the
same application on multiple hardware generations and get the
most out of each generation. I respect your right to dislike that feature.
Granted, if you find a reason to dislike AMX, the mechanisms to disable
it today are on a system-wide basis, not on a process or task basis.
Len Brown, Intel Open Source Technology Center