diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ae90818b..19081e2a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Entries link to the pull request that introduced them. - Added a `Mooncake` package extension, so that Mooncake can differentiate on CUDA through `add_self_loops` and through adjacency-matrix graphs. Float edge weights of adjacency-matrix graphs stay differentiable ([#704]). **Fixed** +- Fixed `scaled_laplacian` (and so `ChebConv`) crashing with a segmentation fault on AMDGPU graphs: the eigensolver's start vector was created on the CPU, so CPU BLAS was handed GPU memory. It is now created on the same device as the graph ([#722]). - Added an `EnzymeCore` package extension marking `scaled_laplacian` inactive for Enzyme, matching its existing `@non_differentiable` ChainRules declaration. Enzyme previously differentiated the Krylov eigensolve inside it and failed; this unblocks `ChebConv`, `GConvGRUCell` and `GConvLSTMCell` ([#706]). - Enzyme can now differentiate through the adjacency-matrix → COO graph conversion: a new internal keyword-free helper `_to_coo_graph` avoids the union-typed keyword handling of the `GNNGraph(g; graph_type)` constructor and of `to_coo`, which Enzyme's type analysis cannot compile. Together with upstream fixes in Enzyme ≥ 0.13.197 this removes the `EnzymeInternalError` crash on `:dense`/`:sparse` graphs ([#703]). @@ -238,4 +239,5 @@ Lux implementations of the graph convolutional, pooling, and temporal layers [#704]: https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/pull/704 [#707]: https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/pull/707 [#706]: https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/pull/706 +[#722]: https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/pull/722 [FluxML/Zygote.jl#1662]: https://github.com/FluxML/Zygote.jl/issues/1662 diff --git a/GNNGraphs/src/query.jl b/GNNGraphs/src/query.jl index 2c2f4332a..aaad2d634 100644 --- a/GNNGraphs/src/query.jl +++ b/GNNGraphs/src/query.jl @@ -508,7 +508,10 @@ function _eigmax(A) KrylovKit.eigsolve(Symmetric(A), x0, 1, :LR)[1][1] # also eigs(A, x0, nev, mode) available end -_rand_dense_vector(A::AbstractMatrix{T}) where {T} = randn(float(T), size(A, 1)) +# On the same device as `A`, otherwise a GPU `A` would be passed to CPU BLAS. +_rand_dense_vector(A::AbstractMatrix{T}) where {T} = randn!(similar(A, float(T), size(A, 1))) +# `similar` would give a sparse vector here. +_rand_dense_vector(A::AbstractSparseMatrix{T}) where {T} = randn(float(T), size(A, 1)) # Eigenvalues for cuarray don't seem to be well supported. # https://github.com/JuliaGPU/CUDA.jl/issues/154