Comments (7)
Note that the following code, to check for linux kernel support, does not work in chromium sandbox?
#if (defined(__i386__) || defined(__x86_64__)) && defined(__linux__)
#define ARCH_REQ_XCOMP_PERM 0x1023
#define XFEATURE_XTILEDATA 18
/* SetTileDataUse() - Invoke syscall to set ARCH_SET_STATE_USE */
static bool SetTileDataUse(void) {
if (syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA)) {
return false;
}
return true;
}
#endif
Is there another way to test for OS support?
from cpuinfo.
Note that the following code, to check for linux kernel support, does not work in chromium sandbox?
#if (defined(__i386__) || defined(__x86_64__)) && defined(__linux__) #define ARCH_REQ_XCOMP_PERM 0x1023 #define XFEATURE_XTILEDATA 18 /* SetTileDataUse() - Invoke syscall to set ARCH_SET_STATE_USE */ static bool SetTileDataUse(void) { if (syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA)) { return false; } return true; } #endif
Is there another way to test for OS support?
@malfet Does this repo has a CI to test the PRs?
from cpuinfo.
from cpuinfo.
There are a couple more issues with amx detect, but I'm not sure they are in the scope of pytorch/cpuinfo
detect os support for amx on windows, linux etc.
detect/enable amx within chromium sandbox (can't do syscall)
enable amx. the syscall is currently required before using amx.
But I assume the reason amx is disabled by default is it has a high cost to thread switches, so it would be good to enable amx once we actually know we'll be using it
So it would be good to decouple AMX detection from enabling it.
unclear if it is intentional, but the amx intrinsics header is only on for 64 bit, not 32 bit x86.
But from what I can tell, the cpu and compiler (with assembly) can do amx in 32 bit OS's
I think these may be beyond the scope of cpuinfo and/or not entirely solvable? So this issue can be closed
from cpuinfo.
@fbarchard I think enabling AMX
is not in the scope of pytorch/cpuinfo. The thing is we are using some detection method from onednn in pytorch which is not aligned with other functionalities (which are using cpuinfo
). And we received requests to remove the onednn amx detection, and replace with cpuinfo amx detection.
As you have just mentioned, enabling AMX will require a syscall, e.g. syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA)
right now.
The detection and enabling should be decoupled as you said. Currently in pytorch, amx will be ONLY used inside onednn so you don't have to worry about the initialization. But we are trying to use amx intrinsics in some particular CPU kernels, one good example will be the int4packed_gemm
which is used weight only quantization in LLM. And it will be something like:
if (cpuinfo_x86_has_amx_bf16()) {
if (syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA)) {
TORCH_CHECK(false, "Failed to enable AMX on CPU.");
return;
}
int4packed_gemm_amx(...);
} else {
// fallback to avx512f
int4packed_gemm_avx512(...);
}
from cpuinfo.
@mingfeima I will suggest we add enabling AMX to pytorch/cpuinfo. If an app is not using OneDNN, it will be helpful to all those apps and user base. Tying it just to OneDNN is not right approach. May be I didnt understand your response.
from cpuinfo.
@mingfeima I will suggest we add enabling AMX to pytorch/cpuinfo. If an app is not using OneDNN, it will be helpful to all those apps and user base. Tying it just to OneDNN is not right approach. May be I didnt understand your response.
sure, that's just the our original plan:) we will replace all the platforms checks currently implementing through onednn to cpuinfo.
from cpuinfo.
Related Issues (20)
- hwcap on aarch64 linux is 64bit
- exynos9810 problem HOT 2
- Parse cpu a76 core as a55 result in serious performance problem HOT 5
- Add Bazel builds to PR hooks
- CPUINFO_SUPPORTED_PLATFORM not set on OSX as CMAKE_SYSTEM_PROCESSOR is not set HOT 1
- Add a Github workflow to build Android RISC-V, when an NDK is available
- Nothing Phone 1 support HOT 1
- How to obtain information of CPU frequency? HOT 2
- Unknown chip name for Nokia 8.3 5G HOT 1
- Crash Seen with unspecified micro arch for Windows On Arm devices when getting the cpu micro arch info to check the core type
- Ampere(R) Altra(R) Processor - CPU Detection Error
- Incorrect cache-info output with nosmt linux kernel command line HOT 2
- missing `libcpuinfo.pc` from distro package install HOT 1
- `get_cpu_info()` hangs forever
- Why do we need 'get_system_info_from_registry' for ARM64 device?
- FreeBSD: Xeon CPUs are not detected properly HOT 15
- Add avx10 detect
- cannot get frequency from cpuinfo_cluster or cpuinfo_core
- Unable to detect qualcomm snapdragon 8s gen 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpuinfo.