Skip to content

Commit

Permalink
Lower byval ourselves for PTX.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Oct 12, 2020
1 parent bc13183 commit 2b261d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
9 changes: 2 additions & 7 deletions src/ptx.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@ end
function process_kernel!(job::CompilerJob{PTXCompilerTarget}, mod::LLVM.Module, kernel::LLVM.Function)
ctx = context(mod)

# pass all bitstypes by value
args = classify_arguments(job, kernel)
for arg in args
if arg.cc == BITS_REF
push!(parameter_attributes(kernel, arg.codegen.i), EnumAttribute("byval"))
end
end
# work around bad byval codegen (JuliaGPU/GPUCompiler.jl#92)
kernel = lower_byval(job, mod, kernel)

# property annotations
annotations = LLVM.Value[kernel]
Expand Down
6 changes: 1 addition & 5 deletions test/ptx.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ end
end

ir = sprint(io->ptx_code_llvm(io, kernel, Tuple{Aggregate}; kernel=true))
if VERSION < v"1.5.0-DEV.802"
@test occursin(r"@.*julia_kernel.+\(({ i64 }|\[1 x i64\]) addrspace\(\d+\)?\*.+byval", ir)
else
@test occursin(r"@.*julia_kernel.+\(({ i64 }|\[1 x i64\])\*.+byval", ir)
end
@test occursin(r"@.*julia_kernel.+\(({ i64 }|\[1 x i64\])", ir)
end

@testset "property_annotations" begin
Expand Down

0 comments on commit 2b261d0

Please sign in to comment.