Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/llvm/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 13 additions & 1 deletion test/runtime_calls.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Enzyme, Test
using Enzyme, Test, Logging

@testset "jl_typeof" begin
# https://github.com/EnzymeAD/Enzyme.jl/issues/2405
Expand All @@ -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

Loading