Skip to content

Commit

Permalink
Merge pull request JuliaGPU#411 from JuliaGPU/vc/fixes
Browse files Browse the repository at this point in the history
Adjust verifier to new internal ABI
  • Loading branch information
vchuravy authored Jun 1, 2019
2 parents cfc9c5f + a7755c4 commit 84126dc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
23 changes: 16 additions & 7 deletions src/compiler/validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,16 @@ function check_ir!(job, errors::Vector{IRError}, inst::LLVM.CallInst)
elseif fn == "jl_invoke"
# interpret the arguments
meth = try
meth, args, nargs, _ = operands(inst)
if VERSION < v"1.3.0-DEV.244"
meth, args, nargs, _ = operands(inst)
else
f, args, nargs, meth = operands(inst)
end
meth = first(operands(meth::ConstantExpr))::ConstantExpr
meth = first(operands(meth))::ConstantInt
meth = convert(Int, meth)
meth = Ptr{Cvoid}(meth)
Base.unsafe_pointer_to_objref(meth)
Base.unsafe_pointer_to_objref(meth)::Core.MethodInstance
catch e
isa(e,TypeError) || rethrow()
@warn "Decoding arguments to jl_invoke failed, please file a bug with a reproducer." inst bb=LLVM.parent(inst)
Expand All @@ -198,11 +202,16 @@ function check_ir!(job, errors::Vector{IRError}, inst::LLVM.CallInst)
elseif fn == "jl_apply_generic"
# interpret the arguments
f = try
args, nargs, _ = operands(inst)
## args is a buffer where arguments are stored in
f, args = user.(uses(args))
## first store into the args buffer is a direct store
f = first(operands(f::LLVM.StoreInst))::ConstantExpr
if VERSION < v"1.3.0-DEV.244"
args, nargs, _ = operands(inst)
## args is a buffer where arguments are stored in
f, args = user.(uses(args))
## first store into the args buffer is a direct store
f = first(operands(f::LLVM.StoreInst))::ConstantExpr
else
f, args, nargs, _ = operands(inst)
end

f = first(operands(f))::ConstantExpr # get rid of addrspacecast
f = first(operands(f))::ConstantInt # get rid of inttoptr
f = convert(Int, f)
Expand Down
6 changes: 5 additions & 1 deletion test/device/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,11 @@ let (code, out, err) = julia_script(script, `-g2`)
@test occursin("ERROR: CUDA error: an illegal instruction was encountered", err) ||
occursin("ERROR: CUDA error: unspecified launch failure", err)
@test occursin("ERROR: a exception was thrown during kernel execution", out)
@test occursin("[1] Type at float.jl", out)
if VERSION < v"1.3.0-DEV.270"
@test occursin("[1] Type at float.jl", out)
else
@test occursin("[1] Int64 at float.jl", out)
end
@test occursin("[2] kernel at none:2", out)
end

Expand Down

0 comments on commit 84126dc

Please sign in to comment.