Skip to content

Commit

Permalink
bug: (csl-lowering) Make multi-apply lowering work
Browse files Browse the repository at this point in the history
  • Loading branch information
n-io committed Dec 10, 2024
1 parent fd238ba commit cd122d9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xdsl/transforms/csl_stencil_bufferize.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def match_and_rewrite(self, op: csl_stencil.ApplyOp, rewriter: PatternRewriter,
# convert args
buf_args: list[SSAValue] = []
to_memrefs: list[Operation] = [buf_iter_arg := to_memref_op(op.accumulator)]
op.accumulator.replace_by_if(
buf_iter_arg.memref, lambda use: use.operation != buf_iter_arg
)
for arg in [*op.args_rchunk, *op.args_dexchng]:
if isa(arg.type, TensorType[Attribute]):
to_memrefs.append(new_arg := to_memref_op(arg))
Expand Down Expand Up @@ -385,6 +388,9 @@ def match_and_rewrite(self, op: arith.ConstantOp, rewriter: PatternRewriter, /):
class InjectApplyOutsIntoLinalgOuts(RewritePattern):
@op_type_rewrite_pattern
def match_and_rewrite(self, op: csl_stencil.ApplyOp, rewriter: PatternRewriter, /):
if not op.dest:
return

yld = op.done_exchange.block.last_op
assert isinstance(yld, csl_stencil.YieldOp)
new_dest: list[SSAValue] = []
Expand Down

0 comments on commit cd122d9

Please sign in to comment.