numba_dpex.core.passes.lowerer module
- exception numba_dpex.core.passes.lowerer.CopyIRException(*args, **kwargs)
Bases:
RuntimeError
- class numba_dpex.core.passes.lowerer.DPPYLower(context, library, fndesc, func_ir, metadata=None)
Bases:
numba.core.lowering.Lower
- create_cpython_wrapper(release_gil=False)
Create CPython wrapper(s) around this function (or generator).
- lower()
Lowering function with fallback.
The lowerer has a builtin fallback mechanism for parfor functions. We first try to lower a parfor onto a SYCL device using numba-dpex’s pipeline, if the lowering fails then we fallback to the default Numba lowering to CPU. The lowering follow the following steps:
Start lowering of parent function
- Try to lower parfor onto the specified SYCL device
- 2.a. The
lower_parfor_rollback
function prepares function to lower onto to the specified SYCL device and inserts the
get_global_id
intrinsic function.- 2.a.a. Start lowering the parfor body and execute
DPPYLower.lower()
again.
2.a.b. If the lowering fails, throw an exception.
- 2.b. The
lower_parfor_rollback
catches the exception and restores the parfor body to its initial state.
- 2.c. Then throw an exception inside
lower_parfor_rollback
that will be caught inside
DPPYLower.lower()
.
- 2.a. The
Catch exception and start parfor lowering with the default Numba CPU context.
TODO/FIXME The rollback approach only works in case no device specific modifications were added to function containing the parfor node. If the function has any device specific modifications, a different solution should be used.
- Raises:
Exception: If a parfor node could not be lowered to a SYCL device.
- class numba_dpex.core.passes.lowerer.WrapperDefaultLower(context, library, fndesc, func_ir, metadata=None)
Bases:
numba.core.lowering.Lower
- numba_dpex.core.passes.lowerer.copy_block(block)
- numba_dpex.core.passes.lowerer.dppy_lower_array_expr(lowerer, expr)
- numba_dpex.core.passes.lowerer.find_setitems_block(setitems, block, typemap)
- numba_dpex.core.passes.lowerer.find_setitems_body(setitems, loop_body, typemap)
Find the arrays that are written into (goes into setitems)
- numba_dpex.core.passes.lowerer.generate_kernel_launch_ops(lowerer, cres, gu_signature, outer_sig, expr_args, num_inputs, expr_arg_types, loop_ranges, modified_arrays)
Adds the call to the gufunc function from the main function.
- numba_dpex.core.passes.lowerer.legalize_names_with_typemap(names, typemap)
We use ir_utils.legalize_names to replace internal IR variable names containing illegal characters (e.g. period) with a legal character (underscore) so as to create legal variable names. The original variable names are in the typemap so we also need to add the legalized name to the typemap as well.
- numba_dpex.core.passes.lowerer.lower_parfor_rollback(lowerer, parfor)
- numba_dpex.core.passes.lowerer.relatively_deep_copy(obj, memo)
- numba_dpex.core.passes.lowerer.replace_var_with_array(vars, loop_body, typemap, calltypes)
- numba_dpex.core.passes.lowerer.replace_var_with_array_in_block(vars, block, typemap, calltypes)
- numba_dpex.core.passes.lowerer.replace_var_with_array_internal(vars, loop_body, typemap, calltypes)
- numba_dpex.core.passes.lowerer.to_scalar_from_0d(x)
- numba_dpex.core.passes.lowerer.unwrap_loop_body(loop_body)
- numba_dpex.core.passes.lowerer.wrap_loop_body(loop_body)