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

amd-blis: init at 2.2 #92981

Closed
wants to merge 1 commit into from
Closed

amd-blis: init at 2.2 #92981

wants to merge 1 commit into from

Conversation

danieldk
Copy link
Contributor

@danieldk danieldk commented Jul 12, 2020

Motivation for this change

Add the AMD fork of BLIS. This provides a BLAS-compatible library that is optimized for AMD CPUs. A counterpart to MKL, but open source :).

Tested by recompiling numpy with AMD BLIS through the new BLAS overlay mechanism.

After this PR, I'll also do a PR for AMD's libflame, so that we have a full AMD BLAS/LAPACK as an alternative.

Changed to Draft until I figure out why ofborg VMs execute an illegal instruction.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@doronbehar
Copy link
Contributor

CI builds fail.

@danieldk
Copy link
Contributor Author

CI builds fail.

Hmpf. SIGILL (Illegal instruction) on x86_64. Either it's misdetecting the features of the VM's CPU, or the features supported by CPUID are not permitted by the VM. Unfortunately, blis does not offer the possibility to override the architecture with e.g. an environment variable. I'll think a bit about the fix. Perhaps something along the lines of:

flame/blis@e22ab9d

@danieldk
Copy link
Contributor Author

@ofborg build amd-blis

@danieldk
Copy link
Contributor Author

@ofborg build amd-blis

@danieldk
Copy link
Contributor Author

I figured it out. There is an error in the selection of CFLAGS that causes the zen kernels (which are also used on some Intel CPUs) to be compiled with Skylake X optimizations when the x86_64 configuration is chosen. This introduces some AVX-512 instructions in the kernel (vextractf64x2), interestingly, this does not fail on my Zen 2 machine.

The reason that the kernel selection fails is that x86_64 does not actually contain zen, so the kernel cannot be compiled with -march=zen. Adding zen (and zen2) to the amd64/x86_64 kernel leads to another error. I'll try to see if this is easily fixable.

@danieldk danieldk closed this Jul 13, 2020
@danieldk danieldk mentioned this pull request Jul 13, 2020
10 tasks
@danieldk danieldk deleted the amd-blis branch July 13, 2020 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants