SciML / SciML/Optimization.jl

Real sparsity support in Enzyme backend

Open
#975 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
839
Forks
100
Avg merge
20h 43m
Merged PRs (30d)
38

Description

Is your feature request related to a problem? Please describe.

The current Enyme implementation doesn't effectively leverage sparsity

Describe the solution you’d like

Something that looks like

if f.hess_prototype === nothing
                vdθ = Tuple((similar(r) for r in eachrow(I(length(θ)) * 1.0)))
                bθ = zeros(length(θ))
                @show bθ
                @show typeof(bθ)
                vdbθ = Tuple(zeros(length(θ)) for i in eachindex(θ))
                @show vdbθ
                @show typeof(vdbθ)
            else
                θ = SparseArrays.sparse(θ)
                @show θ
                vdθ = Tuple((similar(SparseArrays.sparse(r)) for r in eachrow(I(length(θ)) * 1.0)))
                @show vdθ
                @show typeof(vdθ)
                bθ = SparseArrays.similar(θ)
                @show bθ
                @show typeof(bθ)
                vdbθ = Tuple(similar(i) for i in eachrow(f.hess_prototype))
                @show vdbθ
                @show typeof(vdbθ)
            end

will need to be done

Describe alternatives you’ve considered

Maybe an automated sparsity detection version can exist as well but given recent benchmarking it is evident that this needs a rethinking of the way we are doing it

Additional context

Primary benchmark would be the cnlbeam one that already has a working Enzyme implementation. OPF might be worth revisiting with this as well.

cc: @wmoses I guess you'd be interested

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the current Enzyme backend and its handling of Hessian prototypes, then inspect the cnlbeam benchmark mentioned in the issue; OPF is a possible secondary case. Determine how sparse inputs and derivative containers should be represented, and validate the completed design against the cnlbeam benchmark with sparsity actually leveraged.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.