-
Notifications
You must be signed in to change notification settings - Fork 783
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
Reconsider XXH_X86DISPATCH_ALLOW_AVX check #839
Comments
My understanding is that adding Therefore, with no additional precautions, such design would end up generating a So this is not great, but for people who nonetheless want to do that, presumably because they assume that the binary will never run on a platform without Somehow, it looks to me that this is a relatively safe default behavior. Without it, it would be relatively easy and unfortunately completely silent to produce the scenario described above, and then experience a ton of issues during deployment on a diverse set of platforms. The build variable solution looks also fine by me, it makes the builder fully aware of the limitations of the produced binary, and requires to accept them by enabling the variable. This is very different from enabling the scenario transparently. Now, one thing that could be improved is the error message. The way it's phrased, it just tells to not use Now, should it become default and transparent, |
But what makes xxHash special that it needs this treatment? There are hundreds of other packages in a typical distribution, some with run-time dispatch, some without, and they don't do have I agree that good diagnostics are important, but ideally, we want a run-time diagnostic if a binary is executed on an incompatible machine. We have implemented that in glibc, but so far it is only effective for glibc itself because it is difficult to generate the appropriate markers automatically in the link editor (because it does not know if the AVX code linked into the output file is executed conditionally or not). |
Printing diagnostic messages could be done from the CLI, though that is a completely different target. Another thing I'm not sure to understand is why it is such a problem to add a compilation variable ? |
Summarizing the position expressed in this issue : If a build config enables This is understandable. Proper adaptation to this new requirement would require an ability to bypass In the meantime, the current work around which simply removes the "no avx2" protection and let the library be built with the |
Looking back at this issue, it inspires some comments :
|
Distributions are beginning to build with
-march=x86-64-v3
, for example Fedora ELN, so they trip over this.This conditional
#error
seems to be more of a reminder to xxHash developers and not users who recompile an unchanged xxHash distribution. I think it's reasonable to assume that if the toolchain defaults to-march=x86-64-v3
(either implicitly or via injectedCFLAGS
), there is no assumption that the result will run on machines without AVX support.The text was updated successfully, but these errors were encountered: