-
Notifications
You must be signed in to change notification settings - Fork 193
Expand file tree
/
Copy pathAIEToConfiguration.h
More file actions
87 lines (69 loc) · 3.09 KB
/
Copy pathAIEToConfiguration.h
File metadata and controls
87 lines (69 loc) · 3.09 KB
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
//===- AIEToConfiguration.h -------------------------------------*- C++ -*-===//
//
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.
//
//===----------------------------------------------------------------------===//
#ifndef AIE_CONVERSION_AIETOCONFIGURATION_AIETOCONFIGURATION_H
#define AIE_CONVERSION_AIETOCONFIGURATION_AIETOCONFIGURATION_H
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"
#include <memory>
namespace xilinx::AIE {
class DeviceOp;
// --------------------------------------------------------------------------
// Device configuration
// --------------------------------------------------------------------------
std::unique_ptr<mlir::OperationPass<xilinx::AIE::DeviceOp>>
createConvertAIEToTransactionPass();
std::unique_ptr<mlir::OperationPass<xilinx::AIE::DeviceOp>>
createConvertAIEToControlPacketsPass();
std::optional<mlir::ModuleOp>
convertTransactionBinaryToMLIR(mlir::MLIRContext *ctx,
std::vector<uint8_t> &binary);
// Generate transaction binary and insert configuration operations at a specific
// point
mlir::LogicalResult generateAndInsertConfigOps(xilinx::AIE::DeviceOp device,
mlir::Operation *insertionPoint,
llvm::StringRef clElfDir = "");
// --------------------------------------------------------------------------
// Device reset
// --------------------------------------------------------------------------
// Enum for specifying which tile types to reset
enum class ResetTileType : unsigned {
None = 0,
ShimNOC = 1 << 0,
MemTile = 1 << 1,
CoreTile = 1 << 2,
All = ShimNOC | MemTile | CoreTile
};
inline bool hasFlag(ResetTileType value, ResetTileType flag) {
return (static_cast<unsigned>(value) & static_cast<unsigned>(flag)) != 0;
}
// Enum for specifying when to reset
enum class ResetMode {
Never, // Never perform reset
IfUsed, // Reset only if the tile is used in the device
IfUsedFineGrained, // Reset only individual locks/connections that are used
IfChanged, // Reset only if the tile configuration changed from previous
IfChangedFineGrained, // Reset only individual locks/connections that changed
Always // Reset all tiles of the specified type
};
// Configuration for different reset operations
struct ResetConfig {
ResetTileType tileType;
ResetMode mode;
ResetConfig(ResetTileType tt = ResetTileType::None,
ResetMode m = ResetMode::Never)
: tileType(tt), mode(m) {}
};
// Insert reset operations
mlir::LogicalResult generateAndInsertResetOps(
xilinx::AIE::DeviceOp device, mlir::Operation *insertionPoint,
ResetConfig dmaConfig, ResetConfig switchConfig, ResetConfig lockConfig,
ResetConfig coreConfig, xilinx::AIE::DeviceOp previousDevice);
} // namespace xilinx::AIE
#endif // AIE_CONVERSION_AIETOCONFIGURATION_AIETOCONFIGURATION_H