Skip to content

refactor: positive priority variables are no longer "sticky" in eliminate_perfect_aliases!#4635

Merged
AayushSabharwal merged 2 commits into
masterfrom
as/perfect-aliases-positive-priority
Jun 18, 2026
Merged

refactor: positive priority variables are no longer "sticky" in eliminate_perfect_aliases!#4635
AayushSabharwal merged 2 commits into
masterfrom
as/perfect-aliases-positive-priority

Conversation

@AayushSabharwal

Copy link
Copy Markdown
Member

Following from the discussion in JuliaComputing/StateSelection.jl#103

Comment thread test/reduction.jl
@variables x(t) y(t)
@named sys = System([D(x) ~ -x, x ~ y], t; state_priorities = [x => 5, y => 5])
state = TearingState(sys)
@test_logs (:warn, r"state_priority") match_mode=:any ModelingToolkit.eliminate_perfect_aliases!(state)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Runic] reported by reviewdog 🐶

Suggested change
@test_logs (:warn, r"state_priority") match_mode=:any ModelingToolkit.eliminate_perfect_aliases!(state)
@test_logs (:warn, r"state_priority") match_mode = :any ModelingToolkit.eliminate_perfect_aliases!(state)

Comment thread test/reduction.jl
# Exactly one of the two variables is eliminated as observed.
n_elim = count(
eq -> isequal(eq.lhs, unwrap(x)) || isequal(eq.lhs, unwrap(y)),
state.additional_observed)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Runic] reported by reviewdog 🐶

Suggested change
state.additional_observed)
state.additional_observed
)

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia vlts)

Time benchmarks
master 65f04db... master / 65f04db...
ODEProblem 10.1 ± 0.75 ms 9.76 ± 0.63 ms 1.03 ± 0.1
init 0.0625 ± 0.026 ms 0.0688 ± 0.027 ms 0.908 ± 0.52
large_parameter_init/ODEProblem 27.7 ± 3.8 ms 28.5 ± 4.2 ms 0.972 ± 0.2
large_parameter_init/init 0.0895 ± 0.031 ms 0.0875 ± 0.031 ms 1.02 ± 0.51
mtkcompile 11 ± 0.74 ms 11 ± 0.45 ms 0.998 ± 0.079
sparse_analytical_jacobian/ODEProblem 29.3 ± 2.6 ms 29.6 ± 1.8 ms 0.99 ± 0.11
sparse_analytical_jacobian/f_iip 0.071 ± 0.01 μs 0.071 ± 0.01 μs 1 ± 0.2
sparse_analytical_jacobian/f_oop 0.394 ± 0.011 ms 0.394 ± 0.011 ms 0.999 ± 0.038
time_to_load 5.85 ± 0.0092 s 5.82 ± 0.09 s 1 ± 0.016
Memory benchmarks
master 65f04db... master / 65f04db...
ODEProblem 0.0437 M allocs: 2.97 MB 0.0427 M allocs: 2.9 MB 1.02
init 0.382 k allocs: 0.0642 MB 0.411 k allocs: 0.0701 MB 0.916
large_parameter_init/ODEProblem 0.252 M allocs: 9.56 MB 0.252 M allocs: 9.53 MB 1
large_parameter_init/init 0.599 k allocs: 0.172 MB 0.599 k allocs: 0.172 MB 1
mtkcompile 0.0619 M allocs: 3.52 MB 0.0618 M allocs: 3.52 MB 1
sparse_analytical_jacobian/ODEProblem 0.189 M allocs: 7.94 MB 0.189 M allocs: 7.94 MB 0.999
sparse_analytical_jacobian/f_iip 0 allocs: 0 B 0 allocs: 0 B
sparse_analytical_jacobian/f_oop 0.634 k allocs: 19.6 kB 0.634 k allocs: 19.6 kB 1
time_to_load 0.153 k allocs: 14.5 kB 0.153 k allocs: 14.5 kB 1

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
master 65f04db... master / 65f04db...
ODEProblem 11.1 ± 1.9 ms 10.3 ± 1.1 ms 1.08 ± 0.22
init 0.0733 ± 0.015 ms 0.0672 ± 0.009 ms 1.09 ± 0.26
large_parameter_init/ODEProblem 0.0354 ± 0.0057 s 27.3 ± 4.8 ms 1.29 ± 0.31
large_parameter_init/init 0.0949 ± 0.054 ms 0.0725 ± 0.043 ms 1.31 ± 1.1
mtkcompile 12.2 ± 2.4 ms 9.34 ± 0.93 ms 1.31 ± 0.29
sparse_analytical_jacobian/ODEProblem 0.0325 ± 0.004 s 24.9 ± 3.8 ms 1.31 ± 0.26
sparse_analytical_jacobian/f_iip 0.08 ± 0.01 μs 0.08 ± 0 μs 1 ± 0.12
sparse_analytical_jacobian/f_oop 0.131 ± 0.012 ms 0.127 ± 0.015 ms 1.03 ± 0.15
time_to_load 5.77 ± 0.094 s 5.71 ± 0.14 s 1.01 ± 0.03
Memory benchmarks
master 65f04db... master / 65f04db...
ODEProblem 0.0427 M allocs: 2.63 MB 0.0505 M allocs: 2.95 MB 0.891
init 0.343 k allocs: 0.0443 MB 0.348 k allocs: 0.0438 MB 1.01
large_parameter_init/ODEProblem 0.257 M allocs: 9.84 MB 0.257 M allocs: 9.95 MB 0.988
large_parameter_init/init 0.782 k allocs: 0.15 MB 0.782 k allocs: 0.15 MB 1
mtkcompile 0.0599 M allocs: 2.86 MB 0.0598 M allocs: 2.86 MB 1
sparse_analytical_jacobian/ODEProblem 0.181 M allocs: 7.02 MB 0.181 M allocs: 7.01 MB 1
sparse_analytical_jacobian/f_iip 0 allocs: 0 B 0 allocs: 0 B
sparse_analytical_jacobian/f_oop 0.848 k allocs: 27 kB 0.848 k allocs: 27 kB 1
time_to_load 0.146 k allocs: 11.4 kB 0.146 k allocs: 11.4 kB 1

AayushSabharwal and others added 2 commits June 18, 2026 15:18
…inate_perfect_aliases!`

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
@AayushSabharwal AayushSabharwal force-pushed the as/perfect-aliases-positive-priority branch from 2f3ce8f to 65f04db Compare June 18, 2026 09:48
@AayushSabharwal AayushSabharwal merged commit 9d5efb4 into master Jun 18, 2026
50 of 65 checks passed
@AayushSabharwal AayushSabharwal deleted the as/perfect-aliases-positive-priority branch June 18, 2026 11:24
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