-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Peano for Programming Guide and Examples (#1844)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5946b7d
commit 4799ad3
Showing
100 changed files
with
375 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
programming_examples/basic/matrix_multiplication/matrix_vector/Makefile.chess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
##===- Makefile -----------------------------------------------------------===## | ||
# | ||
# This file licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# Copyright (C) 2024, Advanced Micro Devices, Inc. | ||
# | ||
##===----------------------------------------------------------------------===## | ||
|
||
subdir=matrix_vector | ||
targetname=matrixVectorMultiplication | ||
|
||
# Currently does not accept reconfiguring size via these variables; must change | ||
# in source at aie2.py as well as here | ||
M=288 | ||
K=288 | ||
N=1 | ||
m=32 | ||
k=32 | ||
|
||
kernels=mv_${m}x${k} | ||
|
||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) | ||
include ${SELF_DIR}../makefile-common | ||
|
||
CHESS=true | ||
|
||
build/mv_${m}x${k}.o: ${kernels_dir}/mv.cc | ||
mkdir -p ${@D} | ||
cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -DDIM_M=${m} -DDIM_K=${k} -c $< -o ${@F} | ||
|
2 changes: 1 addition & 1 deletion
2
programming_examples/basic/matrix_multiplication/matrix_vector/run_makefile.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
programming_examples/basic/matrix_multiplication/matrix_vector/run_makefile_chess.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// (c) Copyright 2024 Advanced Micro Devices, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
// REQUIRES: ryzen_ai, chess | ||
// | ||
// RUN: make -f %S/Makefile.chess clean | ||
// RUN: make -f %S/Makefile.chess | ||
// RUN: %run_on_npu make -f %S/Makefile.chess run | FileCheck %s | ||
// CHECK: PASS! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
programming_examples/basic/matrix_multiplication/single_core/Makefile.chess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
##===- Makefile -----------------------------------------------------------===## | ||
# | ||
# This file licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# Copyright (C) 2024, Advanced Micro Devices, Inc. | ||
# | ||
##===----------------------------------------------------------------------===## | ||
|
||
srcdir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
subdir=single_core | ||
targetname=matrixMultiplication | ||
kernels=mm | ||
|
||
M?=256 | ||
K?=256 | ||
N?=256 | ||
m?=64 | ||
k?=64 | ||
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 | ||
|
||
CHESS=true | ||
|
||
build/mm_${m}x${k}x${n}.o: ${kernels_dir}/mm.cc | ||
mkdir -p ${@D} | ||
cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -D${dtype_in}_${dtype_out}_ONLY -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} | ||
|
2 changes: 1 addition & 1 deletion
2
programming_examples/basic/matrix_multiplication/single_core/run_makefile.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
programming_examples/basic/matrix_multiplication/single_core/run_makefile_1.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
programming_examples/basic/matrix_multiplication/single_core/run_makefile_alt.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
programming_examples/basic/matrix_multiplication/single_core/run_makefile_chess.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// (c) Copyright 2024 Advanced Micro Devices, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
// REQUIRES: ryzen_ai, chess | ||
// | ||
// RUN: make -f %S/Makefile.chess clean | ||
// RUN: make -f %S/Makefile.chess | ||
// RUN: %run_on_npu make -f %S/Makefile.chess run | FileCheck %s | ||
// CHECK: PASS! |
2 changes: 1 addition & 1 deletion
2
programming_examples/basic/matrix_multiplication/single_core/run_makefile_i8.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
programming_examples/basic/matrix_multiplication/whole_array/Makefile.chess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
##===- Makefile -----------------------------------------------------------===## | ||
# | ||
# This file licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# Copyright (C) 2024, Advanced Micro Devices, Inc. | ||
# | ||
##===----------------------------------------------------------------------===## | ||
srcdir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
subdir=whole_array | ||
targetname=matrixMultiplication | ||
|
||
M?=640 | ||
K?=896 | ||
N?=768 | ||
m?=16 | ||
k?=32 | ||
n?=48 | ||
n_aie_cols?=2 | ||
b_col_maj?=0 | ||
|
||
kernels=mm_${m}x${k}x${n} | ||
aieargs+=-m $m -k $k -n $n --n-aie-cols ${n_aie_cols} --b-col-maj ${b_col_maj} | ||
runargs+=--b_col_maj ${b_col_maj} | ||
target_suffix=${M}x${K}x${N}_${m}x${k}x${n}_${n_aie_cols}c | ||
|
||
include ${srcdir}/../makefile-common | ||
|
||
CHESS=true | ||
|
||
build/mm_b_row_maj_${m}x${k}x${n}.o: ${kernels_dir}/mm.cc | ||
mkdir -p ${@D} | ||
cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -D${dtype_in}_${dtype_out}_ONLY -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} | ||
|
||
build/mm_b_col_maj_${m}x${k}x${n}.o: ${kernels_dir}/mm_b_col_maj.cc | ||
mkdir -p ${@D} | ||
cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} | ||
|
||
ifneq (${b_col_maj}, 1) | ||
build/mm_${m}x${k}x${n}.o: build/mm_b_row_maj_${m}x${k}x${n}.o | ||
mkdir -p ${@D} | ||
ar rvs $@ $^ | ||
else | ||
build/mm_${m}x${k}x${n}.o: build/mm_b_col_maj_${m}x${k}x${n}.o | ||
mkdir -p ${@D} | ||
ar rvs $@ $^ | ||
endif |
2 changes: 1 addition & 1 deletion
2
programming_examples/basic/matrix_multiplication/whole_array/run_makefile_1_col.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
programming_examples/basic/matrix_multiplication/whole_array/run_makefile_2_col.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col_i8.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
programming_examples/basic/matrix_multiplication/whole_array/run_makefile_chess.lit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// (c) Copyright 2024 Advanced Micro Devices, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
// REQUIRES: ryzen_ai, chess | ||
// | ||
// RUN: make -f %S/Makefile.chess clean | ||
// RUN: make -f %S/Makefile.chess | ||
// RUN: %run_on_npu make -f %S/Makefile.chess run | FileCheck %s | ||
// CHECK: PASS! |
Oops, something went wrong.