Fix AMX detection to request OS XSAVE permission on Linux#9199
Fix AMX detection to request OS XSAVE permission on Linux#9199alexreinking wants to merge 3 commits into
Conversation
On Linux, the AMX XTILEDATA state component (XCR0 bit 18) is allocated lazily: the kernel leaves it disabled until a thread explicitly requests it via arch_prctl(ARCH_REQ_XCOMP_PERM). Without this call, xgetbv() reports AMX as OS-disabled even on hardware that fully supports it, and code generated for AVX512_SapphireRapids can fault at runtime. Request the permission and gate the feature on the resulting XCR0 bits in both the AOT runtime feature-detection module and the compiler's own host-target detection in Target.cpp. Fixes #9191 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@sanvila -- Can you test this patch, please? |
abadams
left a comment
There was a problem hiding this comment.
Approving because it looks right, but agree that it would be good to have it tested by the original reporter before merging.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9199 +/- ##
=======================================
Coverage ? 69.26%
=======================================
Files ? 254
Lines ? 78280
Branches ? 18731
=======================================
Hits ? 54218
Misses ? 18500
Partials ? 5562 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi. Sorry, the patch does not apply cleanly on top of the current Debian package, so I can't test this easily (I can only test Debian source packages, either from Debian unstable, or imported from some other place). Maybe the Debian maintainer @LebedevRI has some idea about what we could do here. |
That's practically expected given that last release was almost a year ago. |
On Linux, the AMX XTILEDATA state component (XCR0 bit 18) is allocated lazily: the kernel leaves it disabled until a thread explicitly requests it via arch_prctl(ARCH_REQ_XCOMP_PERM). Without this call, xgetbv() reports AMX as OS-disabled even on hardware that fully supports it, and code generated for AVX512_SapphireRapids can fault at runtime. Request the permission and gate the feature on the resulting XCR0 bits in both the AOT runtime feature-detection module and the compiler's own host-target detection in Target.cpp.
Fixes #9191
Breaking changes
None
Checklist