[internals] add time metrics for every CodeInstance#57074
[internals] add time metrics for every CodeInstance#57074IanButterworth merged 1 commit intomasterfrom
Conversation
|
Are float32s too awful to use here? I really would like to avoid depending on Float16 to work in C correctly (The ABI horrors it caused have scarred me). Maybe we do fixed point or something. |
|
Fixed point won't work (insufficient range), though exponential would (at a significant loss of accuracy compared to Float16). I avoided using any of the Float16 in C, just calling our emulation functions directly using the uint16_t ABI to avoid any issues. All math is explicitly done using Float64 or double, so here we are just using it as a storage format (as IEEE intended). |
|
This is awesome. I've wanted something like this for a long time. |
|
The issue this fixes is already on the 1.12 milestone but just to highlight that without it, if I understand correctly, |
2e238e7 to
de14a3c
Compare
Adds 4 new Float16 fields to CodeInstance to replace Compiler.Timings
with continually collected and available measurements.
Sample results on a novel method signature:
julia> @time code_native(devnull, ÷, dump_module=false, (Int32, UInt16));
0.006262 seconds (3.62 k allocations: 186.641 KiB, 75.53% compilation time)
julia> b = which(÷, (Int32, UInt16)).specializations[6].cache
CodeInstance for MethodInstance for div(::Int32, ::UInt16)
julia> reinterpret(Float16, b.time_infer_self)
Float16(0.0002766)
julia> reinterpret(Float16, b.time_infer_total)
Float16(0.00049)
julia> reinterpret(Float16, b.time_infer_cache_saved)
Float16(0.02774)
julia> reinterpret(Float16, b.time_compile)
Float16(0.003773)
de14a3c to
b234b22
Compare
xref JuliaLang/julia#57074 The old `Compiler.Timings` infrastructure is disabled, so here we leverage the same `newly_compiled` infrastructure used during precompilation.
With the "classic" inference timing disabled, PrecompileTools and SnoopCompile are non-functional on 1.12 & master. #57074 added timing data to the CodeInstances themselves, which should help restore SnoopCompile. However, without the tree structure provided by the old inference timing system, we still need a way to tag MethodInstances that get inferred inside `PrecompileTools.@compile_workload` blocks. This adds a simple mechanism modeled after `@trace_compile` that switching to tagging MethodInstances in `jl_push_newly_inferred`. JuliaLang/PrecompileTools.jl#47 contains the corresponding changes to PrecompileTools.jl.
With the "classic" inference timing disabled, PrecompileTools and SnoopCompile are non-functional on 1.12 & master. #57074 added timing data to the CodeInstances themselves, which should help restore SnoopCompile. However, without the tree structure provided by the old inference timing system, we still need a way to tag MethodInstances that get inferred inside `PrecompileTools.@compile_workload` blocks. This adds a simple mechanism modeled after `@trace_compile` that switches to tagging MethodInstances in `jl_push_newly_inferred`. JuliaLang/PrecompileTools.jl#47 contains (or will contain) the corresponding changes to PrecompileTools.jl.
With the "classic" inference timing disabled, PrecompileTools and SnoopCompile are non-functional on 1.12 & master. #57074 added timing data to the CodeInstances themselves, which should help restore SnoopCompile. However, without the tree structure provided by the old inference timing system, we still need a way to tag MethodInstances that get inferred inside `PrecompileTools.@compile_workload` blocks. This adds a simple mechanism modeled after `@trace_compile` that switches to tagging MethodInstances in `jl_push_newly_inferred`. JuliaLang/PrecompileTools.jl#47 contains (or will contain) the corresponding changes to PrecompileTools.jl. (cherry picked from commit c89b1ff)
Adds 4 new Float16 fields to CodeInstance to replace Compiler.Timings with continually collected and available measurements. Sample results on a novel method signature: julia> @time code_native(devnull, ÷, dump_module=false, (Int32, UInt16)); 0.006262 seconds (3.62 k allocations: 186.641 KiB, 75.53% compilation time) julia> b = which(÷, (Int32, UInt16)).specializations[6].cache CodeInstance for MethodInstance for div(::Int32, ::UInt16) julia> reinterpret(Float16, b.time_infer_self) Float16(0.0002766) julia> reinterpret(Float16, b.time_infer_total) Float16(0.00049) julia> reinterpret(Float16, b.time_infer_cache_saved) Float16(0.02774) julia> reinterpret(Float16, b.time_compile) Float16(0.003773) Closes #56115 (cherry picked from commit 18b5d8f)
xref JuliaLang/julia#57074 The old `Compiler.Timings` infrastructure is disabled, so here we leverage the same `newly_compiled` infrastructure used during precompilation. Because the implementation is so fundamentally different, this makes the upcoming Julia 1.12 the minimum required version for new development in this package. --------- Co-authored-by: Jameson Nash <vtjnash@gmail.com> Co-authored-by: Kristoffer <kcarlsson89@gmail.com>
Adds 4 new Float16 fields to CodeInstance to replace Compiler.Timings with continually collected and available measurements. Sample results on a novel method signature: julia> @time code_native(devnull, ÷, dump_module=false, (Int32, UInt16)); 0.006262 seconds (3.62 k allocations: 186.641 KiB, 75.53% compilation time) julia> b = which(÷, (Int32, UInt16)).specializations[6].cache CodeInstance for MethodInstance for div(::Int32, ::UInt16) julia> reinterpret(Float16, b.time_infer_self) Float16(0.0002766) julia> reinterpret(Float16, b.time_infer_total) Float16(0.00049) julia> reinterpret(Float16, b.time_infer_cache_saved) Float16(0.02774) julia> reinterpret(Float16, b.time_compile) Float16(0.003773) Closes JuliaLang#56115
Adds 4 new Float16 fields to CodeInstance to replace Compiler.Timings with continually collected and available measurements.
Sample results on a novel method signature:
Closes #56115