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 | |
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 | |
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
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
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
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 | |
match_and_rewrite(op: linalg.ops.MinOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
ConvertLinalgAddPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
160 161 162 163 | |
match_and_rewrite(op: linalg.ops.AddOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
161 162 163 | |
ConvertLinalgSubPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
166 167 168 169 | |
match_and_rewrite(op: linalg.ops.SubOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
167 168 169 | |
ConvertLinalgMulPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
172 173 174 175 | |
match_and_rewrite(op: linalg.ops.MulOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
173 174 175 | |
ConvertLinalgMaxPass
Bases: RewritePattern
Source code in xdsl/transforms/linalg_to_csl.py
178 179 180 181 | |
match_and_rewrite(op: linalg.ops.MaxOp, rewriter: PatternRewriter)
Source code in xdsl/transforms/linalg_to_csl.py
179 180 181 | |
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
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
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
194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
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 | |