@@ -273,58 +273,6 @@ def mangler(self, name, argtypes, *, abi_tags=(), uid=None):
273273 name , argtypes , abi_tags = abi_tags , uid = uid
274274 )
275275
276- def make_constant_list (self , builder , listty , lst ):
277- """
278- Create a list structure with data in constant address space.
279- The list metadata is in normal memory but the data array is in constant memory.
280- """
281- import numpy as np
282- from numba .cuda .cpython .listobj import ListInstance
283-
284- lmod = builder .module
285-
286- # Convert to array and serialize
287- arr = np .array (lst )
288- nitems = len (arr )
289-
290- constvals = [
291- self .get_constant (types .byte , i )
292- for i in iter (arr .tobytes (order = "C" ))
293- ]
294- constaryty = ir .ArrayType (ir .IntType (8 ), len (constvals ))
295- constary = ir .Constant (
296- constaryty , constvals
297- ) # constant llvm value with the values
298-
299- # create a global variable
300- addrspace = nvvm .ADDRSPACE_CONSTANT
301- gv = cgutils .add_global_variable (
302- lmod , constary .type , "_cudapy_clist" , addrspace = addrspace
303- )
304- gv .linkage = "internal"
305- gv .global_constant = True
306- gv .initializer = (
307- constary # put the gobal variable initializer to the constant array
308- )
309-
310- lldtype = self .get_data_type (listty .dtype )
311- align = self .get_abi_sizeof (lldtype )
312- gv .align = 2 ** (align - 1 ).bit_length ()
313-
314- ptrty = ir .PointerType (ir .IntType (8 )) # an int8 pointer
315- genptr = builder .addrspacecast (gv , ptrty , "generic" )
316-
317- list_inst = ListInstance .allocate (self , builder , listty , nitems )
318- data_ptrty = self .get_data_type (listty .dtype ).as_pointer ()
319- const_data_ptr = builder .bitcast (genptr , data_ptrty )
320- payload = list_inst ._payload
321-
322- # replace with constant mem
323- payload .data = builder .ptrtoint (const_data_ptr , payload .data .type )
324- list_inst .size = self .get_constant (types .intp , nitems )
325-
326- return list_inst .value
327-
328276 def make_constant_array (self , builder , aryty , arr ):
329277 """
330278 Unlike the parent version. This returns a a pointer in the constant
0 commit comments