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
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.