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

arm_cpu_features.cpp is a no-op #7979

Closed
steven-johnson opened this issue Dec 5, 2023 · 6 comments · Fixed by #8298
Closed

arm_cpu_features.cpp is a no-op #7979

steven-johnson opened this issue Dec 5, 2023 · 6 comments · Fixed by #8298

Comments

@steven-johnson
Copy link
Contributor

We don't attempt to detect any features of the host CPU on arm; surely we can do better, at least on Android.

@abadams
Copy link
Member

abadams commented Dec 5, 2023

I looked into this recently, and the state of host cpu feature sniffing on arm is woeful. There's an instruction for it, but it's privileged so user code can't run it. I checked xnnpack because I know it makes per-cpu decisions about what code to run, and it uses https://github.com/pytorch/cpuinfo which literally opens /proc/cpuinfo as a file and parses the string on linux-like targets.

@steven-johnson
Copy link
Contributor Author

The Golang runtime uses hwcap bits for Android and sysctlEnabled() for Darwin. (IIRC Arm recommends avoiding /proc/cpuinfo in favor of hwcap on linux.)

@zvookin
Copy link
Member

zvookin commented Dec 5, 2023

https://github.com/google/cpu_features is fairly well elaborated. I doubt we want to make it a dependency, but maybe providing the glue code to use it as an optional thing to add to one's build would be useful.

@alexreinking
Copy link
Member

Does this apply to AArch64, too? I see there's a comment in aarch64_cpu_features.cpp that reads:

// AArch64 has no CPU-specific Features.

But isn't ARMDotProd an AArch64 extension? We probably want to check for SVE/SVE2, too.

@abadams
Copy link
Member

abadams commented Jun 14, 2024

Yes it does. The main problem here is that it fails to turn on armdotprod. I think that comment is from before we added dot product support.

@abadams
Copy link
Member

abadams commented Jun 14, 2024

See #7901

steven-johnson pushed a commit that referenced this issue Jul 15, 2024
Adds feature detection for ARM CPUs to the runtime library and to
the host target feature computation. Supports Windows, macOS,
Linux, iOS, and Android.

Also fix bug in Type::max() and Type::min() for float16.

Fixes #4727
Fixes #6106
Fixes #7901
Fixes #7979
Fixes #8340
steven-johnson added a commit that referenced this issue Jul 17, 2024
…elease/18.x) (#8343)

Detect ARM CPU features for host target and in runtime (#8298)

Adds feature detection for ARM CPUs to the runtime library and to
the host target feature computation. Supports Windows, macOS,
Linux, iOS, and Android.

Also fix bug in Type::max() and Type::min() for float16.

Fixes #4727
Fixes #6106
Fixes #7901
Fixes #7979
Fixes #8340

Co-authored-by: Alex Reinking <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants