Enzyme.jl icon indicating copy to clipboard operation
Enzyme.jl copied to clipboard

Implement our own LookupError

Open vchuravy opened this issue 1 month ago • 6 comments

vchuravy avatar Nov 11 '25 17:11 vchuravy

Your PR requires formatting changes to meet the project's style guidelines. Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/src/utils.jl b/src/utils.jl
index c2dc83e9..f4980eb6 100644
--- a/src/utils.jl
+++ b/src/utils.jl
@@ -273,8 +273,8 @@ end
 function Base.showerror(io::IO, e::LookupError)
     print(io, "no method matching ")
     Base.show_signature_function(io, e.ft)
-    Base.show_tuple_as_call(io, :function, e.tt; hasfirst=false, kwargs=nothing)
-    if Core._hasmethod(GPUCompiler.signature_type_by_tt(e.ft, e.tt))
+    Base.show_tuple_as_call(io, :function, e.tt; hasfirst = false, kwargs = nothing)
+    return if Core._hasmethod(GPUCompiler.signature_type_by_tt(e.ft, e.tt))
         print(io, "\n(method exists but is not available in world age $(e.world))")
     end
 end

github-actions[bot] avatar Nov 11 '25 17:11 github-actions[bot]

Benchmark Results

main 0cee171489fcab... main / 0cee171489fcab...
basics/make_zero/namedtuple 0.0543 ± 0.0022 μs 0.0555 ± 0.0025 μs 0.979 ± 0.06
basics/make_zero/struct 0.261 ± 0.0064 μs 0.261 ± 0.0068 μs 1 ± 0.036
basics/overhead 5.57 ± 1.8 ns 5.56 ± 0.01 ns 1 ± 0.33
basics/remake_zero!/namedtuple 0.236 ± 0.0073 μs 0.242 ± 0.011 μs 0.974 ± 0.053
basics/remake_zero!/struct 0.249 ± 0.0063 μs 0.234 ± 0.01 μs 1.07 ± 0.053
fold_broadcast/multidim_sum_bcast/1D 10.3 ± 0.36 μs 10.4 ± 0.52 μs 0.996 ± 0.061
fold_broadcast/multidim_sum_bcast/2D 10.3 ± 0.22 μs 12.1 ± 0.35 μs 0.848 ± 0.031
time_to_load 1.31 ± 0.0013 s 1.32 ± 0.019 s 0.991 ± 0.014

Benchmark Plots

A plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/19274222758/artifacts/4534799538.

github-actions[bot] avatar Nov 11 '25 18:11 github-actions[bot]

Codecov Report

:x: Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 68.90%. Comparing base (4fa1260) to head (0cee171).

Files with missing lines Patch % Lines
src/utils.jl 25.00% 6 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2772      +/-   ##
==========================================
- Coverage   68.92%   68.90%   -0.02%     
==========================================
  Files          58       58              
  Lines       19861    19868       +7     
==========================================
+ Hits        13690    13691       +1     
- Misses       6171     6177       +6     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Nov 11 '25 18:11 codecov[bot]

why?

oscardssmith avatar Nov 11 '25 18:11 oscardssmith

Because you can't throw a method error using only the type of the function?

vchuravy avatar Nov 11 '25 18:11 vchuravy

@vchuravy ah, that makes sense then.

oscardssmith avatar Nov 11 '25 22:11 oscardssmith