numba_dpex.core.passes.parfor_legalize_cfd_pass module
- class numba_dpex.core.passes.parfor_legalize_cfd_pass.ParforLegalizeCFDPass
Bases:
FunctionPass- pass_id = 44
- run_pass(state)
Legalize CFD of parfor nodes.
- class numba_dpex.core.passes.parfor_legalize_cfd_pass.ParforLegalizeCFDPassImpl(state)
Bases:
objectLegalizes the compute-follows-data based device attribute for parfor nodes.
DpnpNdArray array-expressions populate the type of the left-hand-side (LHS) of each expression as a default DpnpNdArray instance derived from the __array_ufunc__ method of DpnpNdArray class. The pass fixes the LHS type by properly applying compute follows data programming model. The pass first checks if the right-hand-side (RHS) DpnpNdArray arguments are on the same device, else raising a ExecutionQueueInferenceError. Once the RHS has been validated, the LHS type is updated.
The pass also updated the usm_type of the LHS based on a USM type propagation rule: device > shared > host. Thus, if the usm_type attribute of the RHS arrays are “device” and “shared” respectively, the LHS array’s usm_type attribute will be “device”.
Once the pass has identified a parfor with DpnpNdArrays and legalized it, the “lowerer” attribute of the parfor is set to
numba_dpex.core.passes.parfor_lowering_pass._lower_parfor_as_kernelso that the parfor node is lowered using Dpex’s lowerer.- inputUsmTypeIntToStr = {1: 'host', 2: 'shared', 3: 'device'}
- inputUsmTypeStrToInt = {'device': 3, 'host': 1, 'shared': 2}
- run()