Skip to content

Commit dbc6902

Browse files
committed
Move emission of PTX kernel properties to later phase.
1 parent a7847c4 commit dbc6902

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/ptx.jl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,23 @@ function finish_module!(@nospecialize(job::CompilerJob{PTXCompilerTarget}),
185185
if job.source.kernel
186186
# work around bad byval codegen (JuliaGPU/GPUCompiler.jl#92)
187187
entry = lower_byval(job, mod, entry)
188-
# TODO: optimization passes to clean-up byval
188+
end
189189

190+
return entry
191+
end
192+
193+
function finish_ir!(@nospecialize(job::CompilerJob{PTXCompilerTarget}),
194+
mod::LLVM.Module, entry::LLVM.Function)
195+
ctx = context(mod)
196+
entry = invoke(finish_ir!, Tuple{CompilerJob, LLVM.Module, LLVM.Function}, job, mod, entry)
197+
198+
if job.source.kernel
190199
# add metadata annotations for the assembler to the module
191200

201+
# NOTE: we do this here, rather than in finish_module!, because otherwise
202+
# the metadata is lost when functions are cloned.
203+
# XXX: why does this happen? shouldn't cloning preserve metadata?
204+
192205
# property annotations
193206
annotations = Metadata[entry]
194207

0 commit comments

Comments
 (0)