MLIR-AIE
AIEToConfiguration.h
Go to the documentation of this file.
1//===- AIEToConfiguration.h -------------------------------------*- 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) 2024, Advanced Micro Devices, Inc. All rights reserved.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef AIE_CONVERSION_AIETOCONFIGURATION_AIETOCONFIGURATION_H
12#define AIE_CONVERSION_AIETOCONFIGURATION_AIETOCONFIGURATION_H
13
14#include "mlir/IR/BuiltinOps.h"
15#include "mlir/Pass/Pass.h"
16#include <memory>
17
18namespace xilinx::AIE {
19
20class DeviceOp;
21
22// --------------------------------------------------------------------------
23// Device configuration
24// --------------------------------------------------------------------------
25
26// an enum to represent the output type of the transaction binary
31
32std::unique_ptr<mlir::OperationPass<xilinx::AIE::DeviceOp>>
34
35std::unique_ptr<mlir::OperationPass<xilinx::AIE::DeviceOp>>
37
38std::optional<mlir::ModuleOp>
39convertTransactionBinaryToMLIR(mlir::MLIRContext *ctx,
40 std::vector<uint8_t> &binary);
41
42// Generate transaction binary and insert configuration operations at the
43// current insertion point
44mlir::LogicalResult generateAndInsertConfigOps(
45 mlir::OpBuilder &builder, xilinx::AIE::DeviceOp device,
46 llvm::StringRef clElfDir = "",
49 std::string blockwrite_prefix = "config_blockwrite_data_");
50
51// --------------------------------------------------------------------------
52// Device reset
53// --------------------------------------------------------------------------
54
55// Enum for specifying which tile types to reset
56enum class ResetTileType : unsigned {
57 None = 0,
58 ShimNOC = 1 << 0,
59 MemTile = 1 << 1,
60 CoreTile = 1 << 2,
62};
63
64inline bool hasFlag(ResetTileType value, ResetTileType flag) {
65 return (static_cast<unsigned>(value) & static_cast<unsigned>(flag)) != 0;
66}
67
68// Enum for specifying when to reset
69enum class ResetMode {
70 Never, // Never perform reset
71 IfUsed, // Reset only if the tile is used in the device
72 IfUsedFineGrained, // Reset only individual locks/connections that are used
73 IfChanged, // Reset only if the tile configuration changed from previous
74 IfChangedFineGrained, // Reset only individual locks/connections that changed
75 Always // Reset all tiles of the specified type
76};
77
78// Configuration for different reset operations
87
88// Insert reset operations at the current insertion point
89mlir::LogicalResult generateAndInsertResetOps(
90 mlir::OpBuilder &builder, xilinx::AIE::DeviceOp device,
91 ResetConfig dmaConfig, ResetConfig switchConfig, ResetConfig lockConfig,
92 ResetConfig coreConfig, xilinx::AIE::DeviceOp previousDevice);
93
94} // namespace xilinx::AIE
95
96#endif // AIE_CONVERSION_AIETOCONFIGURATION_AIETOCONFIGURATION_H
Include the generated interface declarations.
bool hasFlag(ResetTileType value, ResetTileType flag)
mlir::LogicalResult generateAndInsertResetOps(mlir::OpBuilder &builder, xilinx::AIE::DeviceOp device, ResetConfig dmaConfig, ResetConfig switchConfig, ResetConfig lockConfig, ResetConfig coreConfig, xilinx::AIE::DeviceOp previousDevice)
std::unique_ptr< mlir::OperationPass< xilinx::AIE::DeviceOp > > createConvertAIEToTransactionPass()
mlir::LogicalResult generateAndInsertConfigOps(mlir::OpBuilder &builder, xilinx::AIE::DeviceOp device, llvm::StringRef clElfDir="", AIEToConfigurationOutputType outputType=AIEToConfigurationOutputType::Transaction, std::string blockwrite_prefix="config_blockwrite_data_")
std::optional< mlir::ModuleOp > convertTransactionBinaryToMLIR(mlir::MLIRContext *ctx, std::vector< uint8_t > &binary)
std::unique_ptr< mlir::OperationPass< xilinx::AIE::DeviceOp > > createConvertAIEToControlPacketsPass()
ResetConfig(ResetTileType tt=ResetTileType::None, ResetMode m=ResetMode::Never)