Skip to content

Commit

Permalink
Strix passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
jgmelber committed Oct 24, 2024
1 parent 1485f62 commit c7fdd9e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
12 changes: 10 additions & 2 deletions programming_examples/basic/passthrough_kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ srcdir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

include ${srcdir}/../../makefile-common

devicename = npu
targetname = passThroughKernel
VPATH := ${srcdir}/../../../aie_kernels/generic
data_size = 4096
Expand All @@ -24,15 +25,22 @@ all: build/final_${data_size}.xclbin

build/aie2_lineBased_8b_${data_size}.mlir: ${srcdir}/aie2.py
mkdir -p ${@D}
python3 $< ${data_size} 0 > $@
python3 $< ${devicename} ${data_size} 0 > $@

build/aie_trace__lineBased_8b_${data_size}.mlir: ${srcdir}/aie2.py
mkdir -p ${@D}
python3 $< ${data_size} ${trace_size} > $@

build/passThrough.cc.o: passThrough.cc
mkdir -p ${@D}
cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DBIT_WIDTH=8 -c $< -o ${@F}
ifeq ($(devicename), npu)
cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DBIT_WIDTH=8 -c $< -o ${@F}
else ifeq ($(devicename), npu2)
cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2P_FLAGS} -DBIT_WIDTH=8 -c $< -o ${@F}
else
echo "Device type not supported"
endif
endif

build/final_${data_size}.xclbin: build/aie2_lineBased_8b_${data_size}.mlir build/passThrough.cc.o
mkdir -p ${@D}
Expand Down
14 changes: 12 additions & 2 deletions programming_examples/basic/passthrough_kernel/aie2.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@
def passthroughKernel(vector_size, trace_size):
N = vector_size
lineWidthInBytes = N // 4 # chop input in 4 sub-tensors

@device(AIEDevice.npu1_1col)

if len(sys.argv) != 3:
raise ValueError("[ERROR] Need command line arguments (Device name, Vector size)")

if sys.argv[1] == "npu":
dev = AIEDevice.npu1_1col
elif sys.argv[1] == "npu2":
dev = AIEDevice.npu2
else:
raise ValueError("[ERROR] Device name {} is unknown".format(sys.argv[1]))

@device(dev)
def device_body():
# define types
vector_ty = np.ndarray[(N,), np.dtype[np.uint8]]
Expand Down
1 change: 1 addition & 0 deletions programming_examples/makefile-common
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ CHESS_FLAGS = -P ${AIE_INCLUDE_DIR}

CHESSCCWRAP1_FLAGS = aie -I ${AIETOOLS_DIR}/include
CHESSCCWRAP2_FLAGS = aie2 -I ${AIETOOLS_DIR}/include
CHESSCCWRAP2P_FLAGS = aie2p -I ${AIETOOLS_DIR}/include
PEANOWRAP2_FLAGS = -O2 -v -std=c++20 --target=aie2-none-unknown-elf ${WARNING_FLAGS} -DNDEBUG -I ${AIETOOLS_DIR}/include

TEST_POWERSHELL := $(shell command -v powershell.exe >/dev/null 2>&1 && echo yes || echo no)
Expand Down

0 comments on commit c7fdd9e

Please sign in to comment.