You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each dpnp.ndarray object inside Numba uses the default Numba datamodel as defined in numba's _arraystruct.h:
typedef struct {
void *meminfo; /* see _nrt_python.c and nrt.h in numba/core/runtime */
PyObject *parent;
npy_intp nitems;
npy_intp itemsize;
void *data;
npy_intp shape_and_strides[];
} arystruct_t;
The meminfo is an internal structure maintained by Numba for each array that stores essential metadata about the array along with ana alias of the array's data pointer. Refer numba_dpex/core/runtime/_meminfo_helper.h:
struct MemInfo
{
size_t refct;
NRT_dtor_function dtor;
void *dtor_info;
void *data;
size_t size; /* only used for NRT allocated memory */
NRT_ExternalAllocator *external_allocator;
};
The parent is a pointer to any original Python object from which the Numba internal array was created. It is a nullptr if is the array was created inside a Numba jit compiled function.
Since these two attributes are defined in the Numba array datamodel, and since Numba passes array objects as flattened representation, any LLVM functions generated by Numba with array arguments will have extra args for the meminfo and parent pointers.
For kernel functions, these pointers are never accessed in side the function and are always passed as NULL pointers.
We should evaluate if these pointers should be passed as kernel arguments. The benefit of doing so will be it will make debugging the kernels using GDB simpler and code generation will also get simplified with lesser boilerplate.
The text was updated successfully, but these errors were encountered:
Each dpnp.ndarray object inside Numba uses the default Numba datamodel as defined in numba's _arraystruct.h:
The meminfo is an internal structure maintained by Numba for each array that stores essential metadata about the array along with ana alias of the array's data pointer. Refer numba_dpex/core/runtime/_meminfo_helper.h:
The parent is a pointer to any original Python object from which the Numba internal array was created. It is a nullptr if is the array was created inside a Numba jit compiled function.
Since these two attributes are defined in the Numba array datamodel, and since Numba passes array objects as flattened representation, any LLVM functions generated by Numba with array arguments will have extra args for the meminfo and parent pointers.
For kernel functions, these pointers are never accessed in side the function and are always passed as
NULL
pointers.We should evaluate if these pointers should be passed as kernel arguments. The benefit of doing so will be it will make debugging the kernels using GDB simpler and code generation will also get simplified with lesser boilerplate.
The text was updated successfully, but these errors were encountered: