-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
compile without AVX512 instructions #276
Comments
It seems wrong cpuid extended feature flags are reported for/by the AMD EPYC 7282 processor.
The call to #include <cpuid.h>
#include <stdint.h>
#include <stdio.h>
static void print_register_bits(uint32_t x, const char *s) {
for(size_t i = 0; i < 32; ++i) {
printf("%s & (1 << %zu) = %lu\n", s, i, (unsigned long)(x & ((uint32_t)1 << i)));
}
}
int main(void) {
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
__get_cpuid_count(7, 0, &eax, &ebx, &ecx, &edx);
// https://en.wikipedia.org/wiki/CPUID#EAX=7,_ECX=0:_Extended_Features
print_register_bits(ebx, "ebx");
return 0;
} Namely the following extended feature flags which should not be supported:
My current fix is to override final: prev: {
haskell = prev.haskell // {
packages = prev.haskell.packages // {
ghc966 = prev.haskell.packages.ghc966.override (prevArgs: {
ghc = prevArgs.ghc.overrideAttrs (prevAttrs: {
patches = (prevAttrs.patches or [ ]) ++ [
./haskell-text-no-avx512.patch
];
});
});
};
};
} diff --git a/cbits/measure_off.c b/cbits/measure_off.c
index 5f098f8..231f4d3 100644
--- a/libraries/text/cbits/measure_off.c
+++ b/libraries/text/cbits/measure_off.c
@@ -42,6 +42,7 @@
#if defined(__x86_64__) && defined(COMPILER_SUPPORTS_AVX512)
bool has_avx512_vl_bw() {
+ return false;
#if (__GNUC__ >= 7 || __GNUC__ == 6 && __GNUC_MINOR__ >= 3) || defined(__clang_major__)
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
__get_cpuid_count(7, 0, &eax, &ebx, &ecx, &edx); Overriding Haskell packages proved quite complicated ( |
Great detective work! |
When running nixfmt on a VPS I get an illegal instruction signal. I initially tried nixfmt from NixOS/nixpkgs@107d5ef (EDIT I also tried NixOS/nixpkgs@a0f3e10, see below) but then tried building it:
I dug a little, recompiled it with
cabal new-build --enable-debug-info=3
, and ran it with gdb:This answer on StackOverflow says
vpbroadcastb zmm0,edx
is a AVX512 instruction. Judging by/proc/cpuinfo
my CPU only supports AVX2:VPS's
/proc/cpuinfo
Weirdly I can run nixfmt from NixOS/nixpkgs@a0f3e10 on my Notebook, which does not seem to support AVX512 either:
Notebook's
/proc/cpuinfo
How do I tell cabal to build nixfmt without AVX512? (or ideally how would I override
pkgs.nixfmt-rfc-style
to do that?)The text was updated successfully, but these errors were encountered: