Skip to content

Commit 6775a69

Browse files
small changes
1 parent 956c3ca commit 6775a69

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

numba_cuda/numba/cuda/target.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,22 +292,26 @@ def make_constant_list(self, builder, listty, lst):
292292
for i in iter(arr.tobytes(order="C"))
293293
]
294294
constaryty = ir.ArrayType(ir.IntType(8), len(constvals))
295-
constary = ir.Constant(constaryty, constvals)
295+
constary = ir.Constant(
296+
constaryty, constvals
297+
) # constant llvm value with the values
296298

297-
# Create constant memory data
299+
# create a global variable
298300
addrspace = nvvm.ADDRSPACE_CONSTANT
299301
gv = cgutils.add_global_variable(
300302
lmod, constary.type, "_cudapy_clist", addrspace=addrspace
301303
)
302304
gv.linkage = "internal"
303305
gv.global_constant = True
304-
gv.initializer = constary
306+
gv.initializer = (
307+
constary # put the gobal variable initializer to the constant array
308+
)
305309

306310
lldtype = self.get_data_type(listty.dtype)
307311
align = self.get_abi_sizeof(lldtype)
308312
gv.align = 2 ** (align - 1).bit_length()
309313

310-
ptrty = ir.PointerType(ir.IntType(8))
314+
ptrty = ir.PointerType(ir.IntType(8)) # an int8 pointer
311315
genptr = builder.addrspacecast(gv, ptrty, "generic")
312316

313317
list_inst = ListInstance.allocate(self, builder, listty, nitems)

numba_cuda/numba/cuda/tests/cudapy/test_lists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def tearDown(self):
2323
config.CUDA_ENABLE_NRT = self.old_nrt_setting
2424
super().tearDown()
2525

26-
def test_list_roundtrip(self):
26+
def test_list_const_roundtrip(self):
2727
lst = [1, 2, 3]
2828

2929
@cuda.jit

0 commit comments

Comments
 (0)