Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aie to config #7

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions include/aie/Conversion/AIEToConfiguration/AIEToConfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//===- 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 "aie/Dialect/AIE/IR/AIEDialect.h"
#include "aie/Dialect/AIEX/IR/AIEXDialect.h"

#include "mlir/Pass/Pass.h"

#include <memory>

namespace xilinx::AIE {

std::unique_ptr<mlir::OperationPass<xilinx::AIE::DeviceOp>>
createConvertAIEToTransactionPass();

} // namespace xilinx::AIE

#endif // AIE_CONVERSION_AIETOCONFIGURATION_AIETOCONFIGURATION_H
5 changes: 5 additions & 0 deletions include/aie/Conversion/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 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
#
# (c) Copyright 2024 Advanced Micro Devices, Inc.
set(LLVM_TARGET_DEFINITIONS Passes.td)
mlir_tablegen(Passes.h.inc -gen-pass-decls -name Conversion)
mlir_tablegen(Passes.capi.h.inc -gen-pass-capi-header -prefix Conversion)
Expand Down
1 change: 1 addition & 0 deletions include/aie/Conversion/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef AIE_CONVERSION_PASSES_H
#define AIE_CONVERSION_PASSES_H

#include "aie/Conversion/AIEToConfiguration/AIEToConfiguration.h"
#include "aie/Conversion/AIEVecToLLVM/AIEVecToLLVM.h"
#include "aie/Conversion/PassesEnums.h.inc"

Expand Down
24 changes: 24 additions & 0 deletions include/aie/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,28 @@ def ConvertAIEVecToLLVM : Pass<"convert-aievec-to-llvm", "mlir::ModuleOp"> {
];
}

//===----------------------------------------------------------------------===//
// AIEToTransaction
//===----------------------------------------------------------------------===//

def ConvertAIEToTransaction : Pass<"convert-aie-to-transaction",
"xilinx::AIE::DeviceOp"> {
let summary = "Convert AIE dialect to npu transaction operations";
let description = [{
This pass converts aie.device operations to a sequence of transaction binary
operations (writes, masked writes, and block writes) that can be used to
to configure the npu device. The transaction operations are emitted as
`npu.write32`, `npu.maskwrite32`, and `npu.blockwrite` operations. A new
`aiex.runtime_sequence` operation is inserted into the `aie.device` to
contain the new transaction operations sequence.
}];
let constructor = "xilinx::AIE::createConvertAIEToTransactionPass()";
let dependentDialects = ["xilinx::AIE::AIEDialect",
"xilinx::AIEX::AIEXDialect"];
let options = [
Option<"clElfDir", "elf-dir", "std::string", /*default=*/"",
"Where to find ELF files">,
];
}

#endif // AIE_CONVERSION_PASSES
2 changes: 1 addition & 1 deletion include/aie/Dialect/AIEX/Transforms/AIEXPasses.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- AIEPasses.h ----------------------------------------------*- C++ -*-===//
//===- AIEXPasses.h ---------------------------------------------*- C++ -*-===//
//
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
12 changes: 8 additions & 4 deletions include/aie/Targets/AIETargets.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ mlir::LogicalResult AIETranslateShimSolution(mlir::ModuleOp module,
mlir::LogicalResult AIETranslateGraphXPE(mlir::ModuleOp module,
llvm::raw_ostream &);
mlir::LogicalResult AIETranslateToNPU(mlir::ModuleOp module,
llvm::raw_ostream &output);
mlir::LogicalResult AIETranslateToNPU(mlir::ModuleOp, std::vector<uint32_t> &);
llvm::raw_ostream &output,
llvm::StringRef sequenceName = "");
mlir::LogicalResult AIETranslateToNPU(mlir::ModuleOp, std::vector<uint32_t> &,
llvm::StringRef sequenceName = "");
mlir::LogicalResult
AIETranslateControlPacketsToUI32Vec(mlir::ModuleOp module,
llvm::raw_ostream &output);
llvm::raw_ostream &output,
llvm::StringRef sequenceName = "");
mlir::LogicalResult
AIETranslateControlPacketsToUI32Vec(mlir::ModuleOp, std::vector<uint32_t> &);
AIETranslateControlPacketsToUI32Vec(mlir::ModuleOp, std::vector<uint32_t> &,
llvm::StringRef sequenceName = "");
mlir::LogicalResult AIETranslateToLdScript(mlir::ModuleOp module,
llvm::raw_ostream &output,
int tileCol, int tileRow);
Expand Down
1 change: 1 addition & 0 deletions lib/CAPI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ add_mlir_public_c_api_library(AIECAPI
AIEX
AIEXTransforms
AIEXUtils
MLIRAIEToConfiguration
MLIRAIEVecDialect
MLIRAIEVecAIE1Dialect
MLIRAIEVecToLLVM
Expand Down
Loading
Loading