Skip to content

Commit 6e5d2a0

Browse files
committed
Port Implicit External test
1 parent 84234ca commit 6e5d2a0

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/analysis/structural.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ function _structural_analysis!(ci::CodeInstance, world::UInt)
9797
push!(externally_refined, i)
9898
elseif is_equation_call(stmt, ir, #=allow_call=#false)
9999
push!(eqcallssas, SSAValue(i))
100+
else
101+
ir.stmts[i][:flag] |= Compiler.IR_FLAG_REFINED
100102
end
101103
elseif isexpr(stmt, :call)
102104
if is_known_call(stmt, Core.current_scope, ir)

test/ipo.jl

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sol = solve(DAECProblem(onecall!, (1,) .=> 1.), IDA())
1919
sol = solve(ODECProblem(onecall!, (1,) .=> 1.), Rodas5(autodiff=false))
2020
@test all(map((x,y)->isapprox(x[], y, atol=1e-2), sol[1, :], exp.(sol.t)))
2121

22-
#= + Contained Equations =#
22+
#==== Contained Equations ============#
2323
function twocall!()
2424
onecall!(); onecall!();
2525
return nothing
@@ -32,7 +32,7 @@ for (sol, i) in Iterators.product((dae_sol, ode_sol), 1:2)
3232
@test all(map((x,y)->isapprox(x[], y, atol=1e-2), sol[i, :], exp.(sol.t)))
3333
end
3434

35-
#= + NonLinear =#
35+
#============== NonLinear ============#
3636
@noinline function sin!()
3737
x = continuous()
3838
always!(ddt(x) - sin(x))
@@ -47,7 +47,7 @@ for (sol, i) in Iterators.product((dae_sol, ode_sol), 1:2)
4747
@test all(map((x,y)->isapprox(x[], y, atol=1e-2), sol[i, :], 2*acot.(exp.(-sol.t).*cot(1/2))))
4848
end
4949

50-
#= + SICM =#
50+
#============== SICM ============#
5151
struct sicm!
5252
arg::Float64
5353
end
@@ -72,7 +72,7 @@ for (sol, i) in Iterators.product((dae_sol, ode_sol), 1:2)
7272
@test all(map((x,y)->isapprox(x[], y, atol=1e-2), sol[i, :], 1. .+ sol.t))
7373
end
7474

75-
#= + NonLinear SICM =#
75+
#========== NonLinear SICM ===========#
7676
struct nlsicm!
7777
arg::Float64
7878
end
@@ -97,7 +97,7 @@ for (sol, i) in Iterators.product((dae_sol, ode_sol), 1:2)
9797
@test all(map((x,y)->isapprox(x[], y, atol=1e-2), sol[i, :], 1. .+ sin(1.)*sol.t))
9898
end
9999

100-
#= + Ping Ping =#
100+
#============== Ping Pong ============#
101101
@noinline function ping(a, b, c, d)
102102
always!(b - sin(a))
103103
always!(d - sin(c))
@@ -126,4 +126,17 @@ for sol in (dae_sol, ode_sol)
126126
@test all(map((x,y)->isapprox(x[], y, atol=1e-2), sol[1, :], 0.1exp.(sol.t)))
127127
end
128128

129+
#========== Implicit External ===========#
130+
@noinline intro() = ddt(continuous())
131+
@noinline outro!(x) = always!(x-1)
132+
133+
implicit() = outro!(intro())
134+
135+
dae_sol = solve(DAECProblem(implicit, (1,) .=> 1), IDA())
136+
ode_sol = solve(ODECProblem(implicit, (1,) .=> 1), Rodas5(autodiff=false))
137+
138+
for sol in (dae_sol, ode_sol)
139+
@test all(map((x,y)->isapprox(x[], y, atol=1e-2), sol[1, :], 1 .+ sol.t))
140+
end
141+
129142
end

0 commit comments

Comments
 (0)