-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
bugSomething isn't workingSomething isn't workingexternal dependenciesInvolves LLVM, OpenBLAS, or other linked librariesInvolves LLVM, OpenBLAS, or other linked libraries
Description
This was discovered during CUDA testing JuliaGPU/CUDA.jl#2810 (comment). It seems to produce incorrect results for ComplexF32
on AMD 9950X and also on 7950X.
MWE:
using InteractiveUtils
versioninfo()
using Pkg
Pkg.activate(@__DIR__)
Pkg.add(["Random", "LinearAlgebra"])
using LinearAlgebra, Random, Test
@testset "BLAS test" begin
Random.seed!(1234)
A = rand(ComplexF32, 10)
sum1 = BLAS.asum(A)
sum2 = sum(z -> abs(real(z)) + abs(imag(z)), A)
@show A, sum1, sum2
@test sum1 == sum2
end
My output on 1.10:
>julia +1.10 asum_bug.jl
Julia Version 1.10.10
Commit 95f30e51f4 (2025-06-27 09:51 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 32 × AMD Ryzen 9 9950X 16-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, generic)
Threads: 32 default, 0 interactive, 16 GC (on 32 virtual cores)
Environment:
JULIA_CONDAPKG_BACKEND = Null
JULIA_DEPOT_PATH = K:\.julia
JULIA_NUM_THREADS = auto
JULIA_PYTHONCALL_EXE = K:\Miniconda3\envs\py310\python.exe
Activating new project at `K:\DevDocuments\BLAS_bug`
Resolving package versions...
Updating `K:\DevDocuments\BLAS_bug\Project.toml`
[37e2e46d] + LinearAlgebra
[9a3f8284] + Random
Updating `K:\DevDocuments\BLAS_bug\Manifest.toml`
[56f22d72] + Artifacts
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[9a3f8284] + Random
[ea8e919c] + SHA v0.7.0
[e66e0078] + CompilerSupportLibraries_jll v1.1.1+0
[4536629a] + OpenBLAS_jll v0.3.23+4
[8e850b90] + libblastrampoline_jll v5.11.0+0
(A, sum1, sum2) = (ComplexF32[0.32597667f0 + 0.5490511f0im, 0.21858662f0 + 0.8942454f0im, 0.35311162f0 + 0.39425534f0im, 0.9531246f0 + 0.7955469f0im, 0.49424982f0 + 0.748415f0im, 0.57823193f0 + 0.72793496f0im, 0.007447958f0 + 0.19937658f0im, 0.43924308f0 + 0.6825326f0im, 0.9567409f0 + 0.6478553f0im, 0.99666524f0 + 0.749194f0im], 10.34919f0, 11.711785f0)
BLAS test: Test Failed at K:\DevDocuments\BLAS_bug\asum_bug.jl:18
Expression: sum1 ≈ sum2
Evaluated: 10.34919f0 ≈ 11.711785f0
The issues seems to be in OpenBLAS_jll v0.3.23. There's no issue using Julia 1.11 OpenBLAS_jll v0.3.27.
>julia +1.11 asum_bug.jl
Julia Version 1.11.6
Commit 9615af0f26 (2025-07-09 12:58 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 32 × AMD Ryzen 9 9950X 16-Core Processor
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, generic)
Threads: 32 default, 0 interactive, 16 GC (on 32 virtual cores)
Environment:
JULIA_CONDAPKG_BACKEND = Null
JULIA_DEPOT_PATH = K:\.julia
JULIA_NUM_THREADS = auto
JULIA_PYTHONCALL_EXE = K:\Miniconda3\envs\py310\python.exe
Activating project at `K:\DevDocuments\BLAS_bug`
Resolving package versions...
Updating `K:\DevDocuments\BLAS_bug\Project.toml`
[37e2e46d] ~ LinearAlgebra ⇒ v1.11.0
[9a3f8284] ~ Random ⇒ v1.11.0
Updating `K:\DevDocuments\BLAS_bug\Manifest.toml`
[56f22d72] ~ Artifacts ⇒ v1.11.0
[8f399da3] ~ Libdl ⇒ v1.11.0
[37e2e46d] ~ LinearAlgebra ⇒ v1.11.0
[9a3f8284] ~ Random ⇒ v1.11.0
[4536629a] ↑ OpenBLAS_jll v0.3.23+4 ⇒ v0.3.27+1
(A, sum1, sum2) = (ComplexF32[0.32597667f0 + 0.5490511f0im, 0.21858662f0 + 0.8942454f0im, 0.35311162f0 + 0.39425534f0im, 0.9531246f0 + 0.7955469f0im, 0.49424982f0 + 0.748415f0im, 0.57823193f0 + 0.72793496f0im, 0.007447958f0 + 0.19937658f0im, 0.43924308f0 + 0.6825326f0im, 0.9567409f0 + 0.6478553f0im, 0.99666524f0 + 0.749194f0im], 11.711786f0, 11.711785f0)
Test Summary: | Pass Total Time
BLAS test | 1 1 0.2s
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingexternal dependenciesInvolves LLVM, OpenBLAS, or other linked librariesInvolves LLVM, OpenBLAS, or other linked libraries