Skip to content

Conversation

@penelopeysm
Copy link
Member

All of these functions were used to identify which part of a flattened parameter vector belonged to a particular VarName. In a happy coincidence, it turned out that I reinvented this wheel as part of FastLDF, so we can now get rid of these and just directly check the LDF's internal fields (not ideal, but it's contained within DPPL so not too bad, and I'm not keen to expose a public interface to this NT + Dict hydra).

@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2025

Benchmark Report

  • this PR's head: e0cdf631864d95eee8709dd5dd033535627cd96a
  • base branch: 5962903c27b58879b6f861cbcc2b1790a641d2ad

Computer Information

Julia Version 1.11.7
Commit f2b3dbda30a (2025-09-08 12:10 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × AMD EPYC 7763 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

Benchmark Results

┌───────────────────────┬───────┬─────────────┬───────────────────┬────────┬────────────────────────────────┬────────────────────────────┬─────────────────────────────────┐
│                       │       │             │                   │        │        t(eval) / t(ref)        │     t(grad) / t(eval)      │        t(grad) / t(ref)         │
│                       │       │             │                   │        │ ─────────┬───────────┬──────── │ ───────┬─────────┬──────── │ ──────────┬───────────┬──────── │
│                 Model │   Dim │  AD Backend │           VarInfo │ Linked │     base │   this PR │ speedup │   base │ this PR │ speedup │      base │   this PR │ speedup │
├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼───────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤
│               Dynamic │    10 │    mooncake │             typed │   true │   339.53 │    393.45 │    0.86 │  11.32 │    9.21 │    1.23 │   3843.77 │   3622.50 │    1.06 │
│                   LDA │    12 │ reversediff │             typed │   true │  2428.99 │   2643.22 │    0.92 │   5.09 │    4.95 │    1.03 │  12366.76 │  13090.53 │    0.94 │
│   Loop univariate 10k │ 10000 │    mooncake │             typed │   true │ 97155.58 │ 105054.39 │    0.92 │   3.83 │    3.90 │    0.98 │ 371698.07 │ 409458.16 │    0.91 │
├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼───────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤
│    Loop univariate 1k │  1000 │    mooncake │             typed │   true │  7168.15 │   8110.99 │    0.88 │   4.87 │    4.67 │    1.04 │  34943.90 │  37846.66 │    0.92 │
│      Multivariate 10k │ 10000 │    mooncake │             typed │   true │ 30642.91 │  32172.73 │    0.95 │   9.93 │   10.18 │    0.98 │ 304405.60 │ 327610.99 │    0.93 │
│       Multivariate 1k │  1000 │    mooncake │             typed │   true │  3349.07 │   3580.07 │    0.94 │   9.30 │    9.25 │    1.01 │  31143.60 │  33118.15 │    0.94 │
├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼───────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤
│ Simple assume observe │     1 │ forwarddiff │             typed │  false │     2.55 │      2.72 │    0.94 │   3.88 │    3.99 │    0.97 │      9.89 │     10.86 │    0.91 │
│           Smorgasbord │   201 │ forwarddiff │             typed │  false │  1114.38 │   1208.02 │    0.92 │ 123.48 │  127.29 │    0.97 │ 137602.48 │ 153771.54 │    0.89 │
│           Smorgasbord │   201 │ forwarddiff │       simple_dict │   true │      err │       err │     err │    err │     err │     err │       err │       err │     err │
├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼───────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤
│           Smorgasbord │   201 │ forwarddiff │ simple_namedtuple │   true │      err │       err │     err │    err │     err │     err │       err │       err │     err │
│           Smorgasbord │   201 │      enzyme │             typed │   true │  1558.73 │   1676.66 │    0.93 │   6.92 │    5.80 │    1.19 │  10780.45 │   9726.13 │    1.11 │
│           Smorgasbord │   201 │    mooncake │             typed │   true │  1997.83 │   1696.38 │    1.18 │   4.11 │    5.37 │    0.76 │   8202.58 │   9108.97 │    0.90 │
├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼───────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤
│           Smorgasbord │   201 │ reversediff │             typed │   true │  1696.20 │   1670.30 │    1.02 │  81.49 │   89.84 │    0.91 │ 138229.66 │ 150067.01 │    0.92 │
│           Smorgasbord │   201 │ forwarddiff │      typed_vector │   true │  1549.35 │   1673.52 │    0.93 │  58.27 │   54.39 │    1.07 │  90276.01 │  91023.23 │    0.99 │
│           Smorgasbord │   201 │ forwarddiff │           untyped │   true │  1542.13 │   1663.30 │    0.93 │  60.67 │   59.97 │    1.01 │  93567.18 │  99744.93 │    0.94 │
├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼───────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤
│           Smorgasbord │   201 │ forwarddiff │    untyped_vector │   true │  1545.01 │   1671.95 │    0.92 │  59.69 │   58.38 │    1.02 │  92219.62 │  97607.78 │    0.94 │
│              Submodel │     1 │    mooncake │             typed │   true │     6.96 │      7.10 │    0.98 │   5.00 │    5.25 │    0.95 │     34.79 │     37.31 │    0.93 │
└───────────────────────┴───────┴─────────────┴───────────────────┴────────┴──────────┴───────────┴─────────┴────────┴─────────┴─────────┴───────────┴───────────┴─────────┘

@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.95%. Comparing base (5962903) to head (e0cdf63).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ext/DynamicPPLMarginalLogDensitiesExt.jl 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1175       +/-   ##
===========================================
+ Coverage   35.34%   78.95%   +43.60%     
===========================================
  Files          41       41               
  Lines        3907     3896       -11     
===========================================
+ Hits         1381     3076     +1695     
+ Misses       2526      820     -1706     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@penelopeysm penelopeysm requested a review from mhauru December 12, 2025 15:40
Copy link
Member

@mhauru mhauru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good if tests pass

@penelopeysm penelopeysm merged commit 6266f64 into main Dec 12, 2025
22 checks passed
@penelopeysm penelopeysm deleted the py/no-vector-getranges branch December 12, 2025 15:52
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.

3 participants