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

Dynamic CPU feature detection #48

Open
arpankapoor opened this issue Sep 21, 2024 · 1 comment
Open

Dynamic CPU feature detection #48

arpankapoor opened this issue Sep 21, 2024 · 1 comment

Comments

@arpankapoor
Copy link
Contributor

Would you consider a PR to add separate functions for XXH3 that choose the implementation at runtime using is_x86_feature_detected!/is_aarch64_feature_detected.

Since this would add a small overhead at runtime (an atomic store of the function pointer in a static variable on first invocation and an atomic load on every subsequent call), these new functions can be guarded behind a feature.

@DoumanAsh
Copy link
Owner

This is actually a bit more complicated since right now hardware specific functions are bound to compile time feature detection

I guess there is no issue to add it, but it is actually pretty much redundant for SSE2 and NEON since all x86_64/aarch64 chips should have respective instructions available by default
Meanwhile web SIMD requires compile time flag always

AVX2 might be the only feature set that benefits from it

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

2 participants