@@ -56,7 +56,7 @@ or `nothing` to obtain them in the order they were inferred (depth-first order).
56
56
57
57
We'll use [`SnoopCompile.flatten_demo`](@ref), which runs `@snoopi_deep` on a workload designed to yield reproducible results:
58
58
59
- ```jldoctest flatten; setup=:(using SnoopCompile), filter=r"([0-9\\ .e-]+ /[0-9\\ .e-]+ |WARNING: replacing module FlattenDemo\\ .\\ n)"
59
+ ```jldoctest flatten; setup=:(using SnoopCompile), filter=r"([0-9]* \\ .?[0-9]+([eE][-+]?[0-9]+)? /[0-9]* \\ .?[0-9]+([eE][-+]?[0-9]+)? |WARNING: replacing module FlattenDemo\\ .\\ n)"
60
60
julia> tinf = SnoopCompile.flatten_demo()
61
61
InferenceTimingNode: 0.002148974/0.002767166 on InferenceFrameInfo for Core.Compiler.Timings.ROOT() with 1 direct children
62
62
@@ -75,7 +75,7 @@ Note the printing of `getproperty(::SnoopCompile.FlattenDemo.MyType{$Int}, x::Sy
75
75
that `getproperty` was inferred with. This reflects constant-propagation in inference.
76
76
77
77
Then:
78
- ```jldoctest flatten; setup=:(using SnoopCompile), filter=r"[0-9\\ .e-]+ /[0-9\\ .e-]+ "
78
+ ```jldoctest flatten; setup=:(using SnoopCompile), filter=r"[0-9]* \\ .?[0-9]+([eE][-+]?[0-9]+)? /[0-9]* \\ .?[0-9]+([eE][-+]?[0-9]+)? "
79
79
julia> flatten(tinf; sortby=nothing)
80
80
8-element Vector{SnoopCompileCore.InferenceTiming}:
81
81
InferenceTiming: 0.002423543/0.0030352639999999998 on InferenceFrameInfo for Core.Compiler.Timings.ROOT()
@@ -142,12 +142,12 @@ that it is being inferred for many specializations (which might include speciali
142
142
143
143
We'll use [`SnoopCompile.flatten_demo`](@ref), which runs `@snoopi_deep` on a workload designed to yield reproducible results:
144
144
145
- ```jldoctest accum1; setup=:(using SnoopCompile), filter=r"([0-9\\ .e-]+ |at .*/deep_demos.jl:\\ d+|WARNING: replacing module FlattenDemo\\ .\\ n)"
145
+ ```jldoctest accum1; setup=:(using SnoopCompile), filter=r"([0-9]* \\ .?[0-9]+([eE][-+]?[0-9]+)? |at .*/deep_demos.jl: \\ d+|at Base \\ .jl: \\ d+|at compiler/typeinfer \\ .jl:\\ d+|WARNING: replacing module FlattenDemo\\ .\\ n)"
146
146
julia> tinf = SnoopCompile.flatten_demo()
147
147
InferenceTimingNode: 0.002148974/0.002767166 on InferenceFrameInfo for Core.Compiler.Timings.ROOT() with 1 direct children
148
148
149
149
julia> accumulate_by_source(flatten(tinf))
150
- 7-element Vector{Tuple{Float64, Method}}:
150
+ 7-element Vector{Tuple{Float64, Union{ Method, Core.MethodInstance} }}:
151
151
(6.0012999999999996e-5, getproperty(x, f::Symbol) in Base at Base.jl:33)
152
152
(6.7714e-5, extract(y::SnoopCompile.FlattenDemo.MyType) in SnoopCompile.FlattenDemo at /pathto/SnoopCompile/src/deep_demos.jl:35)
153
153
(9.421e-5, dostuff(y) in SnoopCompile.FlattenDemo at /pathto/SnoopCompile/src/deep_demos.jl:44)
@@ -354,7 +354,7 @@ See also: [`SnoopCompile.write`](@ref).
354
354
355
355
We'll use [`SnoopCompile.itrigs_demo`](@ref), which runs `@snoopi_deep` on a workload designed to yield reproducible results:
356
356
357
- ```jldoctest parceltree; setup=:(using SnoopCompile), filter=r"([0-9\\ .e-]+ |WARNING: replacing module ItrigDemo\\ .\\ n|UInt8|Float64)"
357
+ ```jldoctest parceltree; setup=:(using SnoopCompile), filter=r"([0-9]* \\ .?[0-9]+([eE][-+]?[0-9]+)? |WARNING: replacing module ItrigDemo\\ .\\ n|UInt8|Float64|SnoopCompile \\ .ItrigDemo \\ . )"
358
358
julia> tinf = SnoopCompile.itrigs_demo()
359
359
InferenceTimingNode: 0.004490576/0.004711168 on InferenceFrameInfo for Core.Compiler.Timings.ROOT() with 2 direct children
360
360
@@ -700,7 +700,7 @@ All the entries in `itrigs` are previously uninferred, or are freshly-inferred f
700
700
701
701
We'll use [`SnoopCompile.itrigs_demo`](@ref), which runs `@snoopi_deep` on a workload designed to yield reproducible results:
702
702
703
- ```jldoctest triggers; setup=:(using SnoopCompile), filter=r"([0-9\\ .e-]+ |.*/deep_demos\\ .jl:\\ d+|WARNING: replacing module ItrigDemo\\ .\\ n)"
703
+ ```jldoctest triggers; setup=:(using SnoopCompile), filter=r"([0-9]* \\ .?[0-9]+([eE][-+]?[0-9]+)? |.*/deep_demos\\ .jl:\\ d+|WARNING: replacing module ItrigDemo\\ .\\ n)"
704
704
julia> tinf = SnoopCompile.itrigs_demo()
705
705
InferenceTimingNode: 0.004490576/0.004711168 on InferenceFrameInfo for Core.Compiler.Timings.ROOT() with 2 direct children
706
706
@@ -939,6 +939,14 @@ function findparent(node::TriggerNode, bt)
939
939
return findparent (node. parent, bt)
940
940
end
941
941
942
+ """
943
+ root = trigger_tree(itrigs)
944
+
945
+ Organize inference triggers `itrigs` in tree format, grouping items via the call tree.
946
+
947
+ It is a tree rather than a more general graph due to the fact that caching inference results means that each node gets
948
+ visited only once.
949
+ """
942
950
function trigger_tree (itrigs:: AbstractVector{InferenceTrigger} )
943
951
root = node = TriggerNode ()
944
952
for itrig in itrigs
@@ -1668,7 +1676,7 @@ each method will cause the number of specializations to be included in the frame
1668
1676
1669
1677
We'll use [`SnoopCompile.flatten_demo`](@ref), which runs `@snoopi_deep` on a workload designed to yield reproducible results:
1670
1678
1671
- ```jldoctest flamegraph; setup=:(using SnoopCompile), filter=r"([0-9\\ .e-]+ /[0-9\\ .e-]+ |at.*typeinfer\\ .jl:\\ d+|0:\\ d+|WARNING: replacing module FlattenDemo\\ .\\ n)"
1679
+ ```jldoctest flamegraph; setup=:(using SnoopCompile), filter=r"([0-9]* \\ .?[0-9]+([eE][-+]?[0-9]+)? /[0-9]* \\ .?[0-9]+([eE][-+]?[0-9]+)? |at.*typeinfer\\ .jl:\\ d+|0:\\ d+|WARNING: replacing module FlattenDemo\\ .\\ n)"
1672
1680
julia> tinf = SnoopCompile.flatten_demo()
1673
1681
InferenceTimingNode: 0.002148974/0.002767166 on InferenceFrameInfo for Core.Compiler.Timings.ROOT() with 1 direct children
1674
1682
0 commit comments