Skip to content

Commit e500304

Browse files
committed
store attribtues in function
1 parent a2555f9 commit e500304

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

cuda_core/cuda/core/experimental/_module.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,33 +130,35 @@ def __init__(self, module, code_type, jit_options=None, *, symbol_mapping=None):
130130
def _lazy_load_module(self, *args, **kwargs):
131131
if self._handle is not None:
132132
return
133-
if isinstance(self._module, str):
133+
jit_options = self._jit_options
134+
module = self._module
135+
if isinstance(module, str):
134136
# TODO: this option is only taken by the new library APIs, but we have
135137
# a bug that we can't easily support it just yet (NVIDIA/cuda-python#73).
136-
if self._jit_options is not None:
138+
if jit_options is not None:
137139
raise ValueError
138-
self._handle = handle_return(self._loader["file"](self._module))
140+
self._handle = handle_return(self._loader["file"](module))
139141
else:
140-
assert isinstance(self._module, bytes)
141-
if self._jit_options is None:
142-
self._jit_options = {}
142+
assert isinstance(module, bytes)
143+
if jit_options is None:
144+
jit_options = {}
143145
if self._backend_version == "new":
144146
args = (
145-
self._module,
146-
list(self._jit_options.keys()),
147-
list(self._jit_options.values()),
148-
len(self._jit_options),
147+
module,
148+
list(jit_options.keys()),
149+
list(jit_options.values()),
150+
len(jit_options),
149151
# TODO: support library options
150152
[],
151153
[],
152154
0,
153155
)
154156
else: # "old" backend
155157
args = (
156-
self._module,
157-
len(self._jit_options),
158-
list(self._jit_options.keys()),
159-
list(self._jit_options.values()),
158+
module,
159+
len(jit_options),
160+
list(jit_options.keys()),
161+
list(jit_options.values()),
160162
)
161163
self._handle = handle_return(self._loader["data"](*args))
162164

0 commit comments

Comments
 (0)