1212from llvmlite .ir .builder import IRBuilder
1313from numba .core import cgutils , errors , types
1414from numba .core .base import BaseContext
15-
16- from numba_dpex .kernel_api_impl .spirv .target import SPIRVTargetContext
17- from numba_dpex .ocl .oclimpl import _get_target_data
18-
19-
20- def get_itemsize (context : SPIRVTargetContext , array_type : types .Array ):
21- """
22- Return the item size for the given array or buffer type.
23- Same as numba.np.arrayobj.get_itemsize, but using spirv data.
24- """
25- targetdata = _get_target_data (context )
26- lldtype = context .get_data_type (array_type .dtype )
27- return lldtype .get_abi_size (targetdata )
15+ from numba .np .arrayobj import get_itemsize
2816
2917
3018def require_literal (literal_type : types .Type ):
@@ -47,14 +35,18 @@ def require_literal(literal_type: types.Type):
4735
4836
4937def make_spirv_array ( # pylint: disable=too-many-arguments
50- context : SPIRVTargetContext ,
38+ context : BaseContext ,
5139 builder : IRBuilder ,
5240 ty_array : types .Array ,
5341 ty_shape : Union [types .IntegerLiteral , types .BaseTuple ],
5442 shape : llvmir .Value ,
5543 data : llvmir .Value ,
5644):
57- """Makes SPIR-V array and fills it data."""
45+ """Makes SPIR-V array and fills it data.
46+
47+ Generic version of numba.np.arrayobj.np_cfarray so that it can be used
48+ not only as intrinsic, but inside instruction generation.
49+ """
5850 # Create array object
5951 ary = context .make_array (ty_array )(context , builder )
6052
@@ -112,7 +104,7 @@ def allocate_array_data_on_stack(
112104
113105
114106def make_spirv_generic_array_on_stack (
115- context : SPIRVTargetContext ,
107+ context : BaseContext ,
116108 builder : IRBuilder ,
117109 ty_array : types .Array ,
118110 ty_shape : Union [types .IntegerLiteral , types .BaseTuple ],
0 commit comments