Re: Candidate Linux ABI for Intel AMX and hypothetical new related features

From: Willy Tarreau
Date: Wed Jun 30 2021 - 08:42:36 EST


On Wed, Jun 30, 2021 at 02:22:19PM +0200, Enrico Weigelt, metux IT consult wrote:
> Ah, now I'm beginning to get it:
>
> * this feature needs to be initialized first, before it can be used
> * on first use (when not initialized yet), it traps into the kernel
> * we don't want to always initialize it at boot
>
> Correct ?

Not exactly. It's available but comes with a huge context-switch
cost for each task using it.

> What I'm wondering: why shall the process explicitly ask for it and
> why isn't the initialization be done either on bootup or on first use ?

The whole discussion about the pros and cons is archived here:

https://lore.kernel.org/lkml/CALCETrW2QHa2TLvnUuVxAAheqcbSZ-5_WRXtDSAGcbG8N+gtdQ@xxxxxxxxxxxxxx/

> I'm still claiming already this old model is a horrible misdesign and
> (most of) the extensions made over the decades are anything but well
> designed - there had been many changes to do it much, much better.
> For example there would have been ways to introduce new opcodes in a way
> that they can be easily emulated in kernel or userland, w/o going
> through a full trap.

It's not a matter of opcodes but of context switch cost which not
everyone wants to inflict to every single task that opportunistically
uses these instructions without realizing what this subsequently
implies for the rest of their life. All this is discussed in the
thread above. I don't remember seeing anybody criticize the choice
of instruction encoding hence it's irrelevant to this discussion.

Hoping this helps,
Willy