Skip to content

Commit

Permalink
Fixup debug metadata in kernel fixup
Browse files Browse the repository at this point in the history
The first kernel parameter also needs removing from the debug metadata,
so that the debug metadata argument types align with the arguments to
the fixed-up kernel.
  • Loading branch information
gmarkall committed Dec 20, 2024
1 parent 22bb24d commit 53efe04
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions numba_cuda/numba/cuda/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,18 @@ def kernel_fixup(kernel, debug):
kernel.return_value = ir.ReturnValue(kernel, ir.VoidType())
kernel.args = kernel.args[1:]

# If debug metadata is present, remove the return value from it

if kernel_metadata := getattr(kernel, 'metadata', None):
if dbg_metadata := kernel_metadata.get('dbg', None):
for name, value in dbg_metadata.operands:
if name == "type":
type_metadata = value
for tm_name, tm_value in type_metadata.operands:
if tm_name == 'types':
types = tm_value
types.operands = types.operands[1:]

# Mark as a kernel for NVVM

nvvm.set_cuda_kernel(kernel)
Expand Down

0 comments on commit 53efe04

Please sign in to comment.