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

Edge detect #952

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions reference_designs/ipu-xrt/makefile-common
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ VITIS_AIETOOLS_DIR ?= ${VITIS_ROOT}/aietools
VITIS_AIE_INCLUDE_DIR ?= ${VITIS_ROOT}/aietools/data/versal_prod/lib
VITIS_AIE2_INCLUDE_DIR ?= ${VITIS_ROOT}/aietools/data/aie_ml/lib

export XILINX_VITIS_AIETOOLS = ${VITIS_AIETOOLS_DIR}

CHESSCC1_FLAGS = -f -p me -P ${VITIS_AIE_INCLUDE_DIR} -I ${VITIS_AIETOOLS_DIR}/include
CHESSCC2_FLAGS = -f -p me -P ${VITIS_AIE2_INCLUDE_DIR} -I ${VITIS_AIETOOLS_DIR}/include -D__AIENGINE__=2 -D__AIEARCH__=20

# Compile with peano, link with xbridge
CLANG_CHESSLIBC_FLAGS = --target=aie2 -I ${VITIS_AIETOOLS_DIR}/include -I ${VITIS_AIETOOLS_DIR}/include/adf -I ${VITIS_AIETOOLS_DIR}/include/aie_api -D_LIBCPP_HAS_THREAD_API_PTHREAD --std=c++2a -O2 -fno-jump-tables -Wno-deprecated-declarations
# Compile with peano, link with lld
CLANG_FLAGS = --target=aie2-none-elf -I ${VITIS_AIETOOLS_DIR}/include -D_LIBCPP_HAS_THREAD_API_PTHREAD --std=c++2a -O2 -fno-jump-tables -Wno-deprecated-declarations
CHESS_FLAGS = -P ${VITIS_AIE_INCLUDE_DIR}

CHESSCCWRAP1_FLAGS = aie -I ${VITIS_AIETOOLS_DIR}/include
Expand Down
51 changes: 48 additions & 3 deletions reference_designs/ipu-xrt/vision_pipelines/edge_detect/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ EDGEDETECT_HEIGHT = 1080

targetname = edgeDetect

all: build/final_${EDGEDETECT_WIDTH}.xclbin
default: peano

all: peano xchesscc peanoxbridge

mlir: build/aie2_lineBased_8b_${EDGEDETECT_WIDTH}.mlir
peano: build/final_${EDGEDETECT_WIDTH}.xclbin
xchesscc: build_xchesscc/final_${EDGEDETECT_WIDTH}.xclbin
peanoxbridge: build_peanoxbridge/final_${EDGEDETECT_WIDTH}.xclbin

PEANO = /root/acdc/build/install/peano/bin/clang++
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you get rid of this absolute path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah, good point. Really all of those makefiles need to go.

build/%.cc.o: %.cc
mkdir -p ${@D}
cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -c $(<:%=../%) -o ${@F}
@mkdir -p ${@D}
cd ${@D} && ${PEANO} ${CLANG_FLAGS} -DBIT_WIDTH=8 -c $(<:%=../%) -o ${@F}

build/combined_gray2rgba_addWeighted.a: build/gray2rgba.cc.o build/addWeighted.cc.o
mkdir -p ${@D}
Expand All @@ -42,6 +48,45 @@ build/final_${EDGEDETECT_WIDTH}.xclbin: build/aie2_lineBased_8b_${EDGEDETECT_WID
cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-ipu --no-compile-host \
--xclbin-name=${@F} --ipu-insts-name=insts.txt $(<:%=../%)

XCHESSCC_OBJS = build_xchesscc/rgba2gray.cc.o \
build_xchesscc/gray2rgba.cc.o \
build_xchesscc/filter2d.cc.o \
build_xchesscc/threshold.cc.o \
build_xchesscc/addWeighted.cc.o \
build_xchesscc/combined_gray2rgba_addWeighted.a

build_xchesscc/%.cc.o: %.cc
@mkdir -p ${@D}
cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} +w ${@F}.work -DBIT_WIDTH=8 -c $(<:%=../%) -o ${@F}

build_xchesscc/combined_gray2rgba_addWeighted.a: build_xchesscc/gray2rgba.cc.o build_xchesscc/addWeighted.cc.o
mkdir -p ${@D}
ar rvs $@ $< $(word 2,$^)

build_xchesscc/final_${EDGEDETECT_WIDTH}.xclbin: build/aie2_lineBased_8b_${EDGEDETECT_WIDTH}.mlir ${XCHESSCC_OBJS}
mkdir -p ${@D}
cd ${@D} && aiecc.py --xchesscc --xbridge --aie-generate-cdo --aie-generate-ipu --no-compile-host \
--xclbin-name=${@F} --ipu-insts-name=insts.txt $(<:%=../%)

PEANOXBRIDGE_OBJS = build_peanoxbridge/rgba2gray.cc.o \
build_peanoxbridge/gray2rgba.cc.o \
build_peanoxbridge/filter2d.cc.o \
build_peanoxbridge/threshold.cc.o \
build_peanoxbridge/addWeighted.cc.o \
build_peanoxbridge/combined_gray2rgba_addWeighted.a
build_peanoxbridge/%.cc.o: %.cc
@mkdir -p ${@D}
cd ${@D} && ${PEANO} ${CLANG_CHESSLIBC_FLAGS} -DBIT_WIDTH=8 -c $(<:%=../%) -o ${@F}

build_peanoxbridge/combined_gray2rgba_addWeighted.a: build_peanoxbridge/gray2rgba.cc.o build_peanoxbridge/addWeighted.cc.o
mkdir -p ${@D}
ar rvs $@ $< $(word 2,$^)

build_peanoxbridge/final_${EDGEDETECT_WIDTH}.xclbin: build/aie2_lineBased_8b_${EDGEDETECT_WIDTH}.mlir ${PEANOXBRIDGE_OBJS}
mkdir -p ${@D}
cd ${@D} && aiecc.py --xbridge --aie-generate-cdo --aie-generate-ipu --no-compile-host \
--xclbin-name=${@F} --ipu-insts-name=insts.txt $(<:%=../%)

${targetname}.exe: test.cpp
rm -rf _build
mkdir -p _build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,12 @@ def core_body():
objectfifo_release(ObjectFifoPort.Produce, "OF_2to3", 1)
yield_([])

kernel = Buffer(ComputeTile3, [3, 3], T.i16(), "kernel")

# Compute tile 3
@core(ComputeTile3, "filter2d.cc.o")
def core_body():
kernel = memref.alloc([3, 3], T.i16())
# kernel = memref.alloca([3, 3], T.i16())
v0 = arith.constant(0, T.i16())
v1 = arith.constant(4096, T.i16())
v_minus4 = arith.constant(-16384, T.i16())
Expand Down
Loading
Loading