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

batched_mul broken on Julia nightly #563

Closed
mcabbott opened this issue Feb 3, 2024 · 2 comments · Fixed by #564
Closed

batched_mul broken on Julia nightly #563

mcabbott opened this issue Feb 3, 2024 · 2 comments · Fixed by #564
Labels

Comments

@mcabbott
Copy link
Member

mcabbott commented Feb 3, 2024

This works fine on Julia 1.10, but fails on 1.11:

julia> using NNlib

julia> batched_mul(rand(Float32, 2,2,2), rand(Float32, 2,2,2))
ERROR: conversion to pointer not defined for Array{Float32, 3}
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] unsafe_convert(::Type{Ptr{Float32}}, a::Array{Float32, 3})
    @ Base ./pointer.jl:67
  [3] batched_gemm!
    @ ~/.julia/packages/NNlib/MS1Kl/src/gemm.jl:83 [inlined]
  [4] _batched_gemm!(::Type{…}, transA::Char, transB::Char, α::Float32, A::Array{…}, B::Array{…}, β::Float32, C::Array{…})
    @ NNlib ~/.julia/packages/NNlib/MS1Kl/src/batched/batchedmul.jl:262
  [5] _batched_try_gemm!(::Type{…}, C::Array{…}, A::Array{…}, B::Array{…}, α::Float32, β::Float32)
...
 [10] batched_mul(A::Array{Float32, 3}, B::Array{Float32, 3})
    @ NNlib ~/.julia/packages/NNlib/MS1Kl/src/batched/batchedmul.jl:59
 [11] top-level scope
    @ REPL[95]:1
Some type information was truncated. Use `show(err)` to see complete types.

julia> VERSION
v"1.11.0-DEV.1344"

julia> Base.unsafe_convert(::Type{Ptr{Float32}}, a::Array{Float32, 3}) = pointer(a)  # quick hack

julia> batched_mul(rand(Float32, 2,2,2), rand(Float32, 2,2,2))
2×2×2 Array{Float32, 3}:
[:, :, 1] =
 0.242345  0.519529
 0.169381  0.388915

[:, :, 2] =
 0.646874  0.312372
 0.688869  0.320908
@mcabbott mcabbott added the bug label Feb 3, 2024
@ToucheSir
Copy link
Member

Same story for the gemm! routines used in conv_im2col! and more. Is there a more stable way for us to interact with BLAS for these sorts of operations?

@mcabbott
Copy link
Member Author

mcabbott commented Feb 5, 2024

I think it's some change in Base about how you are supposed to get a pointer. Or maybe what everyone was doing was never the official way.

Edit: I think JuliaLang/julia#51962 is the issue about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants