forked from Xilinx/mlir-aie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·70 lines (56 loc) · 2.17 KB
/
Makefile
File metadata and controls
executable file
·70 lines (56 loc) · 2.17 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
##===- Makefile -----------------------------------------------------------===##
#
# This file 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.
#
##===----------------------------------------------------------------------===##
srcdir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
include ${srcdir}/../../makefile-common
targetname = vector_vector_modulo
devicename ?= $(if $(filter 1,$(NPU2)),npu2,npu)
col = 0
aie_py_src=${targetname}.py
use_placed?=0
ifeq (${use_placed}, 1)
aie_py_src=${targetname}_placed.py
endif
all: build/final.xclbin
build/aie.mlir: ${srcdir}/${aie_py_src}
mkdir -p ${@D}
python3 $< ${devicename} ${col} > $@
build/final.xclbin: build/aie.mlir
mkdir -p ${@D}
cd ${@D} && aiecc --aie-generate-xclbin --aie-generate-npu-insts --no-compile-host \
--no-xchesscc --no-xbridge \
--xclbin-name=${@F} --npu-insts-name=insts.bin ${<F}
${targetname}.exe: ${srcdir}/test.cpp
rm -rf _build
mkdir -p _build
cd _build && ${powershell} cmake `${getwslpath} ${srcdir}` -DTARGET_NAME=${targetname}
cd _build && ${powershell} cmake --build . --config Release
ifeq "${powershell}" "powershell.exe"
cp _build/${targetname}.exe $@
else
cp _build/${targetname} $@
endif
# Changing variables when we target VCK5000
ACDC_AIE = $(dir $(shell which aie-opt))/..
vck5000: devicename=xcvc1902
vck5000: col=6
vck5000: build/aie.mlir
aiecc --xchesscc --link_against_hsa --host-target=x86_64-amd-linux-gnu build/aie.mlir \
-I/opt/xaiengine/include \
-I${srcdir}/../../../install/runtime_lib/x86_64-hsa/test_lib/include \
-L/opt/xaiengine/lib \
-L/lib/x86_64-linux-gnu/ \
${srcdir}/test_vck5000.cpp \
${srcdir}/../../../install/runtime_lib/x86_64-hsa/test_lib/src/test_library.cpp \
-Wl,-R/opt/xaiengine/lib \
-Wl,--whole-archive -Wl,--no-whole-archive -lstdc++ -ldl -lelf -o test.elf
run: ${targetname}.exe build/final.xclbin
${powershell} ./$< -x build/final.xclbin -i build/insts.bin -k MLIR_AIE
clean:
rm -rf build _build inst aie.mlir.prj core_* test.elf ${targetname}.exe