-
Notifications
You must be signed in to change notification settings - Fork 17
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
add conditional checking of neon #73
add conditional checking of neon #73
Conversation
both compile time and run time
found a way to cross compile but it seems like much more changes would be required than a simple if change. |
This is implemented in compile time only. |
this is the minimum necessary change to build runtime check
Thanks for the contribution this sounds reasonable. Couple of quick thoughts before looking deeper into this:
Looks like there are errors that will need to be fixed up. |
Due to is_aarch64_feature_detected that seems so to me.
I tried this, (including installing cross) but it is not working atm under my environment. I'll investigate that in the future. |
I think the nature of the errors mean that I can atleast try to fix them with |
I've been checking the errors and fixing them with clearer conditional compilation settings. I get and fundamentally there is an issue due to this :
|
It should be possible, see the x86 code for inspiration. You can see the difference when benchmarking: RUSTFLAGS="-C target-feature=-sse4.1,-avx2" cargo bench --no-default-features -- 64bit/builder/256
# vs.
RUSTFLAGS="-C target-feature=+sse4.1,-avx2" cargo bench --no-default-features -- 64bit/builder/256 There is also CI code that makes sure it can compile: highway-rs/.github/workflows/main.yml Line 142 in cf11588
|
I think I misunderstood the Next in line would be to setup the runtime tests which would require |
Thanks, some more thoughts before committing myself to this: Are you able to provide a sample use case for the conditional neon check? If neon is ubiquitous, supporting this use case may be more effort than it is worth as now aarch64 users need to either opt into providing RUSTFLAGS="-C target-feature=+neon" or use the conditional check to get the neon implementation, and I want to make sure this is worth it. From an earlier discussion: #51 (comment)
It seems like assuming neon support is relatively safe. |
tbh I agree with this. However, I am unable to make that claim definitely especially towards a repo that I am not a maintainer of, so I went the other way around and rather implemented the I see three paths forward.
As mentioned previously I actually prefer 3 over all else since in the long run it would reduce total code and ongoing code maintenance. |
Apologies, I meant to respond before going on holiday for a week. I'm not sure I quite understand the third option, afaik neon is already assumed when target_arch is |
Line 162 in cf11588
My proposed changes would be to add change the documentation here, to reflect that |
Oh yes, of course. Good eye. Yeah that comment can be updated, as I agree that assuming neon is present is a safe bet. |
Target attribute aarch64
and
std::arch::is_aarch64_feature_detected
seem to be stabilised now
rust-lang/rust#86941
rust-lang/rust#90620
Would this be a good idea now?
If so, how could I test this?