Skip to content

Commit

Permalink
Fix passthrough hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
jgmelber committed Apr 24, 2024
1 parent 06701e7 commit a673db5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
8 changes: 5 additions & 3 deletions programming_examples/basic/passthrough_dmas/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ include ${srcdir}/../../makefile-common

all: build/final.xclbin build/insts.txt

devicename ?= npu
targetname = passThroughDMAs
LENGTH ?= 4096

build/aie.mlir: ${srcdir}/aie2.py
mkdir -p ${@D}
python3 $< ${devicename} ${col} ${LENGTH} ${LENGTH} > $@
python3 $< ${LENGTH} ${devicename} ${col} > $@

.PHONY: inst/insts.txt
inst/insts.txt: ${srcdir}/aie2.py
rm -rf inst
mkdir -p inst
python3 $< ${devicename} ${col} ${LENGTH} > inst/aie.mlir
python3 $< ${LENGTH} > inst/aie.mlir
pushd inst && aiecc.py --aie-only-generate-npu --npu-insts-name=insts.txt aie.mlir && popd
${powershell} ./build/${targetname}.exe -x build/final.xclbin -i inst/insts.txt -k MLIR_AIE -l ${LENGTH}

Expand Down Expand Up @@ -64,7 +65,8 @@ vck5000: build/aie.mlir
-Wl,-rpath,${ROCM_ROOT}/lib \
-Wl,--whole-archive -Wl,--no-whole-archive -lstdc++ -ldl -lelf -o test.elf


run_vck5000:
test.elf

clean:
rm -rf build _build inst ${targetname}.exe
25 changes: 12 additions & 13 deletions programming_examples/basic/passthrough_dmas/aie2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@
from aie.extras.context import mlir_mod_ctx

N = 4096
dev = AIEDevice.npu
col = 0


# Deciphering the command line arguments
if len(sys.argv) < 3:
raise ValueError("[ERROR] Need 2 command line arguments (Device name, Col)")

if len(sys.argv) == 4:
if len(sys.argv) > 1:
N = int(sys.argv[1])

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

col = int(sys.argv[2])
if len(sys.argv) > 3:
col = int(sys.argv[3])


def my_passthrough():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
// REQUIRES: ryzen_ai, chess
//
// RUN: make -f %S/Makefile clean
// RUN: make -f %S/Makefile run | FileCheck %s
// RUN: %run_on_npu make -f %S/Makefile run | FileCheck %s
// CHECK: PASS!

0 comments on commit a673db5

Please sign in to comment.