Skip to content

tangents: note when friendly-cache recursion overflows - #1470

Merged
yebai merged 1 commit into
mainfrom
immcomment
Nov 16, 2026
Merged

yebai merged 1 commit into
mainfrom
immcomment

Conversation

@yebai

@yebai yebai commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

The comment on the immutable-struct branch of friendly_tangent_cache no longer said when its recursion can fail. The branch recurses on runtime field values, so it overflows on very deep nesting or on a cycle. An immutable value cannot contain itself, so a cycle must pass through a mutable object: an immutable W(a::Float64, r::Ref{Any}) whose r[] holds itself overflows. The comment now says so.

CI Summary — GitHub Actions

Documentation Preview

Mooncake.jl documentation for PR #1470 is available at:
https://chalk-lab.github.io/Mooncake.jl/previews/PR1470/

Performance

Performance Ratio:
Ratio of time to compute gradient and time to compute function.
Warning: results are very approximate! See here for more context.

┌────────────────────────────┬──────────┬──────────┬─────────────┬─────────┬─────────────┬─────────┐
│                      Label │   Primal │ Mooncake │ MooncakeFwd │  Zygote │ ReverseDiff │  Enzyme │
│                     String │   String │   String │      String │  String │      String │  String │
├────────────────────────────┼──────────┼──────────┼─────────────┼─────────┼─────────────┼─────────┤
│                   sum_1000 │ 358.0 ns │     1.63 │        1.79 │     1.4 │        5.09 │ missing │
│                  _sum_1000 │  1.18 μs │     10.0 │        1.15 │   106.0 │        67.5 │ missing │
│               sum_sin_1000 │  4.77 μs │     6.18 │        5.48 │    3.54 │        26.9 │ missing │
│              _sum_sin_1000 │  4.75 μs │     4.62 │         2.4 │    31.3 │        26.5 │ missing │
│                   kron_sum │ 394.0 μs │     3.66 │        2.55 │    5.16 │       222.0 │ missing │
│              kron_view_sum │ 385.0 μs │     3.99 │         3.8 │    9.86 │       237.0 │ missing │
│      naive_map_sin_cos_exp │  2.91 μs │     2.72 │        1.28 │ missing │        15.0 │ missing │
│            map_sin_cos_exp │  2.66 μs │     4.34 │        2.51 │    1.67 │        13.8 │ missing │
│      broadcast_sin_cos_exp │  3.02 μs │     3.29 │        1.99 │    10.2 │        1.95 │ missing │
│                 simple_mlp │ 250.0 μs │     5.16 │        2.38 │    1.68 │        11.4 │ missing │
│                     gp_lml │ 273.0 μs │     5.77 │        2.42 │    8.85 │     missing │ missing │
│ turing_broadcast_benchmark │  2.21 ms │     5.43 │        2.74 │ missing │        26.6 │ missing │
│         large_single_block │ 512.0 ns │     7.09 │        2.09 │  2460.0 │        77.5 │ missing │
└────────────────────────────┴──────────┴──────────┴─────────────┴─────────┴─────────────┴─────────┘

Assisted-by: Claude Code <noreply@anthropic.com>
@yebai
yebai merged commit b9f20a7 into main Nov 16, 2026
96 of 97 checks passed
@yebai
yebai deleted the immcomment branch November 16, 2026 16:45
@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant