-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: Add runtime detection #55
Conversation
I only updated the english README, sorry, I don't speak Chinese. |
Also, I don't have access to an aarch64 CPU with NEON support, so I can't test the code. |
Thanks for your PR. I tested in aarch64, and the tests failed. The SIMD operators are executed by dispatch, which may hurt the performance. We should dispatch at the function call( such as |
Yeah, makes sense. I just chose this design for now since it was pretty intuitive to implement. Some enum dispatch here, a few checks there, and it pretty much worked (well, minus the aarch64 architecture. It's a bit hard to test for me, so it will probably end up with CI golfing). And about the performance difference, I'll run the benches and check the difference between the |
Well, this fail doesnt look.. pretty: https://github.com/cloudwego/sonic-rs/actions/runs/7423555607/job/20201409871?pr=55#step:5:15 But technically it's not an issue of the code in itself. It's the compiler issuing an illegal instruction, which is really peculiar |
I benched and the runtime detection performance loss (decrease 20%~80%) is unacceptable. We should dispatch in large functions to make sure the performance loss is minimal.
|
An occasional panic when compiling in macos@stable, it seems just a compile error. We could ignore it ~ |
Sorry for the long time without a response. Sorry again, but I'm closing this for now. Maybe I'll open it again in the future with a parser-level dispatch. |
What type of PR is this?
feat: A new feature
- [ ] Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
This PR implements runtime detection of the SSE2, NEON, and AVX2 features, queried via the
is_x86_feature_enabled
andis_aarch64_feature_enabled
macros (gated behind theruntime-detection
macro).(Optional) Which issue(s) this PR fixes:
Closes #14
(optional) The PR that updates user documentation: