forked from openvinotoolkit/npu_plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ops.hpp
110 lines (91 loc) · 3.5 KB
/
ops.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
78
79
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
//
// Copyright (C) 2022 Intel Corporation.
// SPDX-License-Identifier: Apache 2.0
//
//
#pragma once
#include "vpux/compiler/core/ops_interfaces.hpp"
#include "vpux/compiler/dialect/IE/ops.hpp"
#include "vpux/compiler/dialect/IERT/ops.hpp"
#include "vpux/compiler/dialect/IERT/ops_interfaces.hpp"
#include "vpux/compiler/dialect/VPU/attributes.hpp"
#include "vpux/compiler/dialect/VPU/dialect.hpp"
#include "vpux/compiler/dialect/VPU/ops.hpp"
#include "vpux/compiler/dialect/VPUIP/dialect.hpp"
#include "vpux/compiler/dialect/VPUIP/ops_interfaces.hpp"
#include "vpux/compiler/dialect/VPUIP/types.hpp"
#include "vpux/compiler/dialect/const/ops.hpp"
#include <mlir/Dialect/Quant/QuantOps.h>
#include <mlir/Dialect/SCF/SCF.h>
#include <mlir/Dialect/StandardOps/IR/Ops.h>
#include <mlir/IR/BuiltinOps.h>
#include <mlir/IR/BuiltinTypes.h>
#include <mlir/IR/Dialect.h>
#include <mlir/IR/DialectImplementation.h>
#include <mlir/IR/SymbolTable.h>
#include <mlir/Interfaces/CopyOpInterface.h>
#include <mlir/Interfaces/SideEffectInterfaces.h>
//
// Generated
//
#define GET_OP_CLASSES
#include <vpux/compiler/dialect/VPUIP/generated/ops.hpp.inc>
//
// Operation verifiers
//
namespace vpux {
namespace VPUIP {
constexpr Bit FP16_SIZE = 16_Bit;
constexpr KB SHAVE_LIB_DATA_SIZE = 112_KB;
// According to the documentation, total transfer length (LEN) field is stored in 24 bits that means max value is 16MB
constexpr Byte DMA_LIMIT = 16_MB;
constexpr int64_t CMX_DMA_MAX_NUM_PLANES = 255;
mlir::LogicalResult verifyOp(ConvertUPAOp op);
mlir::LogicalResult verifyOp(SoftMaxUPAOp op);
mlir::LogicalResult verifyOp(PoolingUPAOp op);
mlir::LogicalResult verifyOp(FakeQuantizeUPAOp op);
mlir::LogicalResult verifyOp(QuantCastUPAOp op);
mlir::LogicalResult verifyOp(PerAxisTileUPAOp op);
mlir::LogicalResult verifyOp(ROIPoolingUPAOp op);
mlir::LogicalResult verifyOp(PSROIPoolingUPAOp op);
mlir::LogicalResult verifyOp(ProposalUPAOp op);
mlir::LogicalResult verifyOp(PermuteUPAOp op);
mlir::LogicalResult verifyOp(CTCGreedyDecoderUPAOp op);
mlir::LogicalResult verifyOp(MVNUPAOp op);
mlir::LogicalResult verifyOp(PadUPAOp op);
mlir::LogicalResult verifyOp(GatherUPAOp op);
mlir::LogicalResult verifyOp(YuvToRgbUPAOp op);
mlir::LogicalResult verifyOp(ConvolutionUPAOp op);
mlir::LogicalResult verifyOp(ReduceUPAOp op);
mlir::LogicalResult verifyOp(NCEClusterTaskOp op);
mlir::LogicalResult verifyOp(DepthToSpaceUPAOp op);
mlir::LogicalResult verifyOp(DPUTaskOp op);
mlir::LogicalResult verifyOp(SpaceToDepthUPAOp op);
mlir::LogicalResult verifyOp(NormUPAOp op);
mlir::LogicalResult verifyOp(ReverseSequenceUPAOp op);
mlir::LogicalResult verifyOp(TopKUPAOp op);
mlir::LogicalResult verifyPostOp(mlir::Operation* op);
mlir::LogicalResult verifyOp(NNDMAOp op);
mlir::LogicalResult verifyOp(SelectUPAOp op);
mlir::LogicalResult verifyOp(NCEClusterTilingOp op);
mlir::LogicalResult verifyOp(DistributedCastOp op);
void print(mlir::OpAsmPrinter& p, NCEClusterTilingOp op);
mlir::ParseResult parseNCEClusterTilingOp(mlir::OpAsmParser& parser, mlir::OperationState& result);
} // namespace VPUIP
} // namespace vpux
//
// Template methods
//
namespace vpux {
namespace VPUIP {
template <typename... Args>
VPUIP::PPETaskOp NCEClusterTaskOp::addPPETask(mlir::OpBuilder& builder, Args&&... args) {
if (ppe().empty()) {
ppe().emplaceBlock();
}
mlir::OpBuilder::InsertionGuard guard(builder);
builder.setInsertionPointToEnd(&ppe().front());
return builder.create<VPUIP::PPETaskOp>(getLoc(), std::forward<Args>(args)...);
}
} // namespace VPUIP
} // namespace vpux