@@ -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 )
0 commit comments