Skip to content

Commit

Permalink
Adapt to jll bump and use nice default error for unknown c functions (#…
Browse files Browse the repository at this point in the history
…1064)

* Adapt to jll bump and use nice default error for unknown c functions

* bump jll

* fixup
  • Loading branch information
wsmoses authored Sep 22, 2023
1 parent 061f495 commit 031e351
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[compat]
CEnum = "0.4"
EnzymeCore = "0.5.2"
Enzyme_jll = "0.0.84"
Enzyme_jll = "0.0.86"
GPUCompiler = "0.21, 0.22, 0.23, 0.24"
LLVM = "6.1"
ObjectFile = "0.4"
Expand Down
12 changes: 6 additions & 6 deletions src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ function EnzymeCreatePrimalAndGradient(logic, todiff, retType, constant_args, TA
uncacheable_args, augmented, atomicAdd)
freeMemory = true
ccall((:EnzymeCreatePrimalAndGradient, libEnzyme), LLVMValueRef,
(EnzymeLogicRef, LLVMValueRef, CDIFFE_TYPE, Ptr{CDIFFE_TYPE}, Csize_t,
(EnzymeLogicRef, LLVMValueRef, LLVM.API.LLVMBuilderRef, LLVMValueRef, CDIFFE_TYPE, Ptr{CDIFFE_TYPE}, Csize_t,
EnzymeTypeAnalysisRef, UInt8, UInt8, CDerivativeMode, Cuint, UInt8, LLVMTypeRef, UInt8, CFnTypeInfo,
Ptr{UInt8}, Csize_t, EnzymeAugmentedReturnPtr, UInt8),
logic, todiff, retType, constant_args, length(constant_args), TA, returnValue,
logic, C_NULL, C_NULL, todiff, retType, constant_args, length(constant_args), TA, returnValue,
dretUsed, mode, width, freeMemory, additionalArg, forceAnonymousTape, typeInfo, uncacheable_args, length(uncacheable_args),
augmented, atomicAdd)
end
Expand All @@ -140,10 +140,10 @@ function EnzymeCreateForwardDiff(logic, todiff, retType, constant_args, TA,
freeMemory = true
aug = C_NULL
ccall((:EnzymeCreateForwardDiff, libEnzyme), LLVMValueRef,
(EnzymeLogicRef, LLVMValueRef, CDIFFE_TYPE, Ptr{CDIFFE_TYPE}, Csize_t,
(EnzymeLogicRef, LLVMValueRef, LLVM.API.LLVMBuilderRef, LLVMValueRef, CDIFFE_TYPE, Ptr{CDIFFE_TYPE}, Csize_t,
EnzymeTypeAnalysisRef, UInt8, CDerivativeMode, UInt8, Cuint, LLVMTypeRef, CFnTypeInfo,
Ptr{UInt8}, Csize_t, EnzymeAugmentedReturnPtr),
logic, todiff, retType, constant_args, length(constant_args), TA, returnValue,
logic, C_NULL, C_NULL, todiff, retType, constant_args, length(constant_args), TA, returnValue,
mode, freeMemory, width, additionalArg, typeInfo, uncacheable_args, length(uncacheable_args), aug)
end

Expand All @@ -162,10 +162,10 @@ function EnzymeCreateAugmentedPrimal(logic, todiff, retType, constant_args, TA,
shadowReturnUsed,
typeInfo, uncacheable_args, forceAnonymousTape, width, atomicAdd)
ccall((:EnzymeCreateAugmentedPrimal, libEnzyme), EnzymeAugmentedReturnPtr,
(EnzymeLogicRef, LLVMValueRef, CDIFFE_TYPE, Ptr{CDIFFE_TYPE}, Csize_t,
(EnzymeLogicRef, LLVMValueRef, LLVM.API.LLVMBuilderRef, LLVMValueRef, CDIFFE_TYPE, Ptr{CDIFFE_TYPE}, Csize_t,
EnzymeTypeAnalysisRef, UInt8, UInt8,
CFnTypeInfo, Ptr{UInt8}, Csize_t, UInt8, Cuint, UInt8),
logic, todiff, retType, constant_args, length(constant_args), TA, returnUsed,
logic, C_NULL, C_NULL, todiff, retType, constant_args, length(constant_args), TA, returnUsed,
shadowReturnUsed,
typeInfo, uncacheable_args, length(uncacheable_args), forceAnonymousTape, width, atomicAdd)
end
Expand Down
4 changes: 1 addition & 3 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6956,9 +6956,7 @@ function __init__()
@fwdfunc(jl_array_ptr_copy_fwd),
)
register_handler!(
("jl_uv_associate_julia_struct","uv_async_init","cuLaunchHostFunc","uv_timer_init","uv_timer_start","jl_array_del_beg","ijl_array_del_beg","jl_array_grow_beg","ijl_array_grow_beg","cublasDgemm_v2", "cublasDscal_v2", "ijl_call_in_typeinf_world", "jl_call_in_typeinf_world",
"dpotrf_64_", "dpotrf_", "dtrtrs_64_", "dtrtrs_", "dgetrf_64_", "dgetrf_", "dgetrs_", "dgetrs_64_", "dtzrzf_", "dtzrzf_64_", "dormqr_", "dormqr_64_", "dormrz_", "dormrz_64_", "dlaic1_", "dlaic1_64_", "dgeqp3_", "dgeqp3_64_",
"cholmod_l_start", "dgetri_64_", "dgetri_", "nc_sync"),
(),
@augfunc(jl_unhandled_augfwd),
@revfunc(jl_unhandled_rev),
@fwdfunc(jl_unhandled_fwd),
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1761,7 +1761,7 @@ end
@testset "Exception" begin

f_no_derv(x) = ccall("extern doesnotexist", llvmcall, Float64, (Float64,), x)
@test_throws Enzyme.Compiler.NoDerivativeException autodiff(Reverse, f_no_derv, Active, Active(0.5))
@test_throws Enzyme.Compiler.EnzymeRuntimeException autodiff(Reverse, f_no_derv, Active, Active(0.5))

f_union(cond, x) = cond ? x : 0
g_union(cond, x) = f_union(cond,x)*x
Expand Down

0 comments on commit 031e351

Please sign in to comment.