Message414809
The following snippet illustrates request by an extension to use AMX registers:
```
// no increase sigaltstack size fix will not wark till we fix python
void enable_amx_no_fix()
{
unsigned long bitmask;
long rc;
rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA);
if (rc) {
printf("The kernel rejects the AMX use.\n");
printf("errno %d\n",errno);
} else {
printf("The kernel allows to use AMX.\n");
}
rc = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_PERM, &bitmask);
if (rc) {
printf("rc error\n");
} else {
if (( bitmask & XFEATURE_MASK_XTILEDATA) == 0){
printf("verify AMX permission faild bitmask %ld\n",bitmask);
}
}
}
```
This request fails on the account of too small a size for sigaltstack used by CPython allocated in Modules/faulthandler.c
The stack size used is 2*SIGSTKSZ, and does not take hardware capabilities into account.
Linux kernel 5.14 adds support to query minimum size of sigaltstack dynamically via getauxval(AT_MINSIGSTKSZ).
AMX support is added in Linux kernel 5.16
CPython should make use of this when built against more recent Linux kernels. |
|
Date |
User |
Action |
Args |
2022-03-09 19:07:02 | oleksandr-pavlyk | set | recipients:
+ oleksandr-pavlyk |
2022-03-09 19:07:02 | oleksandr-pavlyk | set | messageid: <1646852822.75.0.964834360067.issue46968@roundup.psfhosted.org> |
2022-03-09 19:07:02 | oleksandr-pavlyk | link | issue46968 messages |
2022-03-09 19:07:02 | oleksandr-pavlyk | create | |
|