File tree Expand file tree Collapse file tree 4 files changed +21
-6
lines changed
lib/Conversion/AffineToStandard
test/Conversion/AffineToStandard Expand file tree Collapse file tree 4 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -15,12 +15,12 @@ include "mlir/Pass/PassBase.td"
15
15
// AffineToStandard
16
16
//===----------------------------------------------------------------------===//
17
17
18
- def ConvertAffineToStandard : FunctionPass <"lower-affine"> {
18
+ def ConvertAffineToStandard : Pass <"lower-affine"> {
19
19
let summary = "Lower Affine operations to a combination of Standard and SCF "
20
20
"operations";
21
21
let description = [{
22
22
23
- Convert operations from the affine dialect into operations from the loop and
23
+ Convert operations from the affine dialect into operations from the SCF and
24
24
standard dialects.
25
25
26
26
`affine.for` operations are converted to `scf.for` operations that are free
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ std::unique_ptr<OperationPass<FuncOp>> createPipelineDataTransferPass();
57
57
// / Lowers affine control flow operations (ForStmt, IfStmt and AffineApplyOp)
58
58
// / to equivalent lower-level constructs (flow of basic blocks and arithmetic
59
59
// / primitives).
60
- std::unique_ptr<OperationPass<FuncOp> > createLowerAffinePass ();
60
+ std::unique_ptr<Pass > createLowerAffinePass ();
61
61
62
62
// / Creates a pass that transforms perfectly nested loops with independent
63
63
// / bounds into a single loop.
Original file line number Diff line number Diff line change @@ -672,21 +672,21 @@ void mlir::populateAffineToVectorConversionPatterns(
672
672
673
673
namespace {
674
674
class LowerAffinePass : public ConvertAffineToStandardBase <LowerAffinePass> {
675
- void runOnFunction () override {
675
+ void runOnOperation () override {
676
676
OwningRewritePatternList patterns;
677
677
populateAffineToStdConversionPatterns (patterns, &getContext ());
678
678
populateAffineToVectorConversionPatterns (patterns, &getContext ());
679
679
ConversionTarget target (getContext ());
680
680
target
681
681
.addLegalDialect <scf::SCFDialect, StandardOpsDialect, VectorDialect>();
682
- if (failed (applyPartialConversion (getFunction (), target, patterns)))
682
+ if (failed (applyPartialConversion (getOperation (), target, patterns)))
683
683
signalPassFailure ();
684
684
}
685
685
};
686
686
} // namespace
687
687
688
688
// / Lowers If and For operations within a function into their lower level CFG
689
689
// / equivalent blocks.
690
- std::unique_ptr<OperationPass<FuncOp> > mlir::createLowerAffinePass () {
690
+ std::unique_ptr<Pass > mlir::createLowerAffinePass () {
691
691
return std::make_unique<LowerAffinePass>();
692
692
}
Original file line number Diff line number Diff line change
1
+ // RUN: mlir-opt -pass-pipeline="gpu.module(lower-affine)" %s | FileCheck %s
2
+
3
+ #map0gpufunc = affine_map <(d0 ) -> (d0 )>
4
+ gpu.module @kernels {
5
+ gpu.func @foo (%arg0 : index , %arg1 : memref <?xf32 >) -> f32 {
6
+ %0 = affine.apply #map0gpufunc (%arg0 )
7
+ %1 = load %arg1 [%0 ] : memref <?xf32 >
8
+ gpu.return %1 : f32
9
+ }
10
+
11
+ // CHECK: gpu.func
12
+ // CHECK-SAME: %[[ARG0:.*]]: index
13
+ // CHECK-NOT: affine.apply
14
+ // CHECK: load %{{.*}}[%[[ARG0]]]
15
+ }
You can’t perform that action at this time.
0 commit comments