Skip to content

Commit

Permalink
fix an issue with detecting llvmcalls when they are interpolated (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Dec 21, 2022
1 parent 8e02ddb commit bc3ee6c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Expand All @@ -30,4 +31,4 @@ Tensors = "48a634ad-e948-5137-8d70-aa71f2a747f4"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["CassetteOverlay", "DataFrames", "Dates", "DeepDiffs", "Distributed", "FunctionWrappers", "HTTP", "LinearAlgebra", "Logging", "Mmap", "PyCall", "SHA", "SparseArrays", "Tensors", "Test"]
test = ["CassetteOverlay", "DataFrames", "Dates", "DeepDiffs", "Distributed", "FunctionWrappers", "HTTP", "LinearAlgebra", "Logging", "LoopVectorization", "Mmap", "PyCall", "SHA", "SparseArrays", "Tensors", "Test"]
3 changes: 2 additions & 1 deletion src/construct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ function prepare_framecode(method::Method, @nospecialize(argtypes); enter_genera
# Currenly, our strategy to deal with llvmcall can't handle parametric functions
# (the "mini interpreter" runs in module scope, not method scope)
if (!isempty(lenv) && (hasarg(isidentical(:llvmcall), code.code) ||
hasarg(a->is_global_ref(a, Base, :llvmcall), code.code))) ||
hasarg(isidentical(Base.llvmcall), code.code) ||
hasarg(a->is_global_ref(a, Base, :llvmcall), code.code))) ||
hasarg(isidentical(:iolock_begin), code.code)
return Compiled()
end
Expand Down
20 changes: 20 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -954,3 +954,23 @@ end
@test (@interpret pass(foo)) == 1
end
end

using LoopVectorization

@testset "interpolated llvmcall" begin
function f_lv!(A)
m, n = size(A)
k = 1
@turbo for j in (k + 1):n
for i in (k + 1):m
A[i, j] -= A[i, k] * A[k, j]
end
end
return A
end
A = rand(5,5)
B = copy(A)
@interpret f_lv!(A)
f_lv!(B)
@test A B
end

0 comments on commit bc3ee6c

Please sign in to comment.