New submission from Oleksandr Pavlyk <oleksandr.pav...@intel.com>:
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. ---------- components: Extension Modules messages: 414809 nosy: oleksandr-pavlyk priority: normal severity: normal status: open title: Insufficient sigaltstack size used by CPython prevents extensions from using new ISA type: behavior versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46968> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com