Skip to content

Commit 05284a2

Browse files
authored
Remove obsolete ops and passes (Xilinx#618)
* Remove obsolete ops and passes * rm tests
1 parent 4dd631c commit 05284a2

File tree

13 files changed

+2
-1033
lines changed

13 files changed

+2
-1033
lines changed

mlir/include/air/Conversion/AIRPipeline.h

Lines changed: 0 additions & 42 deletions
This file was deleted.

mlir/include/air/Conversion/Passes.td

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -477,19 +477,6 @@ def AIRSplitDevices : Pass<"air-split-devices", "ModuleOp"> {
477477
];
478478
}
479479

480-
def AIRPipelineToAffine : Pass<"air-pipeline-to-affine", "ModuleOp"> {
481-
let summary = "Lower air.pipeline stages to affine.if";
482-
let constructor = "xilinx::air::createAIRPipelineToAffinePass()";
483-
let description = [{
484-
Lower air.pipeline stages to affine.if
485-
}];
486-
let options = [
487-
Option<"clLoweringType", "lowering-type", "std::string",
488-
/*default=*/"\"buffers\"",
489-
"Type of lowering to use for core-to-core communication. Can be 'buffer' or 'getput'">
490-
];
491-
}
492-
493480
def InsertEmptyLaunchOverHerd : Pass<"air-insert-launch-and-segment-around-herd", "ModuleOp"> {
494481
let summary = "Insert segment and launch ops around herd op";
495482
let constructor = "xilinx::air::createInsertEmptyLaunchOverHerdPass()";

mlir/include/air/Dialect/AIR/AIR.td

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -244,90 +244,6 @@ def air_HerdTerminatorOp : air_Op<"herd_terminator", [HasParent<"HerdOp">,
244244
let assemblyFormat = "attr-dict";
245245
}
246246

247-
def air_HerdPipelineOp : air_Op<"pipeline", [HasParent<"HerdOp">,
248-
AffineScope]>,
249-
Arguments<(ins)>,
250-
Results<(outs)> {
251-
let summary = "Define a pipeline";
252-
let description = [{
253-
Define a pipeline within an AIR Herd.
254-
}];
255-
256-
let regions = (region SizedRegion<1>:$body);
257-
let hasVerifier = 1;
258-
let assemblyFormat = [{
259-
attr-dict-with-keyword $body
260-
}];
261-
let extraClassDeclaration = [{
262-
// Return a vector of the air.pipeline.stage ops for this pipeline
263-
SmallVector<PipelineStageOp,8> getStages();
264-
}];
265-
}
266-
267-
def air_PipelineStageOp : air_Op<"pipeline.stage", [HasParent<"HerdPipelineOp">]>,
268-
Arguments<(ins Variadic<AnyType>:$opers)>, Results<(outs Variadic<AnyType>:$results)> {
269-
let summary = "Pipeline stage";
270-
let regions = (region SizedRegion<1>:$body);
271-
let description = [{
272-
Pipeline stage.
273-
}];
274-
let hasCustomAssemblyFormat = 1;
275-
let extraClassDeclaration = [{
276-
// Return the offset of this stage in the pipeline"
277-
unsigned getStageId();
278-
}];
279-
}
280-
281-
def air_PipelineYieldOp : air_Op<"pipeline.yield", [HasParent<"PipelineStageOp">,
282-
Pure, ReturnLike, Terminator]>,
283-
Arguments<(ins Variadic<AnyType>:$opers)>, Results<(outs)> {
284-
let summary = "Yield for air pipeline stages.";
285-
let description = [{
286-
A terminator operation for regions that appear in the body of
287-
`air.pipeline.stage` operation. The operation takes variable number of
288-
operands and produces no results. The operand number and types must
289-
match the signature of the `air.pipeline` that contains the operation.
290-
}];
291-
let assemblyFormat = [{
292-
($opers^)? attr-dict (`:` type($opers)^)?
293-
}];
294-
}
295-
296-
def air_PipelinePutOp : air_Op<"pipeline.put", []>,
297-
Arguments<(ins AnyType:$dst0, AnyType:$dst1, Variadic<AnyType>:$opers)>, Results<(outs)> {
298-
let summary = "Put for air pipeline stages.";
299-
let description = [{
300-
Experimental operation to represent copying data to another tile.
301-
Currently used internally by air-to-aie pass during pipeline lowering.
302-
}];
303-
let assemblyFormat = [{
304-
$dst0 $dst1 (`,` $opers^)? attr-dict `:` type($dst0) `,` type($dst1) (`,` type($opers)^)?
305-
}];
306-
}
307-
308-
def air_PipelineGetOp : air_Op<"pipeline.get", []>,
309-
Arguments<(ins AnyType:$src0, AnyType:$src1)>, Results<(outs Variadic<AnyType>:$results)> {
310-
let summary = "Get for air pipeline stages.";
311-
let description = [{
312-
Experimental operation to represent copying data from another tile.
313-
Currently used internally by air-to-aie pass during pipeline lowering.
314-
}];
315-
let assemblyFormat = [{
316-
$src0 $src1 attr-dict `:` type($src0) `,` type($src1) `->` type($results)
317-
}];
318-
}
319-
320-
def air_PipelineTerminatorOp : air_Op<"pipeline.terminator", [HasParent<"HerdPipelineOp">,
321-
Pure, Terminator]>,
322-
Arguments<(ins Variadic<AnyType>:$opers)>, Results<(outs)> {
323-
let summary = "Terminator for air pipeline regions.";
324-
let description = [{
325-
A terminator operation for regions that appear in the body of
326-
`air.pipeline` operation.
327-
}];
328-
let assemblyFormat = "attr-dict ($opers^ `:` type($opers))?";
329-
}
330-
331247
def air_DmaMemcpyNdOp: air_Op<"dma_memcpy_nd",
332248
[air_AsyncOpInterface,
333249
air_MemcpyInterface,

mlir/include/air/Transform/Passes.td

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,11 +1099,6 @@ def AIRExamplePass : Pass<"air-example-pass", "ModuleOp"> {
10991099
let constructor = "xilinx::air::createAIRExamplePass()";
11001100
}
11011101

1102-
def AIRSpecializeDma : Pass<"air-specialize-dma", "ModuleOp"> {
1103-
let summary = "Specialize dma operations";
1104-
let constructor = "xilinx::air::createAIRSpecializeDma()";
1105-
}
1106-
11071102
def AIRSpecializeDmaBroadcast : Pass<"air-specialize-dma-broadcast", "ModuleOp"> {
11081103
let summary = "Specialize dma operations for broadcast pattern";
11091104
let constructor = "xilinx::air::createAIRSpecializeDmaBroadcast()";
@@ -1114,11 +1109,6 @@ def AIRSpecializeDmaBroadcast : Pass<"air-specialize-dma-broadcast", "ModuleOp">
11141109
}];
11151110
}
11161111

1117-
def AIRPromoteUniformL1Dma : Pass<"air-promote-dma", "ModuleOp"> {
1118-
let summary = "promote uniform dma operations";
1119-
let constructor = "xilinx::air::createAIRPromoteUniformL1Dma()";
1120-
}
1121-
11221112
def AIRLinalgNamePass : Pass<"air-linalg-name", "ModuleOp"> {
11231113
let summary = "Give linalg ops a LinalgTransformMarker string attribute if they don't already have one";
11241114
let constructor = "xilinx::air::createAIRLinalgNamePass()";

mlir/lib/Conversion/AIRLoweringPass.cpp

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "air/Conversion/AIRLoweringPass.h"
10-
#include "air/Conversion/AIRPipeline.h"
1110
#include "air/Dialect/AIR/AIRDialect.h"
1211
#include "air/Dialect/AIRRt/AIRRtDialect.h"
1312
#include "air/Dialect/AIRRt/AIRRtOps.h"
@@ -279,59 +278,6 @@ class AIRHerdConversion : public ConversionPattern {
279278
}
280279
};
281280

282-
class AIRPipelineConversion : public ConversionPattern {
283-
public:
284-
explicit AIRPipelineConversion(MLIRContext *context)
285-
: ConversionPattern(air::HerdPipelineOp::getOperationName(), 1, context) {
286-
}
287-
288-
LogicalResult
289-
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
290-
ConversionPatternRewriter &rewriter) const override {
291-
auto pipeOp = cast<air::HerdPipelineOp>(op);
292-
Block &bb = pipeOp.getBody().front();
293-
rewriter.eraseOp(pipeOp.getBody().back().getTerminator());
294-
bb.getOperations().splice(Block::iterator(op), bb.getOperations());
295-
rewriter.eraseOp(op);
296-
return success();
297-
}
298-
};
299-
300-
class AIRPipelinePutConversion : public ConversionPattern {
301-
public:
302-
explicit AIRPipelinePutConversion(MLIRContext *context)
303-
: ConversionPattern(air::PipelinePutOp::getOperationName(), 1, context) {}
304-
305-
LogicalResult
306-
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
307-
ConversionPatternRewriter &rewriter) const override {
308-
rewriter.eraseOp(op);
309-
return success();
310-
}
311-
};
312-
313-
class AIRPipelineGetConversion : public ConversionPattern {
314-
public:
315-
explicit AIRPipelineGetConversion(MLIRContext *context)
316-
: ConversionPattern(air::PipelineGetOp::getOperationName(), 1, context) {}
317-
318-
LogicalResult
319-
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
320-
ConversionPatternRewriter &rewriter) const override {
321-
auto getOp = cast<air::PipelineGetOp>(op);
322-
SmallVector<Value, 2> gets;
323-
for (auto r : getOp.getResults()) {
324-
if (auto ty = llvm::dyn_cast<RankedTensorType>(r.getType()))
325-
gets.push_back(rewriter.create<bufferization::AllocTensorOp>(
326-
op->getLoc(), ty, ValueRange{}));
327-
else
328-
return failure();
329-
}
330-
rewriter.replaceOp(op, gets);
331-
return success();
332-
}
333-
};
334-
335281
class AIRWaitAllToAIRRtConversion : public OpConversionPattern<air::WaitAllOp> {
336282
public:
337283
using OpConversionPattern<air::WaitAllOp>::OpConversionPattern;
@@ -1136,32 +1082,6 @@ class AIRLoweringPass : public air::impl::AIRLoweringBase<AIRLoweringPass> {
11361082
signalPassFailure();
11371083
}
11381084

1139-
// Replace the PipelineStageOps first, followed by the
1140-
// HerdPipelineOps, then run the rest of the patterns.
1141-
// This avoids creating invalid intermediate code with respect
1142-
// to the herd->pipeline->stages nesting requirements.
1143-
1144-
// PipelineStageOp conversion
1145-
RewritePatternSet air_pipe_stage_patterns(context);
1146-
air_pipe_stage_patterns.insert<air::AIRPipeStageConversion>(
1147-
context, air::AIRPipeStageConversion::LoweringType::AllocBuffer);
1148-
if (failed(applyPartialConversion(module, target,
1149-
std::move(air_pipe_stage_patterns)))) {
1150-
emitError(UnknownLoc::get(context),
1151-
"error lowering air.pipeline.stage\n");
1152-
signalPassFailure();
1153-
}
1154-
1155-
// HerdPipelineOp conversion
1156-
RewritePatternSet air_pipe_patterns(context);
1157-
air_pipe_patterns.insert<AIRPipelineConversion, AIRPipelineGetConversion,
1158-
AIRPipelinePutConversion>(context);
1159-
if (failed(applyPartialConversion(module, target,
1160-
std::move(air_pipe_patterns)))) {
1161-
emitError(UnknownLoc::get(context), "error lowering air.pipeline\n");
1162-
signalPassFailure();
1163-
}
1164-
11651085
// DMA and HerdOp conversion
11661086
RewritePatternSet air_patterns(context);
11671087

@@ -1528,62 +1448,6 @@ class AIRLoweringPass : public air::impl::AIRLoweringBase<AIRLoweringPass> {
15281448
}
15291449
};
15301450

1531-
class AIRPipelineToAffinePass
1532-
: public air::impl::AIRPipelineToAffineBase<AIRPipelineToAffinePass> {
1533-
1534-
public:
1535-
AIRPipelineToAffinePass() = default;
1536-
AIRPipelineToAffinePass(const AIRPipelineToAffinePass &pass) {}
1537-
1538-
void getDependentDialects(::mlir::DialectRegistry &registry) const override {
1539-
registry.insert<affine::AffineDialect>();
1540-
}
1541-
1542-
void runOnOperation() override {
1543-
auto module = getOperation();
1544-
auto context = module.getContext();
1545-
1546-
ConversionTarget target(*context);
1547-
1548-
target.addLegalDialect<
1549-
LLVM::LLVMDialect, func::FuncDialect, arith::ArithDialect,
1550-
affine::AffineDialect, scf::SCFDialect, linalg::LinalgDialect,
1551-
memref::MemRefDialect, bufferization::BufferizationDialect,
1552-
airrt::AIRRtDialect, air::airDialect>();
1553-
1554-
target.addIllegalOp<air::PipelineStageOp, air::PipelineYieldOp>();
1555-
1556-
// PipelineStageOp conversion
1557-
RewritePatternSet air_pipe_stage_patterns(context);
1558-
auto loweringType =
1559-
air::AIRPipeStageConversion::LoweringType::PipelineGetPut;
1560-
if (clLoweringType == "buffer")
1561-
loweringType = air::AIRPipeStageConversion::LoweringType::AllocBuffer;
1562-
air_pipe_stage_patterns.insert<air::AIRPipeStageConversion>(context,
1563-
loweringType);
1564-
if (failed(applyPartialConversion(module, target,
1565-
std::move(air_pipe_stage_patterns)))) {
1566-
emitError(UnknownLoc::get(context),
1567-
"error lowering air.pipeline.stage\n");
1568-
signalPassFailure();
1569-
}
1570-
1571-
SmallVector<Operation *, 8> pipelines;
1572-
module.walk([&](air::HerdPipelineOp p) { pipelines.push_back(p); });
1573-
1574-
for (auto p : pipelines) {
1575-
auto pipeOp = cast<air::HerdPipelineOp>(p);
1576-
OpBuilder b(p);
1577-
Block &bb = pipeOp.getBody().front();
1578-
IRMapping remap;
1579-
bb.getTerminator()->erase();
1580-
for (auto &o : bb)
1581-
b.clone(o, remap);
1582-
p->erase();
1583-
}
1584-
}
1585-
};
1586-
15871451
} // namespace
15881452

15891453
namespace xilinx {
@@ -1593,9 +1457,5 @@ std::unique_ptr<mlir::Pass> createAIRLoweringPass() {
15931457
return std::make_unique<AIRLoweringPass>();
15941458
}
15951459

1596-
std::unique_ptr<mlir::Pass> createAIRPipelineToAffinePass() {
1597-
return std::make_unique<AIRPipelineToAffinePass>();
1598-
}
1599-
16001460
} // namespace air
16011461
} // namespace xilinx

0 commit comments

Comments
 (0)