Skip to content

Remaining Enzyme gradient failures in layer tests #757

Backlog

Description

@CarloLucibello

#708 adds Enzyme to the gradient tests of GraphNeuralNetworks and GNNlib (CPU, Julia ≥ 1.12). The test sites below still skip Enzyme. The reasons come from the skip comments in #708 and were last checked on Julia 1.13.3 with Enzyme 0.13.216–0.13.218, before #756.

Type instabilities in our code

Fixing these should re-enable the corresponding tests.

  • to_dense(A::ADJMAT_T) (convert.jl) reassigns A to an adjoint, a converted copy or a binarized copy, so its return type is a Union. On dense graphs propagate(copy_xj, g, +) multiplies by adjacency_matrix(g, T; weighted = false), and Enzyme throws IllegalTypeAnalysisException. Skipped on :dense graphs: GraphConv, GatedGraphConv, SAGEConv, GNNChain, and GNNlib's propagate(copy_xj, +).
  • degree(g, T; edge_weight::Bool): _get_edge_weight returns nothing or a vector depending on the runtime Bool. That Union flows through the k-hop loops of sg_conv and tag_conv (IllegalTypeAnalysisException). Skipped: SGConv on all graph types, TAGConv on COO and dense (Enzyme copes on sparse).
  • Keyword GNNGraph constructor (gnngraph.jl): its locals take different types across the graph_type branches. d_conv builds the transposed graph with it inside ignore_derivatives, which Enzyme does not treat as inactive (IllegalTypeAnalysisException). Skipped: DCGRUCell, DCGRU. DConv is also Zygote-only, without a comment; its forward pass is the same d_conv, so the cause is likely the same.

Enzyme bugs (no upstream issue linked yet)

  • TGCNCell, TGCN: compiling the gradient hangs (25+ min with no output).
  • GConvLSTMCell, GConvLSTM, GConvGRUCell, GConvGRU: LLVM error: Referring to an instruction in another function! while linking the derivative, since Julia 1.13.3.

Expected behavior

Not covered

  • GPU tests (test_gpu = true) don't run Enzyme.
  • GNNLux skips Enzyme in all its gradient tests (skip_backends).

See also #389.

🧔‍♂️🤖 Assisted by Claude Sonnet 5.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions