-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Enable AIEX dialect bindings * Replace 'Aie' prefix with 'AIE' in python cmake
- Loading branch information
Showing
8 changed files
with
108 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
declare_mlir_python_sources(AieCompilerPythonSources) | ||
declare_mlir_python_sources(AIECompilerPythonSources) | ||
|
||
declare_mlir_python_sources(AieCompilerPythonSources.Core | ||
declare_mlir_python_sources(AIECompilerPythonSources.Core | ||
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" | ||
ADD_TO_PARENT AieCompilerPythonSources | ||
ADD_TO_PARENT AIECompilerPythonSources | ||
SOURCES_GLOB | ||
aiecc/*.py | ||
*.py | ||
) | ||
|
||
add_mlir_python_modules(AieCompilerPythonModules | ||
add_mlir_python_modules(AIECompilerPythonModules | ||
ROOT_PREFIX "${AIE_PYTHON_PACKAGES_DIR}/aie/compiler" | ||
INSTALL_PREFIX "${AIE_PYTHON_INSTALL_DIR}/aie/compiler" | ||
DECLARED_SOURCES AieCompilerPythonSources | ||
DECLARED_SOURCES AIECompilerPythonSources | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//===- AiexBinding.td --------------------------------------*- tablegen -*-===// | ||
// | ||
// Copyright (C) 2023, Advanced Micro Devices, Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef AIEX_BINDING_TD | ||
#define AIEX_BINDING_TD | ||
|
||
include "mlir/Bindings/Python/Attributes.td" | ||
include "aie/Dialect/AIEX/IR/AIEX.td" | ||
|
||
#endif // AIEX_BINDING_TD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# ./python/aie/dialects/_AIEX_ops_ext.py -*- Python -*- | ||
|
||
# Copyright (C) 2023, Advanced Micro Devices, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
try: | ||
from ..mlir.ir import * | ||
except ImportError as e: | ||
raise RuntimeError("Error loading imports from extension module") from e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ./python/aie/dialects/aiex/__init__.py -*- Python -*- | ||
|
||
# Copyright (C) 2023, Advanced Micro Devices, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
from .._AIEX_ops_gen import * | ||
from ...mlir._mlir_libs._aieMlir import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (C) 2023, Advanced Micro Devices, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# RUN: python3 %s | FileCheck %s | ||
|
||
import aie | ||
from aie.mlir.ir import * | ||
from aie.dialects.aie import * | ||
from aie.dialects.aiex import * | ||
from aie.mlir.dialects import arith | ||
|
||
def constructAndPrintInModule(f): | ||
with Context() as ctx, Location.unknown(): | ||
aie.dialects.aiex.register_dialect(ctx) | ||
module = Module.create() | ||
print("\nTEST:", f.__name__) | ||
with InsertionPoint(module.body): | ||
f() | ||
print(module) | ||
|
||
|
||
# CHECK-LABEL: getTileOp | ||
# CHECK: AIEX.getTile | ||
@constructAndPrintInModule | ||
def getTileOp(): | ||
iTy = IndexType.get() | ||
four = arith.ConstantOp(iTy, 4) | ||
two = arith.ConstantOp(iTy, 2) | ||
GetTileOp(IndexType.get(), four, two) |