JuliaDiff / JuliaDiff/ForwardDiff.jl

Bad compilation time with static arrays and intervals

Open
#504 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
1k
Forks
160
PR merge metrics
No merged PRs in 30d

Description

The following should be a simple calculation, but uses 2GB (!) in the compilation process...:

julia> using ForwardDiff, StaticArrays, IntervalArithmetic

julia> f(x) = 2 .* x .* x
f (generic function with 1 method)

julia> X = @SVector [0..1 for i in 1:6];

julia> @time ForwardDiff.jacobian(f, X)
 11.818110 seconds (67.27 M allocations: 2.401 GiB, 13.76% gc time, 100.00% compilation time)
6×6 SMatrix{6, 6, Interval{Float64}, 36} with indices SOneTo(6)×SOneTo(6):
 [0, 4]  [0, 0]  [0, 0]  [0, 0]  [0, 0]  [0, 0]
 [0, 0]  [0, 4]  [0, 0]  [0, 0]  [0, 0]  [0, 0]
 [0, 0]  [0, 0]  [0, 4]  [0, 0]  [0, 0]  [0, 0]
 [0, 0]  [0, 0]  [0, 0]  [0, 4]  [0, 0]  [0, 0]
 [0, 0]  [0, 0]  [0, 0]  [0, 0]  [0, 4]  [0, 0]
 [0, 0]  [0, 0]  [0, 0]  [0, 0]  [0, 0]  [0, 4]

Contributor guide

No contributing guide indexed for this repository

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 running the Julia reproduction with ForwardDiff, StaticArrays, and IntervalArithmetic, and measure compilation time and allocations. Trace the jacobian call and its compilation path to identify the source of the excessive work; done means substantially lower compilation cost while preserving the shown 6×6 interval result.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.