@@ -155,9 +155,10 @@ function add_address_spaces!(@nospecialize(job::CompilerJob), mod::LLVM.Module,
155
155
end
156
156
157
157
function remapType (src)
158
- # TODO : cache?
159
- # TODO : recurse in structs?
160
- # TODO : when wrapping non-AS1 pointers, shouldn't the parent object use the same AS?
158
+ # TODO : shouldn't we recurse into structs here, making sure the parent object's
159
+ # address space matches the contained one? doesn't matter right now as we
160
+ # only use LLVMPtr (i.e. no rewriting of contained pointers needed) in the
161
+ # device addrss space (i.e. no mismatch between parent and field possible)
161
162
dst = if src isa LLVM. PointerType && addrspace (src) == 0
162
163
LLVM. PointerType (remapType (eltype (src)), #= device=# 1 )
163
164
else
@@ -376,7 +377,6 @@ function add_input_arguments!(@nospecialize(job::CompilerJob), mod::LLVM.Module,
376
377
used_intrinsics = filter (keys (kernel_intrinsics)) do intr_fn
377
378
haskey (functions (mod), intr_fn)
378
379
end |> collect
379
- # TODO : Figure out how to not be inefficient with these changes
380
380
nargs = length (used_intrinsics)
381
381
382
382
# determine which functions need these arguments
@@ -404,8 +404,7 @@ function add_input_arguments!(@nospecialize(job::CompilerJob), mod::LLVM.Module,
404
404
end
405
405
406
406
# add the arguments
407
- # NOTE: we could be more fine-grained, only adding the specific intrinsics used by this function.
408
- # not sure if that's worth it though.
407
+ # NOTE: we don't need to be fine-grained here, as unused args will be removed during opt
409
408
workmap = Dict {LLVM.Function, LLVM.Function} ()
410
409
for f in worklist
411
410
fn = LLVM. name (f)
535
534
#
536
535
# module metadata is used to identify buffers that are passed as kernel arguments.
537
536
538
- # TODO : remove metadata emission infrastructure from GPUCompiler
539
-
540
537
function add_argument_metadata! (@nospecialize (job:: CompilerJob ), mod:: LLVM.Module ,
541
538
entry:: LLVM.Function )
542
539
ctx = context (mod)
0 commit comments