Cache size detection
kawakami-k opened this issue · 0 comments
kawakami-k commented
The method of acquiring cache size varies depending on OS. In some cases, there is no way to obtain cache size from application software running on a guest OS different from a host OS, such as Docker environment. For those cases, it's better to set up an interface that allows Xbyak_aarch64 to get CPU cache sizes from environment variables.
The below table shows the environment variables. At this time, (level) can be 1, 2 or 3.
Environment variable | Value |
---|---|
XBYAK_AARCH64_L(level)_TYPE | DATA_ONLY,SEPARATE,UNIFIED,NONE |
XBYAK_AARCH64_L(level)D_SIZE | L(level) data cache size [KiB] |
XBYAK_AARCH64_L(level)I_SIZE | L(level) instruction cache size [KiB] |
XBYAK_AARCH64_L(level)_SHARING_CORES | # of cores sharing L(level) cache |
In case of Fujitsu A64FX,
Environment variable | Value |
---|---|
XBYAK_AARCH64_L1_TYPE | SEPARATE |
XBYAK_AARCH64_L1D_SIZE | 64 |
XBYAK_AARCH64_L1I_SIZE | 64 |
XBYAK_AARCH64_L1_SHARING_CORES | 1 |
XBYAK_AARCH64_L2_TYPE | UNIFIED |
XBYAK_AARCH64_L2D_SIZE | 8192 |
XBYAK_AARCH64_L2I_SIZE | 8192 |
XBYAK_AARCH64_L2_SHARING_CORES | 12 |
Each CPU core of A64FX has 64 KiB L1D, 64KiB L1I. CMG (Core memory group) of A64FX consists of 12 CPU cores. 8 MiB unified cache is shared by 12 CPU cores.
- Xbyak_aarch64 checks the environment variables in the following order.
XBYAK_AARCH64_L1_TYPE, L1D_SIZE, L1I_SIZE, L1_SHARING_CORES, L2_TYPE, L2D_SIZE, L2I_SIZE, L2_CHARING_CORES, ... If an undefined variable is found, no further environment variable checks are performed and subsequent variables are assumed to have default values. - If XBYAK_AARCH64_L1_TYPE is not set, Xbyak_aarch64 attempts to retrieve cache information by the method provided by OS.