diff --git a/src/llvm/attributes.jl b/src/llvm/attributes.jl index 364d2f3a20..b5c823feb9 100644 --- a/src/llvm/attributes.jl +++ b/src/llvm/attributes.jl @@ -51,6 +51,8 @@ const nofreefns = Set{String}(( "ijl_try_substrtod", "jl_try_substrtod", "jl_f__apply_iterate", + "jl_f_current_scope", + "ijl_f_current_scope", "ijl_field_index", "jl_field_index", "julia.call", @@ -263,6 +265,8 @@ const inactivefns = Set{String}(( "jl_gc_get_total_bytes", "ijl_try_substrtod", "jl_try_substrtod", + "jl_f_current_scope", + "ijl_f_current_scope", "ijl_tagged_gensym", "jl_tagged_gensym", "jl_get_world_counter", @@ -599,6 +603,8 @@ function annotate!(mod::LLVM.Module) "ijl_get_nth_field_checked", "jl_f__svec_ref", "ijl_f__svec_ref", + "jl_f_current_scope", + "ijl_f_current_scope", "UnsafeBufferPointer" ) if haskey(funcs, fname) diff --git a/test/runtime_calls.jl b/test/runtime_calls.jl index 6baf9384b0..5e35e64a97 100644 --- a/test/runtime_calls.jl +++ b/test/runtime_calls.jl @@ -1,4 +1,4 @@ -using Enzyme, Test +using Enzyme, Test, Logging @testset "jl_typeof" begin # https://github.com/EnzymeAD/Enzyme.jl/issues/2405 @@ -8,3 +8,15 @@ using Enzyme, Test end @test autodiff(Reverse, foo, Active(1.0))[1][1] == 1.0 end + +@testset "jl_f_current_scope" begin + function foo_logger(p) + sol = Logging.with_logger(Logging.current_logger()) do + p[1] * p[2] + end + return sol + end + g = Enzyme.gradient(Reverse, foo_logger, [2.0, 3.0])[1] + @test g ≈ [3.0, 2.0] +end +