Skip to content

Commit

Permalink
attempt to use PrecompileTools
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy authored and wsmoses committed Jul 21, 2024
1 parent 84d8120 commit 0e905d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/Enzyme.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1471,4 +1471,13 @@ macro import_rrule(args...)
return _import_rrule(args...)
end

# using PrecompileTools
# Crashes on 1.11
# @setup_workload let
# @compile_workload begin
# autodiff(ReverseMode{false,InlineABI,false}(), ()->nothing, Const)
# autodiff(ForwardMode{InlineABI}(), ()->nothing, Const)
# end
# end

end # module
11 changes: 7 additions & 4 deletions test/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ precompile_test_harness("Inference caching") do load_path

@setup_workload begin
@compile_workload begin
autodiff(Reverse, mul, Active, Active(1.0), Active(2.0))
autodiff(Forward, mul, Duplicated, Duplicated(1.0, 1.0), Const(2.0))
autodiff(ReverseMode{false,InlineABI,false}(), mul, Active, Active(1.0), Active(2.0))
# Non-Inline mode uses `@generated` functions and poisons the caller
# autodiff(Reverse, mul, Active, Active(1.0), Active(2.0))
# autodiff(Forward, mul, Duplicated, Duplicated(1.0, 1.0), Const(2.0))
end
end
end) |> string)
Expand All @@ -53,7 +55,8 @@ precompile_test_harness("Inference caching") do load_path
using InferenceCaching
using Enzyme

autodiff(Reverse, InferenceCaching.mul, Active, Active(1.0), Active(2.0))
autodiff(Forward, InferenceCaching.mul, Duplicated, Duplicated(1.0, 1.0), Const(2.0))
@test autodiff(ReverseMode{false,InlineABI,false}(), InferenceCaching.mul, Active, Active(1.0), Active(2.0)) == ((2.0, 1.0),)
# autodiff(Reverse, InferenceCaching.mul, Active, Active(1.0), Active(2.0))
# autodiff(Forward, InferenceCaching.mul, Duplicated, Duplicated(1.0, 1.0), Const(2.0))
end
end

0 comments on commit 0e905d7

Please sign in to comment.