Convert scf to openmp
convert_scf_to_openmp
ConvertParallel
dataclass
Bases: RewritePattern
Source code in xdsl/transforms/convert_scf_to_openmp.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
collapse: int | None
instance-attribute
nested: bool
instance-attribute
schedule: Literal['static', 'dynamic', 'auto'] | None
instance-attribute
chunk: int | None
instance-attribute
__init__(collapse: int | None, nested: bool, schedule: Literal['static', 'dynamic', 'auto'] | None, chunk: int | None) -> None
match_and_rewrite(loop: scf.ParallelOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/convert_scf_to_openmp.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
ConvertScfToOpenMPPass
dataclass
Bases: ModulePass
Convert scf.parallel loops to omp.wsloop constructs for parallel execution.
It currently does not support reduction.
Arguments (all optional):
-
collapse : int: specify a positive number of loops to collapse. By default, the full dimensionality of converted parallel loops is collapsed. This argument allows to take a 2D loop and only OMPize the first dimension, for example.
-
nested: bool: Set this to true to convert nested parallel loops. This is rarely a good idea, and is disabled by default. Note that setting it to true mimics MLIR's convert-scf-to-openmp.
-
schedule: {"static", "dynamic", "auto"}: Set the schedule used by the OMP loop. By default, none is set, leaving the decision to MLIR's omp lowering. At the time of writing, this means static.
-
chunk: int: Set the chunk size used by the OMP loop. By default, none is set. Note that the OMP dialect does not support setting a chunk size without a schedule; Thus selecting a chunk size without a schedule will use the static schedule.
Source code in xdsl/transforms/convert_scf_to_openmp.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
name = 'convert-scf-to-openmp'
class-attribute
instance-attribute
collapse: int | None = None
class-attribute
instance-attribute
nested: bool = False
class-attribute
instance-attribute
schedule: Literal['static', 'dynamic', 'auto'] | None = None
class-attribute
instance-attribute
chunk: int | None = None
class-attribute
instance-attribute
__init__(collapse: int | None = None, nested: bool = False, schedule: Literal['static', 'dynamic', 'auto'] | None = None, chunk: int | None = None) -> None
apply(ctx: Context, op: ModuleOp) -> None
Source code in xdsl/transforms/convert_scf_to_openmp.py
150 151 152 153 154 155 156 157 158 159 160 | |