Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache size detection #98

Open
kawakami-k opened this issue Mar 11, 2024 · 0 comments
Open

Cache size detection #98

kawakami-k opened this issue Mar 11, 2024 · 0 comments
Assignees

Comments

@kawakami-k
Copy link
Collaborator

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.
@kawakami-k kawakami-k self-assigned this Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant