-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Labels
good first issueGood for newcomersGood for newcomers
Description
First time we trace over some code using our own custom AbstractInterpreter takes quite a while:
julia> a = ConcreteRArray(rand(2,2))
2×2 ConcreteRArray{Float64, 2}:
0.33461 0.195871
0.313405 0.31539
julia> b = ConcreteRArray(rand(2,2))
2×2 ConcreteRArray{Float64, 2}:
0.89772 0.752033
0.727069 0.470682
julia> @time @compile sum(a)
46.769205 seconds (111.81 M allocations: 5.620 GiB, 2.84% gc time, 99.71% compilation time: <1% of which was recompilation)
Reactant.Compiler.Thunk{Symbol("##sum_reactant#478143")}()
julia> @time @compile sum(a)
0.020059 seconds (3.32 k allocations: 154.555 KiB, 27.77% compilation time)
Reactant.Compiler.Thunk{Symbol("##sum_reactant#478157")}()
julia> @time @compile +(a,b)
1.088363 seconds (2.17 M allocations: 111.751 MiB, 0.85% gc time, 98.53% compilation time: 3% of which was recompilation)
Reactant.Compiler.Thunk{Symbol("##+_reactant#481975")}()
julia> @time @compile +(a,b)
0.029532 seconds (22.80 k allocations: 1.119 MiB, 60.21% compilation time)
Reactant.Compiler.Thunk{Symbol("##+_reactant#482083")}()and it doesn't matter on the function
julia> a = ConcreteRArray(rand(2,2))
2×2 ConcreteRArray{Float64, 2}:
0.185656 0.967931
0.996481 0.958333
julia> b = ConcreteRArray(rand(2,2))
2×2 ConcreteRArray{Float64, 2}:
0.47433 0.504905
0.236917 0.134567
julia> @time @compile +(a,b)
47.000538 seconds (109.53 M allocations: 5.509 GiB, 2.76% gc time, 99.96% compilation time: <1% of which was recompilation)
Reactant.Compiler.Thunk{Symbol("##+_reactant#470709")}()
julia> @time @compile +(a,b)
0.028493 seconds (22.81 k allocations: 1.119 MiB, 61.25% compilation time)
Reactant.Compiler.Thunk{Symbol("##+_reactant#470817")}()
julia> @time @compile sum(a)
1.933345 seconds (4.98 M allocations: 252.630 MiB, 7.10% gc time, 99.37% compilation time: 4% of which was recompilation)
Reactant.Compiler.Thunk{Symbol("##sum_reactant#482179")}()
julia> @time @compile sum(a)
0.017443 seconds (3.26 k allocations: 152.430 KiB, 29.82% compilation time)
Reactant.Compiler.Thunk{Symbol("##sum_reactant#482193")}()I think this could be solved with some precompile workload like Enzyme does
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers