Closed
Description
Currently this is executed at construction time:
if isinstance(module, str):
# TODO: this option is only taken by the new library APIs, but we have
# a bug that we can't easily support it just yet (NVIDIA/cuda-python#73).
if jit_options is not None:
raise ValueError
module = module.encode()
self._handle = handle_return(self._loader["file"](module))
else:
assert isinstance(module, bytes)
if jit_options is None:
jit_options = {}
if backend == "new":
args = (
module,
list(jit_options.keys()),
list(jit_options.values()),
len(jit_options),
# TODO: support library options
[],
[],
0,
)
else: # "old" backend
args = (module, len(jit_options), list(jit_options.keys()), list(jit_options.values()))
self._handle = handle_return(self._loader["data"](*args))
This should happen in a lazy_load method. Certain uses of the ObjectCode object don't require the module to be loaded, such as linking ptx or ltoir code objects together.