Linalg to csl
linalg_to_csl
ConvertLinalgGenericFMAPass
Bases: RewritePattern
Lowers linalg.generic fused multiply-adds to csl builtin ops.
Source code in xdsl/transforms/linalg_to_csl.py
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
match_and_rewrite(op: linalg.ops.GenericOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
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 | |
is_fma(op: linalg.ops.GenericOp) -> bool
staticmethod
Returns if a given generic op is a fused multiply-add
Source code in xdsl/transforms/linalg_to_csl.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
ConvertLinalgMinPass
Bases: RewritePattern
Lowers the linalg.min op to csl by negating the operands, performing max, and
again negating the operands as well as the result.
todo: scalar operands are currently not supported
Source code in xdsl/transforms/linalg_to_csl.py
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 161 | |
match_and_rewrite(op: linalg.ops.MinOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
ConvertLinalgAddPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
164 165 166 167 | |
match_and_rewrite(op: linalg.ops.AddOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
165 166 167 | |
ConvertLinalgSubPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
170 171 172 173 | |
match_and_rewrite(op: linalg.ops.SubOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
171 172 173 | |
ConvertLinalgMulPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
176 177 178 179 | |
match_and_rewrite(op: linalg.ops.MulOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
177 178 179 | |
ConvertLinalgMaxPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
182 183 184 185 | |
match_and_rewrite(op: linalg.ops.MaxOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
183 184 185 | |
LinalgToCsl
dataclass
Bases: ModulePass
Convert linalg ops to csl ops.
The linalg ops are required to be in 'memref mode', i.e., after bufferization has been applied.
Source code in xdsl/transforms/linalg_to_csl.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
name = 'linalg-to-csl'
class-attribute
instance-attribute
__init__() -> None
apply(ctx: Context, op: ModuleOp) -> None
Source code in xdsl/transforms/linalg_to_csl.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
match_op_for_precision(prec: Attribute, f16: type[csl.BuiltinDsdOp], f32: type[csl.BuiltinDsdOp]) -> type[csl.BuiltinDsdOp]
Returns the op type matching a given precision.
Source code in xdsl/transforms/linalg_to_csl.py
25 26 27 28 29 30 31 32 33 34 35 36 | |
get_scalar_const(op: SSAValue) -> FloatAttr | IntegerAttr | None
Returns the value of a scalar arith.constant, or None if not a constant or not scalar).
Source code in xdsl/transforms/linalg_to_csl.py
39 40 41 42 43 44 45 46 47 | |
transform_op(op: linalg.abstract_ops.NamedOperation, rewriter: PatternRewriter, f16: type[csl.BuiltinDsdOp], f32: type[csl.BuiltinDsdOp])
Source code in xdsl/transforms/linalg_to_csl.py
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 | |