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

From: Len Brown
Date: Mon Mar 29 2021 - 12:40:07 EST


> In particular, the library may use instructions that main() doesn't know exist.

And so I'll ask my question another way.

How is it okay to change the value of XCR0 during the run time of a program?

I submit that it is not, and that is a deal-killer for a request/release API.

eg. main() doesn't know that the math library wants to use AMX,
and neither does the threading library. So main() doesn't know to
call the API before either library is invoked. The threading library starts up
and creates user-space threads based on the initial value from XCR0.
Then the math library calls the API, which adds bits to XCRO,
and then the user-space context switch in the threading library corrupts data
because the new XCR0 size doesn't match the initial size.

-Len