Skip to content

Commit

Permalink
Add end-to-end test of new BD chain syntax (#1771)
Browse files Browse the repository at this point in the history
Co-authored-by: Joseph Melber <[email protected]>
  • Loading branch information
andrej and jgmelber committed Sep 30, 2024
1 parent f5cb2f9 commit 8a2a278
Show file tree
Hide file tree
Showing 7 changed files with 431 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ target_suffix?=${M}x${K}x${N}
mlir_target?=build/aie_${target_suffix}.mlir
xclbin_target?=build/final_${target_suffix}.xclbin
insts_target?=build/insts_${target_suffix}.txt
aie_py_src?=aie2.py

runargs?=-v 2 --warmup 1 --iters 1
aieargs+=-M $M -K $K -N $N --dtype_in ${dtype_in} --dtype_out ${dtype_out}
Expand All @@ -89,7 +90,7 @@ build/%.o: ${kernels_dir}/%.cc
mkdir -p ${@D}
cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -c $< -o ${@F}

${mlir_target}: ${srcdir}/aie2.py
${mlir_target}: ${srcdir}/${aie_py_src}
mkdir -p ${@D}
python3 $< ${aieargs} > $@

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ n?=32
kernels=mm_${m}x${k}x${n}
aieargs+=-m $m -k $k -n $n
target_suffix=${M}x${K}x${N}_${m}x${k}x${n}
use_alt?=0

ifeq (${use_alt}, 1)
aie_py_src=aie2_alt.py
endif

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ In this design, a single AI Engine compute core performs a matrix-matrix-multipl
* This design supports tracing; See [below](#tracing).
* Only a single core performs computations. As such, we only need a single ObjectFIFO for each of the transfers between the levels (shim &rightarrow; memory, memory &rightarrow; compute, and back). These ObjectFIFOs are named `inA`, `inB`, `outC` and `memA`, `memB` and `memC`, respectively.

## Notes on the `aie2_alt.py` Implementation

As in the whole-array design, the `aie2.py` file describes the data movement of the design. This single core example also comes with an alternative implementation, which can be found in `aie2_alt.py`. If you specify `use_alt=1` as an environment variable at compile time, this alternative implementation will be used in place of `aie2.py`.

Functionally, `aie2.py` and `aie2_alt.py` are intended to be identical. However, `aie2_alt.py` is implemented using a new syntax for runtime buffer descriptor configuration on the shim. Specifically, `aie2_alt.py` uses the `aiex.dma_configure_task_for`, `aiex.dma_start_task` and `aiex.dma_await_task` operations instead of `aiex.dma_memcpy_nd`.

## Building and Running the Design

You need C++23 for bfloat16_t support. It can be found in g++-13: https://lindevs.com/install-g-on-ubuntu
Expand Down
Loading

0 comments on commit 8a2a278

Please sign in to comment.