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
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 131 | |
match_and_rewrite(op: linalg.GenericOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
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 | |
is_fma(op: linalg.GenericOp) -> bool
staticmethod
Returns if a given generic op is a fused multiply-add
Source code in xdsl/transforms/linalg_to_csl.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
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
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 162 | |
match_and_rewrite(op: linalg.MinOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
ConvertLinalgAddPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
165 166 167 168 | |
match_and_rewrite(op: linalg.AddOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
166 167 168 | |
ConvertLinalgSubPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
171 172 173 174 | |
match_and_rewrite(op: linalg.SubOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
172 173 174 | |
ConvertLinalgMulPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
177 178 179 180 | |
match_and_rewrite(op: linalg.MulOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
178 179 180 | |
ConvertLinalgMaxPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
183 184 185 186 | |
match_and_rewrite(op: linalg.MaxOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
184 185 186 | |
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
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
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
199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
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
26 27 28 29 30 31 32 33 34 35 36 37 | |
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
40 41 42 43 44 45 46 47 48 | |
transform_op(op: linalg.NamedOperation, rewriter: PatternRewriter, f16: type[csl.BuiltinDsdOp], f32: type[csl.BuiltinDsdOp])
Source code in xdsl/transforms/linalg_to_csl.py
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 | |