Are there any plans to support BLIS in Julia?

Given the flexibility of the BLIS API and the ability to fuse kernels, I was just wondering if there are any plans of incorporating this functionality in Julia.

1 Like

I don’t know about plans, but [LinearAlgebra] BLAS backend and update-alternatives · Issue #30707 · JuliaLang/julia · GitHub looks related.

Is there particular functionality from BLIS which you would like and which you think is not covered by julia already?

1 Like

There’s an early package to support BLIS and the BLIS API:

https://github.com/tkelman/BLIS.jl

I’ve used BinaryBuilder to compile BLIS binary libraries using BinaryBuilder. My main purpose was compiling a drop-in BLAS replacement for WebAssembly:

The key trick for native support would be compiling support for multiple CPU’s.

Also related is interesting work on supporting BLAS functionality directly in Julia:

3 Likes

Tye BLIS folks recently published benchmarks at blis/Performance.md at master · flame/blis · GitHub. It looks better than OpenBLAS, except for small matrices. It also supports mixed-precision. https://github.com/tkelman/BLIS.jl appears to be gone?

5 Likes

I believe Sacha0 (Sacha Verweij) · GitHub did some work on this. I don’t know his discourse handle to ping him.

By the way it should be entirely possible to create BinaryBuilder project for Blis and provide julia wrappers.

As noted above, there’s already a start of a BinaryBuilder for Blis:

As I recall, building was pretty easy. I didn’t test it or try out builds that include different kernels. I don’t have near-term plans to take this any farther, though, so someone else might want to have a go at it.

2 Likes

Tagging on to this, I’ve just started wrapping the TBLIS library for tensor contractions. Not anything to write home about yet, but I thought I’d stick this here. GitHub - mdav2/TBLIS.jl: Julia wrapper for TBLIS tensor contraction library.

2 Likes

Anyone still tuned-in?

Quite experimental but I’m trying to make a full-functional Julia wrapper for BLIS at BLIS.jl. It’s currently overwriting like LinearAlgebra.BLAS.gemm_wrapper! to “redirect” mul! backends.

Binary artifact for BLIS at Yggdrasil was updated as well. It now has Linux (x86_64/ARMv7/Aarch64), Windows and macOS.

For people interested in TBLIS, its binary artifact is also updated for all x86_64 platforms (Linux/Linux:MUSL/Windows/macOS/FreeBSD). Please allow me to further advertise BliContractor.jl which is a wrapper around TBLIS and exports methods compatible with TensorOperations.jl.

3 Likes

Just tried BLIS.jl on Julia 1.6.* and 1.7.*, but it fails to precompile on all of my machines (Windows 10 or 11). What can I do?

I’d start by actually showing the error messages. Saying “fails to precompile” isn’t particularly useful.

Thanks!

ERROR: The following 1 direct dependency failed to precompile:

BLIS [32f2db32-628a-4fc2-9392-deeafdcf461f]

Failed to precompile BLIS [32f2db32-628a-4fc2-9392-deeafdcf461f] to C:\Users\DELL\.julia\compiled\v1.7\BLIS\jl_DA44.tmp.
ERROR: LoadError: KeyError: key "HOME" not found
Stacktrace:
  [1] (::Base.var"#626#627")(k::String)
    @ Base .\env.jl:79
  [2] access_env(onError::Base.var"#626#627", str::String)
    @ Base .\env.jl:14
  [3] getindex(#unused#::Base.EnvDict, k::String)
    @ Base .\env.jl:79
  [4] top-level scope
    @ C:\Users\DELL\.julia\packages\BLIS\0fyNy\src\BLIS.jl:94
  [5] include
    @ .\Base.jl:418 [inlined]
  [6] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base .\loading.jl:1318
  [7] top-level scope
    @ none:1
  [8] eval
    @ .\boot.jl:373 [inlined]
  [9] eval(x::Expr)
    @ Base.MainInclude .\client.jl:453
 [10] top-level scope
    @ none:1
in expression starting at C:\Users\DELL\.julia\packages\BLIS\0fyNy\src\BLIS.jl:1
julia> versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, icelake-client)

should probably be

if isfile(joinpath(homedir(), ".blis_jlbla_blacklist"))
    blacklist = readdlm(joinpath(homedir(), ".blis_jlbla_blacklist"))
end

instead of trying to access HOME environment variable

2 Likes

Have you tried GitHub - carstenbauer/BLISBLAS.jl: BLIS-pendant of MKL.jl instead? This one is based on LBT and has worked fine for me.

Yes, it works :grinning:

Just to clarify, which one works? BLISBLAS.jl?

seems to be newer (at least some commits are newer). Is the graph there still current? I.e. is BLIS (or BLISBLAS.jl) much faster for some stuff? Compared to built-in, or better options. There’s also MKL.jl and Julia-only code.

You should always test on latest (supported) version, which is 1.8.2. That said 1.6 (and I guess 1.7 which is no longer supported though) should also work. Could also try 1.9-DEV…

Well, the opposite is true: BLISBLAS.jl is younger than BLIS.jl :slight_smile: Since BLISBLAS.jl uses LBT (similar to MKL.jl) it has almost no code in it. So why should it have new commits? :slight_smile:

BLIS.jl takes a much more manual approach (it was created/started before LBT was a thing IIRC). Hence, the codebase is much bigger.

Don’t know about the graph but yes, BLIS can be faster than OpenBLAS and Intel MKL, in particular on non-Intel hardware (e.g. AMD). See GitHub - carstenbauer/julia-dgemm-noctua: DGEMM Benchmarks on Noctua 1/2 at PC2 for example.

2 Likes

I meant your BLISBLAS.jl :grinning:
And now BLIS.jl also works for me after @giordano 's suggestion :slightly_smiling_face:

1 Like