Thread (30 messages) flat view 30 messages, 6 authors, 2021-07-08

Re: x86 CPU features detection for applications (and AMX)

From: Peter Zijlstra <peterz@infradead.org>
Date: 2021-06-28 19:09:30
Also in: linux-arch

On Mon, Jun 28, 2021 at 10:23:47AM -0700, Thiago Macieira wrote:
On Monday, 28 June 2021 10:11:16 PDT Peter Zijlstra wrote:
quoted
quoted
Consequence: CPU feature checking is done *very* early, often before
main().
For the linker based ones, yes. IIRC the ifunc() attribute is
particularly useful here.
Exactly. ifunc was designed for this exact purpose. And hence the fact that 
CPUID initialisation will be done very, very early.

Anyway, if the AMX state is a sticky "set once per process", it's likely going 
to get set early for every process that *may* use AMX. And this is assuming we 
do the library right and only set it if has AMX code at all, instead of all 
the time.
This, AFAIU. If the ifunc() resolver finds we haz AMX it can do the
prctl() and on success pick the AMX routine.

Assuming of course, that if a program links with a library that supports
AMX, it will actually end up using it.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help