MLIR-AIE
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Functions
a
b
c
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Variables
c
d
h
i
o
p
r
s
u
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
y
z
Typedefs
Enumerations
Enumerator
Files
File List
File Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
v
x
Functions
a
b
c
d
e
f
g
i
l
m
o
p
s
u
v
Typedefs
a
b
c
i
l
m
p
s
Enumerations
Enumerator
a
c
i
t
Macros
a
d
e
g
i
l
m
n
o
p
s
t
u
x
lib
Dialect
AIEX
Transforms
AIEXToStandard.cpp
Go to the documentation of this file.
1
//===- AIEXToStandard.cpp ---------------------------------------*- C++ -*-===//
2
//
3
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
// Copyright (C) 2023, Advanced Micro Devices, Inc.
8
//
9
//===----------------------------------------------------------------------===//
10
11
#include "
aie/Dialect/AIE/IR/AIEDialect.h
"
12
#include "
aie/Dialect/AIEX/IR/AIEXDialect.h
"
13
#include "
aie/Dialect/AIEX/Transforms/AIEXPasses.h
"
14
15
#include "mlir/IR/IRMapping.h"
16
#include "mlir/IR/PatternMatch.h"
17
#include "mlir/Pass/Pass.h"
18
#include "mlir/Tools/mlir-translate/MlirTranslateMain.h"
19
#include "mlir/Transforms/DialectConversion.h"
20
21
using namespace
mlir
;
22
using namespace
xilinx
;
23
using namespace
xilinx::AIE
;
24
using namespace
xilinx::AIEX
;
25
26
template
<
typename
MyAIEXOp>
27
struct
AIEXOpRemoval
:
OpConversionPattern
<MyAIEXOp> {
28
using
OpConversionPattern
<MyAIEXOp>
::OpConversionPattern
;
29
using
OpAdaptor
=
typename
MyAIEXOp::Adaptor;
30
ModuleOp &
module
;
31
32
AIEXOpRemoval
(MLIRContext *context, ModuleOp &m, PatternBenefit benefit = 1)
33
:
OpConversionPattern
<MyAIEXOp>(context, benefit), module(m) {}
32
AIEXOpRemoval
(MLIRContext *context, ModuleOp &m, PatternBenefit benefit = 1) {
…
}
34
35
LogicalResult
36
matchAndRewrite
(MyAIEXOp op,
OpAdaptor
adaptor,
37
ConversionPatternRewriter &rewriter)
const override
{
38
Operation *Op = op.getOperation();
39
rewriter.eraseOp(Op);
40
return
success();
41
}
36
matchAndRewrite
(MyAIEXOp op,
OpAdaptor
adaptor, {
…
}
42
};
27
struct
AIEXOpRemoval
:
OpConversionPattern
<MyAIEXOp> {
…
};
43
44
struct
AIEXToStandardPass
:
AIEXToStandardBase
<AIEXToStandardPass> {
45
void
runOnOperation
()
override
{
46
47
ModuleOp m = getOperation();
48
ConversionTarget target(getContext());
49
RewritePatternSet removepatterns(&getContext());
50
removepatterns.add<
AIEXOpRemoval<NpuDmaMemcpyNdOp>
>(m.getContext(), m);
51
removepatterns.add<
AIEXOpRemoval<NpuDmaWaitOp>
>(m.getContext(), m);
52
removepatterns.add<
AIEXOpRemoval<NpuPushQueueOp>
>(m.getContext(), m);
53
removepatterns.add<
AIEXOpRemoval<NpuWriteRTPOp>
>(m.getContext(), m);
54
removepatterns.add<
AIEXOpRemoval<NpuWrite32Op>
>(m.getContext(), m);
55
removepatterns.add<
AIEXOpRemoval<NpuSyncOp>
>(m.getContext(), m);
56
removepatterns.add<
AIEXOpRemoval<NpuWriteBdOp>
>(m.getContext(), m);
57
removepatterns.add<
AIEXOpRemoval<NpuAddressPatchOp>
>(m.getContext(), m);
58
59
if
(failed(applyPartialConversion(m, target, std::move(removepatterns))))
60
signalPassFailure();
61
}
45
void
runOnOperation
()
override
{
…
}
62
};
44
struct
AIEXToStandardPass
:
AIEXToStandardBase
<AIEXToStandardPass> {
…
};
63
64
std::unique_ptr<OperationPass<ModuleOp>>
AIEX::createAIEXToStandardPass
() {
65
return
std::make_unique<AIEXToStandardPass>();
66
}
64
std::unique_ptr<OperationPass<ModuleOp>>
AIEX::createAIEXToStandardPass
() {
…
}
AIEDialect.h
AIEXDialect.h
AIEXPasses.h
AIEXToStandardBase
OpConversionPattern
mlir
Definition
AIEVecToLLVM.h:18
xilinx::AIEX
Definition
AIETokenAnalysis.h:28
xilinx::AIEX::createAIEXToStandardPass
std::unique_ptr< mlir::OperationPass< mlir::ModuleOp > > createAIEXToStandardPass()
Definition
AIEXToStandard.cpp:64
xilinx::AIE
Include the generated interface declarations.
Definition
AIEToConfiguration.h:21
xilinx
Definition
AIEToConfiguration.h:21
AIEXOpRemoval
Definition
AIEXToStandard.cpp:27
AIEXOpRemoval::matchAndRewrite
LogicalResult matchAndRewrite(MyAIEXOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override
Definition
AIEXToStandard.cpp:36
AIEXOpRemoval::OpAdaptor
typename MyAIEXOp::Adaptor OpAdaptor
Definition
AIEXToStandard.cpp:29
AIEXOpRemoval::AIEXOpRemoval
ModuleOp & AIEXOpRemoval(MLIRContext *context, ModuleOp &m, PatternBenefit benefit=1)
Definition
AIEXToStandard.cpp:32
AIEXToStandardPass
Definition
AIEXToStandard.cpp:44
AIEXToStandardPass::runOnOperation
void runOnOperation() override
Definition
AIEXToStandard.cpp:45
Generated on Tue Apr 8 2025 15:03:09 for MLIR-AIE by
1.9.8