Skip to content

CUDA: Error handling variables not added to the @llvm.used list #9526

@gmarkall

Description

@gmarkall

#9267 fixed dropping of kernels by pynvjitlink by adding kernels to the @llvm.used list.

We also add global variables for representing an error handling state:

numba/numba/cuda/target.py

Lines 219 to 224 in 03f2722

def define_error_gv(postfix):
name = wrapfn.name + postfix
gv = cgutils.add_global_variable(wrapper_module, ir.IntType(32),
name)
gv.initializer = ir.Constant(gv.type.pointee, None)
return gv

The variables seem to get optimized away when LTO is used with pynvjitlink, and I suspect they should also be added to the @llvm.used list to prevent them being optimized away - from the perspective of device code, they are only ever written to, so they look un-needed - it's only the host that looks up their values after kernel execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions