Skip to content

Commit

Permalink
Updated Makefile for trace (#2035)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackl-xilinx authored Feb 6, 2025
1 parent 4c71d38 commit b836d01
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
24 changes: 22 additions & 2 deletions programming_examples/ml/eltwise_add/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ trace_size = 8192
aie_py_src=${targetname}.py
use_alt?=0

CHESS ?= false

ifeq (${use_alt}, 1)
aie_py_src=${targetname}_alt.py
endif
Expand All @@ -28,7 +30,11 @@ VPATH := ${srcdir}/../../../aie_kernels/aie2

build/%.o: %.cc
mkdir -p ${@D}
ifeq ($(CHESS), true)
cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -c $< -o ${@F}
else
cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -c $< -o ${@F}
endif

build/aie.mlir: ${srcdir}/${aie_py_src}
mkdir -p ${@D}
Expand All @@ -40,15 +46,25 @@ build/aie_trace.mlir: ${srcdir}/${aie_py_src}

build/final.xclbin: build/aie.mlir build/add.o
mkdir -p ${@D}
ifeq ($(CHESS), true)
cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \
--xclbin-name=${@F} --npu-insts-name=insts.txt ${<F}
else
cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \
--no-xchesscc --no-xbridge \
--xclbin-name=${@F} --npu-insts-name=insts.txt ${<F}
endif

build/final_trace.xclbin: build/aie_trace.mlir build/add.o
mkdir -p ${@D}
ifeq ($(CHESS), true)
cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \
--no-xchesscc --no-xbridge \
--xclbin-name=${@F} --npu-insts-name=insts.txt ${<F}
else
cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \
--xclbin-name=${@F} --npu-insts-name=insts.txt ${<F}
endif

${targetname}.exe: ${srcdir}/test.cpp
rm -rf _build
Expand All @@ -67,7 +83,11 @@ run: ${targetname}.exe build/final.xclbin

trace: ${targetname}.exe build/final_trace.xclbin
${powershell} ./$< -x build/final_trace.xclbin -i build/insts.txt -k MLIR_AIE -t ${trace_size}
../../utils/parse_eventIR.py --filename trace.txt --mlir build/aie_trace.mlir --colshift 1 > parse_eventIR_vs.json
../../utils/parse_trace.py --filename trace.txt --mlir build/aie_trace.mlir --colshift 1 > trace_eltwise_add.json


clean_trace:
rm -rf trace.txt trace_eltwise_add.json

clean:
clean: clean_trace
rm -rf build _build ${targetname}.exe
16 changes: 15 additions & 1 deletion programming_examples/ml/relu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ trace_size = 8192
aie_py_src=relu.py
use_alt?=0

CHESS ?= false

ifeq (${use_alt}, 1)
aie_py_src=relu_alt.py
endif
Expand All @@ -28,7 +30,11 @@ VPATH := ${srcdir}/../../../aie_kernels/aie2

build/%.o: %.cc
mkdir -p ${@D}
ifeq ($(CHESS), true)
cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -c $< -o ${@F};
else
cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -c $< -o ${@F}
endif

build/aie.mlir: ${srcdir}/${aie_py_src}
mkdir -p ${@D}
Expand All @@ -46,9 +52,14 @@ build/final.xclbin: build/aie.mlir build/relu.o

build/final_trace.xclbin: build/aie_trace.mlir build/relu.o
mkdir -p ${@D}
ifeq ($(CHESS), true)
cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \
--xclbin-name=${@F} --npu-insts-name=insts.txt ${<F}
else
cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \
--no-xchesscc --no-xbridge \
--xclbin-name=${@F} --npu-insts-name=insts.txt ${<F}
endif

${targetname}.exe: ${srcdir}/test.cpp
rm -rf _build
Expand All @@ -68,5 +79,8 @@ trace: ${targetname}.exe build/final_trace.xclbin
${powershell} ./$< -x build/final_trace.xclbin -i build/insts.txt -k MLIR_AIE -t ${trace_size}
../../utils/parse_trace.py --filename trace.txt --mlir build/aie_trace.mlir --colshift 1 > trace_relu.json

clean:
clean_trace:
rm -rf trace.txt trace_relu.json

clean: clean_trace
rm -rf build _build ${targetname}.exe
7 changes: 5 additions & 2 deletions programming_examples/ml/softmax/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ profile: ${targetname}.exe build/final.xclbin

trace: ${targetname}.exe build/final_trace.xclbin
${powershell} ./$< -x build/final_trace.xclbin -i build/insts.txt -k MLIR_AIE -t ${trace_size}
../../utils/parse_eventIR.py --filename trace.txt --mlir build/aie_trace.mlir --colshift 1 > parse_eventIR_vs.json
../../utils/parse_trace.py --filename trace.txt --mlir build/aie_trace.mlir --colshift 1 > trace_softmax.json

clean:
clean_trace:
rm -rf trace.txt trace_softmax.json

clean: clean_trace
rm -rf build _build ${targetname}.exe

0 comments on commit b836d01

Please sign in to comment.