JuliaLinearAlgebra / BLIS.jl

This repo plans to provide a low-level Julia wrapper for BLIS typed interface.
BSD 3-Clause "New" or "Revised" License
26 stars 4 forks source link

Crash when benchmarking `BLIS.BLASInterface.axpy!` #9

Closed giordano closed 2 years ago

giordano commented 2 years ago

Simple reproducer:

julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, haswell)

(tmp) pkg> st -m BLIS blis_jll
      Status `/tmp/Manifest.toml`
  [32f2db32] BLIS v0.2.0
  [6136c539] blis_jll v0.8.1+0

julia> using BenchmarkTools, BLIS
[ Info: blis_jll yields BLIS installation: /home/mose/.julia/artifacts/3bd06aa4f9939a35f5cb53773bd177f94ec99078/lib/libblis.so.

julia> @benchmark BLIS.BLASInterface.axpy!(a, x, y) setup=(T=Float32; N=100; a=randn(T); x=randn(T, N); y=randn(T, N)) evals=1
GC error (probable corruption) :
Allocations: 21278104 (Pool: 21271094; Big: 7010); GC: 26

!!! ERROR in jl_ -- ABORTING !!!
0x7f70fc77f010: Root object: 0x7f7152ae4010 :: 0x7f7149ad2070 (bits: 3)
        of type Task
0x7f70fc77f028: Root object: 0x7f71498c1760 :: 0x7f7149859b30 (bits: 3)
        of type Module
0x7f70fc77f040: Root object: 0x7f714985a620 :: 0x7f714985a2b0 (bits: 3)
        of type Array{Any, 1}
0x7f70fc77f058: Root object: 0x7f714e0ed220 :: 0x7f714985a380 (bits: 3)
        of type UnionAll
0x7f70fc77f070: Root object: 0x7f714d451b60 :: 0x7f71498d7f50 (bits: 3)
        of type Core.TypeMapEntry
0x7f70fc77f088: Root object: 0x7f714d5bbfa0 :: 0x7f71498d7f50 (bits: 3)
        of type Core.TypeMapEntry
0x7f70fc77f0a0: Root object: 0x7f714b87b220 :: 0x7f71498d7f50 (bits: 3)
        of type Core.TypeMapEntry

# Continues a _huge_ wall of errors

Perhaps some variables shared with the library aren't rooted correctly?

xrq-phys commented 2 years ago

~Out-of-boundary access seems to occur every time when α or β is a floating point.~ Let me check...

xrq-phys commented 2 years ago

Typed backend works OK. I must have misunderstood some GC-related behaviors when interfacing BLIS objects.

@benchmark BLIS.TypedBackend.bli_saxpyv!(BLIS.Types.BLIS_NO_CONJUGATE, N, [a], x, 1, y, 1) setup=(T=Float32; N=100; a=randn(T); x=randn(T, N); y=randn(T, N)) evals=20