Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Entries link to the pull request that introduced them.
## GNNlib.jl — Unreleased (towards 1.4.1)

**Fixed**
- Fixed `propagate(w_mul_xj, g, +)` ignoring the edge weights on CUDA and AMDGPU: the GPU fallback passed no weights to `w_mul_xj`, so layers using edge weights (e.g. `GCNConv` with `use_edge_weight = true`) computed unweighted messages on the GPU ([#718]).
- Fixed `Enzyme.gradient` failing when differentiating `GCNConv`, `SGConv` and `TAGConv` on `:dense`/`:sparse` adjacency graphs: their adjacency-matrix fallbacks now convert via the Enzyme-differentiable `GNNGraphs._to_coo_graph` instead of the keyword `GNNGraph` constructor. Requires GNNGraphs ≥ 1.5.2 and, for Enzyme, Enzyme ≥ 0.13.197 ([#703]).

## GraphNeuralNetworks.jl — Unreleased (towards 1.1.1)
Expand Down Expand Up @@ -245,4 +246,5 @@ Lux implementations of the graph convolutional, pooling, and temporal layers
[#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
[#718]: https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/pull/718
[FluxML/Zygote.jl#1662]: https://github.com/FluxML/Zygote.jl/issues/1662
6 changes: 4 additions & 2 deletions GNNlib/ext/GNNlibAMDGPUExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module GNNlibAMDGPUExt
using AMDGPU: AnyROCMatrix
using Random, Statistics, LinearAlgebra
using GNNlib: GNNlib, propagate, copy_xj, e_mul_xj, w_mul_xj
using GNNGraphs: GNNGraph, COO_T, SPARSE_T
using GNNGraphs: GNNGraph, COO_T, SPARSE_T, get_edge_weight

###### PROPAGATE SPECIALIZATIONS ####################

Expand All @@ -28,7 +28,9 @@ end
## avoid the fast path on gpu until we have better support
function GNNlib.propagate(::typeof(w_mul_xj), g::GNNGraph{<:Union{COO_T, SPARSE_T}}, ::typeof(+),
xi, xj::AnyROCMatrix, e::Nothing)
propagate((xi, xj, e) -> w_mul_xj(xi, xj, e), g, +, xi, xj, e)
# The weights come from the graph here, so they have to be passed on explicitly:
# `w_mul_xj` with `e = nothing` would return unweighted messages.
propagate((xi, xj, e) -> w_mul_xj(xi, xj, e), g, +, xi, xj, get_edge_weight(g))
end

end #module
6 changes: 4 additions & 2 deletions GNNlib/ext/GNNlibCUDAExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module GNNlibCUDAExt
using CUDA
using Random, Statistics, LinearAlgebra
using GNNlib: GNNlib, propagate, copy_xj, e_mul_xj, w_mul_xj
using GNNGraphs: GNNGraph, COO_T, SPARSE_T, to_dense, to_sparse, adjacency_matrix
using GNNGraphs: GNNGraph, COO_T, SPARSE_T, to_dense, to_sparse, adjacency_matrix, get_edge_weight
using ChainRulesCore: @non_differentiable

const CUDA_COO_T = Tuple{T, T, V} where {T <: AnyCuArray{<:Integer}, V <: Union{Nothing, AnyCuArray}}
Expand Down Expand Up @@ -40,7 +40,9 @@ end
## avoid the fast path on gpu until we have better cuda support
function GNNlib.propagate(::typeof(w_mul_xj), g::GNNGraph{<:COO_T}, ::typeof(+),
xi, xj::AnyCuMatrix, e::Nothing)
propagate((xi, xj, e) -> w_mul_xj(xi, xj, e), g, +, xi, xj, e)
# The weights come from the graph here, so they have to be passed on explicitly:
# `w_mul_xj` with `e = nothing` would return unweighted messages.
propagate((xi, xj, e) -> w_mul_xj(xi, xj, e), g, +, xi, xj, get_edge_weight(g))
end

# function GNNlib.propagate(::typeof(copy_xj), g::GNNGraph, ::typeof(mean), xi, xj::AbstractMatrix, e)
Expand Down
2 changes: 1 addition & 1 deletion GNNlib/test/msgpass.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ end
end
# @show get_graph_type(g) has_isolated_nodes(g)
# broken = get_graph_type(g) == :sparse
broken = true
broken = false
@test test_gradients(
f, g, g.x, w; test_gpu=true, test_grad_f=false
) broken=broken
Expand Down
Loading