Skip to content

Commit bb68258

Browse files
committed
set minimum sizes and update tests
1 parent 528201f commit bb68258

File tree

5 files changed

+37
-8
lines changed

5 files changed

+37
-8
lines changed

programming_examples/basic/combined_transpose/combined_transpose.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ def shuffle_transpose(dev, M, N, m, n, s, dtype):
2222
assert m % s == 0
2323
assert n % s == 0
2424

25+
# Minimum tile sizes required by the two kernels
26+
if s == 8:
27+
assert m > 8 and n > 8
28+
elif s == 16:
29+
assert m > 32 and n > 32
30+
2531
# Define tensor types
2632
matrix_ty = np.ndarray[(M, N), dtype]
2733
tile_ty = np.ndarray[(m, n,), dtype]
@@ -41,6 +47,12 @@ def shuffle_transpose(dev, M, N, m, n, s, dtype):
4147
sizes=[M // m, N // n, m, n],
4248
strides=[m * N, n, N, 1]
4349
)
50+
tap_in_L3L2_straight = TensorAccessPattern(
51+
tensor_dims=(M, N),
52+
offset=0,
53+
sizes=[M // m, N // n, m, n],
54+
strides=[m * N, n, N, 1]
55+
)
4456
tap_in_L2L1 = TensorAccessPattern(
4557
tensor_dims=(M, N),
4658
offset=0,
@@ -53,6 +65,12 @@ def shuffle_transpose(dev, M, N, m, n, s, dtype):
5365
sizes=[M // m, N // n, n, m],
5466
strides=[m, n * M, M, 1]
5567
)
68+
tap_out_L1L3_straight = TensorAccessPattern(
69+
tensor_dims=(N, M),
70+
offset=0,
71+
sizes=[1, 1, 1, M*N],
72+
strides=[0, 0, 0, 1]
73+
)
5674

5775
in_L3L2_fifo = ObjectFifo(tile_ty, name="in_L3L2_fifo")
5876
in_L2L1_fifo = in_L3L2_fifo.cons(

programming_examples/basic/combined_transpose/tests/1_run_makefile_i8.lit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
// RUN: mkdir -p test_1_run_makefile_i8
77
// RUN: cd test_1_run_makefile_i8
88
// RUN: make -f %S/../Makefile clean
9-
// RUN: make -f %S/../Makefile M=320 N=288 m=64 n=32 dtype_in=i8
10-
// RUN: %run_on_npu1% make -f %S/../Makefile run M=320 N=288 m=64 n=32 dtype_in=i8
9+
// RUN: make -f %S/../Makefile M=320 N=288 m=64 n=32 dtype=i8
10+
// RUN: %run_on_npu1% make -f %S/../Makefile run M=320 N=288 m=64 n=32 dtype=i8
1111
// CHECK: PASS!

programming_examples/basic/combined_transpose/tests/2_run_makefile_i16.lit renamed to programming_examples/basic/combined_transpose/tests/2_run_makefile_i16_s4.lit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
//
44
// REQUIRES: ryzen_ai_npu1, peano
55
//
6-
// RUN: mkdir -p test_2_run_makefile_i16
6+
// RUN: mkdir -p test_2_run_makefile_i16_s4
77
// RUN: cd test_2_run_makefile_i16
88
// RUN: make -f %S/../Makefile clean
9-
// RUN: make -f %S/../Makefile M=256 N=128 m=32 n=16 dtype_in=i16
10-
// RUN: %run_on_npu1% make -f %S/../Makefile run M=256 N=128 m=32 n=16 dtype_in=i16
9+
// RUN: make -f %S/../Makefile M=256 N=128 m=32 n=16 s=4 dtype=i16
10+
// RUN: %run_on_npu1% make -f %S/../Makefile run M=256 N=128 m=32 n=16 s=4 dtype=i16
1111
// CHECK: PASS!

programming_examples/basic/combined_transpose/tests/3_run_makefile_i32.lit renamed to programming_examples/basic/combined_transpose/tests/3_run_makefile_i32_s4.lit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
//
44
// REQUIRES: ryzen_ai_npu1, peano
55
//
6-
// RUN: mkdir -p test_3_run_makefile_i32
6+
// RUN: mkdir -p test_3_run_makefile_i32_s4
77
// RUN: cd test_3_run_makefile_i32
88
// RUN: make -f %S/../Makefile clean
9-
// RUN: make -f %S/../Makefile M=128 N=1024 m=16 n=32 dtype_in=i32
10-
// RUN: %run_on_npu1% make -f %S/../Makefile run M=128 N=1024 m=16 n=32 dtype_in=i32
9+
// RUN: make -f %S/../Makefile M=128 N=1024 m=16 n=32 dtype=i32
10+
// RUN: %run_on_npu1% make -f %S/../Makefile run M=128 N=1024 m=16 n=32 dtype=i32
1111
// CHECK: PASS!
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// (c) Copyright 2024 Advanced Micro Devices, Inc.
2+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
//
4+
// REQUIRES: ryzen_ai_npu1, peano
5+
//
6+
// RUN: mkdir -p test_4_run_makefile_i32_s8
7+
// RUN: cd test_3_run_makefile_i32
8+
// RUN: make -f %S/../Makefile clean
9+
// RUN: make -f %S/../Makefile M=128 N=1024 m=64 n=32 s=8 dtype=i32
10+
// RUN: %run_on_npu1% make -f %S/../Makefile run M=128 N=1024 m=64 n=32 s=8 dtype=i32
11+
// CHECK: PASS!

0 commit comments

Comments
 (0)