Skip to content

Commit a5cc744

Browse files
Fix BLIS detection to use BLIS_jll and LAPACK_jll packages
- Update algorithm detection to check for BLIS_jll and LAPACK_jll instead of BLIS.jl - Use correct UUIDs for JLL package detection in loaded modules - Add detailed system information tracking for JLL package availability - Improve error messages to clearly indicate JLL package requirements - BLISLUFactorization now correctly depends on JLL packages being loaded - Fixes BLIS algorithm availability detection for proper benchmarking 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent d238af5 commit a5cc744

File tree

3 files changed

+46
-19
lines changed

3 files changed

+46
-19
lines changed

lib/LinearSolveAutotune/src/LinearSolveAutotune.jl

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,33 @@ const BLIS_JLL_AVAILABLE = Ref(false)
2323
const LAPACK_JLL_AVAILABLE = Ref(false)
2424

2525
function __init__()
26-
# Try to load JLL packages at runtime
26+
# Try to load JLL packages at runtime for enhanced BLIS support
2727
try
28-
@eval using BLIS_jll
29-
BLIS_JLL_AVAILABLE[] = true
30-
@info "BLIS_jll loaded for enhanced BLIS library access"
28+
# Check if BLIS_jll is available in the current environment
29+
if haskey(Base.loaded_modules, Base.PkgId(Base.UUID("068f7417-6964-5086-9a5b-bc0c5b4f7fa6"), "BLIS_jll"))
30+
BLIS_JLL_AVAILABLE[] = true
31+
@info "BLIS_jll detected - enhanced BLIS library access available"
32+
else
33+
@eval using BLIS_jll
34+
BLIS_JLL_AVAILABLE[] = true
35+
@info "BLIS_jll loaded for enhanced BLIS library access"
36+
end
3137
catch
32-
@debug "BLIS_jll not available, using standard BLIS detection"
38+
@debug "BLIS_jll not available, BLISLUFactorization may not work"
3339
end
3440

3541
try
36-
@eval using LAPACK_jll
37-
LAPACK_JLL_AVAILABLE[] = true
38-
@info "LAPACK_jll loaded for enhanced LAPACK library access"
42+
# Check if LAPACK_jll is available in the current environment
43+
if haskey(Base.loaded_modules, Base.PkgId(Base.UUID("51474c39-65e3-53ba-86ba-03b1b862ec14"), "LAPACK_jll"))
44+
LAPACK_JLL_AVAILABLE[] = true
45+
@info "LAPACK_jll detected - enhanced LAPACK library access available"
46+
else
47+
@eval using LAPACK_jll
48+
LAPACK_JLL_AVAILABLE[] = true
49+
@info "LAPACK_jll loaded for enhanced LAPACK library access"
50+
end
3951
catch
40-
@debug "LAPACK_jll not available, using standard LAPACK detection"
52+
@debug "LAPACK_jll not available, some BLIS functionality may be limited"
4153
end
4254
end
4355

lib/LinearSolveAutotune/src/algorithms.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ function get_available_algorithms(; skip_missing_algs::Bool = false)
3535
end
3636
end
3737

38-
# BLIS if available and hardware supports it
38+
# BLIS if JLL packages are available and hardware supports it
3939
try
40-
# Check if BLIS is loaded and BLISLUFactorization is available
41-
if isdefined(LinearSolve, :BLISLUFactorization) && hasmethod(LinearSolve.BLISLUFactorization, ())
40+
# Check if BLIS_jll and LAPACK_jll are available, which enable BLISLUFactorization
41+
blis_jll_available = haskey(Base.loaded_modules, Base.PkgId(Base.UUID("068f7417-6964-5086-9a5b-bc0c5b4f7fa6"), "BLIS_jll"))
42+
lapack_jll_available = haskey(Base.loaded_modules, Base.PkgId(Base.UUID("51474c39-65e3-53ba-86ba-03b1b862ec14"), "LAPACK_jll"))
43+
44+
if (blis_jll_available || lapack_jll_available) && isdefined(LinearSolve, :BLISLUFactorization) && hasmethod(LinearSolve.BLISLUFactorization, ())
4245
# Test if BLIS works on this hardware
4346
try
4447
test_alg = LinearSolve.BLISLUFactorization()
@@ -54,15 +57,19 @@ function get_available_algorithms(; skip_missing_algs::Bool = false)
5457
end
5558
end
5659
else
57-
msg = "BLIS.jl not loaded or BLISLUFactorization not available"
60+
if blis_jll_available || lapack_jll_available
61+
msg = "BLIS_jll/LAPACK_jll loaded but BLISLUFactorization not available in LinearSolve"
62+
else
63+
msg = "BLIS_jll and LAPACK_jll not loaded - BLISLUFactorization requires these JLL packages"
64+
end
5865
if skip_missing_algs
5966
@warn msg
6067
else
61-
@info msg # Not having BLIS is not an error
68+
@info msg # Not having BLIS JLL packages is not an error
6269
end
6370
end
6471
catch e
65-
msg = "Error checking BLIS availability: $e"
72+
msg = "Error checking BLIS JLL package availability: $e"
6673
if skip_missing_algs
6774
@warn msg
6875
else

lib/LinearSolveAutotune/src/gpu_detection.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,26 @@ function get_detailed_system_info()
242242
system_data["apple_accelerate_used"] = false
243243
end
244244

245-
# BLIS availability check
245+
# BLIS availability check - based on JLL packages
246246
system_data["blis_available"] = false
247247
system_data["blis_used"] = false
248+
system_data["blis_jll_loaded"] = false
249+
system_data["lapack_jll_loaded"] = false
250+
248251
try
249-
# Check if BLIS is loaded and BLISLUFactorization is available
250-
if isdefined(LinearSolve, :BLISLUFactorization) && hasmethod(LinearSolve.BLISLUFactorization, ())
252+
# Check if BLIS_jll and LAPACK_jll are loaded
253+
system_data["blis_jll_loaded"] = haskey(Base.loaded_modules, Base.PkgId(Base.UUID("068f7417-6964-5086-9a5b-bc0c5b4f7fa6"), "BLIS_jll"))
254+
system_data["lapack_jll_loaded"] = haskey(Base.loaded_modules, Base.PkgId(Base.UUID("51474c39-65e3-53ba-86ba-03b1b862ec14"), "LAPACK_jll"))
255+
256+
# BLIS is available if JLL packages are loaded and BLISLUFactorization exists
257+
if (system_data["blis_jll_loaded"] || system_data["lapack_jll_loaded"]) &&
258+
isdefined(LinearSolve, :BLISLUFactorization) && hasmethod(LinearSolve.BLISLUFactorization, ())
251259
system_data["blis_available"] = true
252260
# Check if BLIS is actually being used (contains "blis" in BLAS vendor)
253261
system_data["blis_used"] = contains(lowercase(string(system_data["blas_vendor"])), "blis")
254262
end
255263
catch
256-
# If there's any error checking BLIS, leave as false
264+
# If there's any error checking BLIS JLL packages, leave as false
257265
end
258266

259267
# GPU information

0 commit comments

Comments
 (0)