Skip to content

Commit 8aede29

Browse files
committed
Initial commit
0 parents  commit 8aede29

File tree

110 files changed

+16935
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+16935
-0
lines changed

.clang-format

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Licensed under the Apache License, Version 2.0 (the License); you may
2+
# not use this file except in compliance with the License.
3+
#
4+
# Unless required by applicable law or agreed to in writing, software
5+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
6+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7+
# See the License for the specific language governing permissions and
8+
# limitations under the License.
9+
#
10+
11+
# Licensed under the Apache License, Version 2.0 (the License); you may
12+
# not use this file except in compliance with the License.
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
16+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
21+
# SPDX-FileCopyrightText: Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved.
22+
#
23+
# SPDX-License-Identifier: Apache-2.0
24+
25+
---
26+
Language: Cpp
27+
# Base style
28+
BasedOnStyle: LLVM
29+
30+
# Line length
31+
ColumnLimit: 120
32+
33+
# Indentation
34+
IndentWidth: 4
35+
UseTab: Never
36+
37+
# Braces
38+
BreakBeforeBraces: Linux
39+
AllowShortIfStatementsOnASingleLine: false
40+
AllowShortLoopsOnASingleLine: false
41+
AllowShortFunctionsOnASingleLine: Empty
42+
43+
# Spacing
44+
SpaceBeforeParens: ControlStatements
45+
SpaceInEmptyParentheses: false
46+
SpacesInContainerLiterals: false
47+
SpacesInParentheses: false
48+
SpacesInSquareBrackets: false
49+
50+
# Alignment
51+
AlignConsecutiveAssignments: false
52+
AlignConsecutiveDeclarations: false
53+
AlignTrailingComments: true
54+
55+
# Include sorting
56+
SortIncludes: true
57+
IncludeBlocks: Regroup
58+
59+
# Other formatting options
60+
AllowAllParametersOfDeclarationOnNextLine: false
61+
BinPackParameters: false
62+
BinPackArguments: false
63+
ConstructorInitializerAllOnOneLineOrOnePerLine: true

.github/workflows/ci-lint.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Licensed under the Apache License, Version 2.0 (the License); you may
2+
# not use this file except in compliance with the License.
3+
#
4+
# Unless required by applicable law or agreed to in writing, software
5+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
6+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7+
# See the License for the specific language governing permissions and
8+
# limitations under the License.
9+
#
10+
11+
# Licensed under the Apache License, Version 2.0 (the License); you may
12+
# not use this file except in compliance with the License.
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
16+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
21+
# SPDX-FileCopyrightText: Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved.
22+
#
23+
# SPDX-License-Identifier: Apache-2.0
24+
25+
26+
name: CI - Linting
27+
28+
on:
29+
push:
30+
pull_request:
31+
workflow_dispatch:
32+
33+
concurrency:
34+
group: ${{ github.workflow }}-${{ github.ref }}
35+
cancel-in-progress: true
36+
37+
jobs:
38+
Linting:
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Checkout Repo
43+
uses: actions/checkout@v3
44+
- name: Install dependencies
45+
run: |
46+
apt-get update && apt-get install -y clang-format
47+
pip install reuse black
48+
49+
- name: Check Licenses
50+
if: success() || failure()
51+
shell: bash
52+
run: |
53+
reuse lint
54+
55+
- name: Format Python
56+
if: success() || failure()
57+
run: |
58+
black --diff .
59+
black --check .
60+
61+
- name: Format C++
62+
if: success() || failure()
63+
run: |
64+
python scripts/clang-format-wrapper.py --diff
65+
python scripts/clang-format-wrapper.py --check
66+

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Licensed under the Apache License, Version 2.0 (the License); you may
2+
# not use this file except in compliance with the License.
3+
#
4+
# Unless required by applicable law or agreed to in writing, software
5+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
6+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7+
# See the License for the specific language governing permissions and
8+
# limitations under the License.
9+
#
10+
11+
# Licensed under the Apache License, Version 2.0 (the License); you may
12+
# not use this file except in compliance with the License.
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
16+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
21+
# SPDX-FileCopyrightText: Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved.
22+
#
23+
# SPDX-License-Identifier: Apache-2.0
24+
25+
/my_install*
26+
/ironenv*
27+
/cmakeModules*
28+
.vscode
29+
__pycache__
30+
.DS_Store
31+
**/CMakeFiles
32+
# **.cmake
33+
*.bin
34+
build/*
35+
**/_build/**
36+
**/build/**
37+
*.exe
38+
*.csv
39+
secret_github_token
40+
id_ed25519
41+
id_ed25519.pub
42+
*.log

.reuse/templates/ApacheAMD.jinja2

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Licensed under the Apache License, Version 2.0 (the License); you may
2+
not use this file except in compliance with the License.
3+
4+
Unless required by applicable law or agreed to in writing, software
5+
distributed under the License is distributed on an AS IS BASIS, WITHOUT
6+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7+
See the License for the specific language governing permissions and
8+
limitations under the License.
9+
10+
Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved.
11+
12+
{% for copyright_line in copyright_lines %}
13+
{{ copyright_line }}
14+
{% endfor %}
15+
{% for contributor_line in contributor_lines %}
16+
SPDX-FileContributor: {{ contributor_line }}
17+
{% endfor %}
18+
19+
{% for expression in spdx_expressions %}
20+
SPDX-License-Identifier: {{ expression }}
21+
{% endfor %}

CMakeLists.txt

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Licensed under the Apache License, Version 2.0 (the License); you may
2+
# not use this file except in compliance with the License.
3+
#
4+
# Unless required by applicable law or agreed to in writing, software
5+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
6+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7+
# See the License for the specific language governing permissions and
8+
# limitations under the License.
9+
#
10+
11+
# Licensed under the Apache License, Version 2.0 (the License); you may
12+
# not use this file except in compliance with the License.
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
16+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
21+
# SPDX-FileCopyrightText: Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved.
22+
#
23+
# SPDX-License-Identifier: Apache-2.0
24+
25+
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
26+
27+
project(
28+
IRONCLAD
29+
VERSION 0.1.0
30+
DESCRIPTION "IRONCLAD"
31+
HOMEPAGE_URL "https://gitenterprise.xilinx.com/XRLabs/ironclad"
32+
LANGUAGES CXX C
33+
)
34+
35+
# Options
36+
set(IRONCLAD_AIE_TARGET "aie2p" CACHE STRING "AIE architecture, select either aie2 or aie2p")
37+
if(IRONCLAD_AIE_TARGET STREQUAL aie2)
38+
set(DEVICE npu)
39+
else()
40+
set(DEVICE npu2)
41+
endif()
42+
43+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
44+
45+
# Find IRON and Peano Packages
46+
# Use the Python in your active venv
47+
find_package(Python3 COMPONENTS Interpreter REQUIRED)
48+
49+
set(IRONCLAD_PEANO_DIR "$ENV{PEANO_INSTALL_DIR}" CACHE PATH "Peano install dir")
50+
if (NOT IRONCLAD_PEANO_DIR)
51+
execute_process(
52+
COMMAND ${Python3_EXECUTABLE} -c "import aie.utils.config; print(aie.utils.config.peano_install_dir());"
53+
OUTPUT_VARIABLE IRONCLAD_PEANO_DIR
54+
OUTPUT_STRIP_TRAILING_WHITESPACE
55+
)
56+
endif()
57+
if(NOT IRONCLAD_PEANO_DIR)
58+
message(FATAL_ERROR "Could not find Peano install dir. Please set the environment variable PEANO_INSTALL_DIR or install the llvm-aie wheel.")
59+
endif()
60+
61+
set(IRONCLAD_MLIR_AIE_DIR "$ENV{MLIR_AIE_INSTALL_DIR}" CACHE PATH "MLIR AIE install dir")
62+
if (NOT IRONCLAD_MLIR_AIE_DIR)
63+
execute_process(
64+
COMMAND ${Python3_EXECUTABLE} -c "import aie.utils.config; print(aie.utils.config.root_path());"
65+
OUTPUT_VARIABLE IRONCLAD_MLIR_AIE_DIR
66+
OUTPUT_STRIP_TRAILING_WHITESPACE
67+
)
68+
endif()
69+
if(NOT IRONCLAD_MLIR_AIE_DIR)
70+
message(FATAL_ERROR "Could not find Peano install dir. Please set the environment variable MLIR_AIE_INSTALL_DIR or install the mlir-aie wheel.")
71+
endif()
72+
73+
# Set your original cache variables to these resolved paths
74+
set(IRONCLAD_MLIR_AIE_RUNTIME_DIR "${IRONCLAD_MLIR_AIE_DIR}/runtime_lib/x86_64/test_lib/" CACHE PATH "Path to built/installed test_lib from MLIR_AIE")
75+
76+
# More Options
77+
option(BUILD_EXAMPLES "Build examples" ON)
78+
option(EXTENSIVE_TESTING "Generate a larger number of examples and tests" OFF)
79+
80+
message(STATUS "IRONCLAD_PEANO_DIR: ${IRONCLAD_PEANO_DIR}")
81+
message(STATUS "IRONCLAD_MLIR_AIE_DIR: ${IRONCLAD_MLIR_AIE_DIR}")
82+
message(STATUS "IRONCLAD_MLIR_AIE_RUNTIME_DIR: ${IRONCLAD_MLIR_AIE_RUNTIME_DIR}")
83+
84+
# CMake modules
85+
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_LIST_DIR}/cmake/Modules)
86+
include(AIEConfig)
87+
include(AIECITest)
88+
89+
# Packages
90+
find_package(xrt REQUIRED)
91+
92+
# C++ library
93+
include(${PROJECT_SOURCE_DIR}/cmake/IroncladCompilerOptions.cmake)
94+
95+
add_library(ironclad INTERFACE)
96+
add_library(ironclad::ironclad ALIAS ironclad)
97+
98+
target_include_directories(ironclad SYSTEM INTERFACE
99+
${XRT_INCLUDE_DIRS}
100+
${MLIR_AIE_INSTALL_DIR}/include
101+
)
102+
target_link_libraries(ironclad INTERFACE XRT::xrt_coreutil)
103+
target_compile_definitions(ironclad INTERFACE KERNELS_BIN_PATH="${KERNELS_BIN_PATH}")
104+
ironclad_compiler_warnings(ironclad)
105+
106+
# Add kernels
107+
add_subdirectory(aie_kernels)
108+
109+
# Add examples
110+
# Pass the architecure to support aie2p
111+
if (BUILD_EXAMPLES)
112+
include(cmake/IroncladExamples.cmake)
113+
add_subdirectory(example)
114+
endif()
115+
116+
generate_aie_ci_test_list("ci_tests.py")

0 commit comments

Comments
 (0)