Skip to content

Don't deepcopy accs#948

Closed
penelopeysm wants to merge 1 commit into
breakingfrom
py/no-deepcopy-accs
Closed

Don't deepcopy accs#948
penelopeysm wants to merge 1 commit into
breakingfrom
py/no-deepcopy-accs

Conversation

@penelopeysm

@penelopeysm penelopeysm commented Jun 2, 2025

Copy link
Copy Markdown
Collaborator

So just judging by the fact that CI passes*, it seems that nothing really breaks if we just use vi.accs rather than deepcopy(vi.accs); but that's probably because all our default accumulators satisfy isbitstype, and I'm not so sure what happens once we have an accumulator that isn't a bits type.

* except for Julia 1.12 which fails because of a change in error message

@penelopeysm penelopeysm marked this pull request as draft June 2, 2025 23:18
@github-actions

github-actions Bot commented Jun 2, 2025

Copy link
Copy Markdown
Contributor

Benchmark Report for Commit fc37801

Computer Information

Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 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

|                 Model | Dimension |  AD Backend |      VarInfo Type | Linked | Eval Time / Ref Time | AD Time / Eval Time |
|-----------------------|-----------|-------------|-------------------|--------|----------------------|---------------------|
| Simple assume observe |         1 | forwarddiff |             typed |  false |                  8.4 |                 1.5 |
|           Smorgasbord |       201 | forwarddiff |             typed |  false |                654.0 |                40.3 |
|           Smorgasbord |       201 | forwarddiff | simple_namedtuple |   true |                413.2 |                51.7 |
|           Smorgasbord |       201 | forwarddiff |           untyped |   true |               1100.1 |                31.5 |
|           Smorgasbord |       201 | forwarddiff |       simple_dict |   true |               7348.5 |                26.0 |
|           Smorgasbord |       201 | reversediff |             typed |   true |               1476.1 |                27.1 |
|           Smorgasbord |       201 |    mooncake |             typed |   true |                994.8 |                 4.3 |
|    Loop univariate 1k |      1000 |    mooncake |             typed |   true |               5881.8 |                 3.8 |
|       Multivariate 1k |      1000 |    mooncake |             typed |   true |                979.9 |                 9.0 |
|   Loop univariate 10k |     10000 |    mooncake |             typed |   true |              66269.0 |                 3.5 |
|      Multivariate 10k |     10000 |    mooncake |             typed |   true |               8796.2 |                 9.6 |
|               Dynamic |        10 |    mooncake |             typed |   true |                129.4 |                12.3 |
|              Submodel |         1 |    mooncake |             typed |   true |                 12.9 |                 6.1 |
|                   LDA |        12 | reversediff |             typed |   true |               1136.3 |                 1.8 |

@codecov

codecov Bot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 82.46%. Comparing base (80db9e2) to head (fc37801).

Files with missing lines Patch % Lines
src/logdensityfunction.jl 0.00% 1 Missing ⚠️
src/varinfo.jl 87.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           breaking     #948      +/-   ##
============================================
- Coverage     82.49%   82.46%   -0.03%     
============================================
  Files            38       38              
  Lines          4078     4078              
============================================
- Hits           3364     3363       -1     
- Misses          714      715       +1     

☔ 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.

@mhauru

mhauru commented Jun 3, 2025

Copy link
Copy Markdown
Member

I implemented something very similar in #940: A proper copy instead of deepcopy. (VariableOrderAccumulator is mutable.)

@penelopeysm penelopeysm deleted the py/no-deepcopy-accs branch January 26, 2026 00:01
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.

2 participants