Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
newling committed Sep 5, 2024
1 parent e950394 commit f537d4a
Showing 1 changed file with 47 additions and 11 deletions.
58 changes: 47 additions & 11 deletions build_tools/ci/cpu_comparison/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,14 @@ def run(self, config):
test_name = output_dir / "test_from_template_full_bias.mlir"
template_name = matmul_template_dir / "matmul_bias_MxK_KxN_MxN.mlir"
generate_matmul_test(test_name, template_name, 128, 128, 256, "i32", "i32")
aie_vs_llvm_cpu(config, test_name, tile_pipeline="pack-peel", lower_to_aie_pipeline="air", rtol=0, atol=0)
aie_vs_llvm_cpu(
config,
test_name,
tile_pipeline="pack-peel",
lower_to_aie_pipeline="air",
rtol=0,
atol=0,
)

if config.xdna_datetime and config.xdna_datetime < 20240801:
for name in [
Expand All @@ -653,30 +660,46 @@ def run(self, config):
# Test(s) of the form matmul(A,B) + C where A:MxK, B:KxN, C:N
test_name = output_dir / "test_from_template_bias_N.mlir"
template_name = matmul_template_dir / "matmul_bias_MxK_KxN_N.mlir"
generate_matmul_test(
test_name, template_name, 1024, 1024, 512, "bf16", "f32"
)
generate_matmul_test(test_name, template_name, 1024, 1024, 512, "bf16", "f32")
if config.vitis_dir:
aie_vs_llvm_cpu(
config, test_name, tile_pipeline="pack-peel", lower_to_aie_pipeline="air", use_ukernel=True
config,
test_name,
tile_pipeline="pack-peel",
lower_to_aie_pipeline="air",
use_ukernel=True,
)
aie_vs_llvm_cpu(
config, test_name, tile_pipeline="pack-peel", lower_to_aie_pipeline="air", use_ukernel=False
config,
test_name,
tile_pipeline="pack-peel",
lower_to_aie_pipeline="air",
use_ukernel=False,
)

# Test(s) of the form batch_matmul(A,B) where A:BxMxK, B:BxKxN
template_name = matmul_template_dir / "batch_matmul_BxMxK_BxKxN.mlir"
for (lhs_type, acc_type) in zip(["i32", "bf16"], ["i32", "f32"]):
test_name = output_dir / f"test_from_template_bmm_1_{lhs_type}_{acc_type}.mlir"
generate_matmul_test(test_name, template_name, 128, 128, 256, lhs_type, acc_type, b=1)
aie_vs_llvm_cpu(config, test_name, tile_pipeline="pack-peel", lower_to_aie_pipeline="objectFifo")
for lhs_type, acc_type in zip(["i32", "bf16"], ["i32", "f32"]):
test_name = (
output_dir / f"test_from_template_bmm_1_{lhs_type}_{acc_type}.mlir"
)
generate_matmul_test(
test_name, template_name, 128, 128, 256, lhs_type, acc_type, b=1
)
aie_vs_llvm_cpu(
config,
test_name,
tile_pipeline="pack-peel",
lower_to_aie_pipeline="objectFifo",
)

# TODO (vivian): The below tests are batch matmul with batch size equals 2, and have different
# numerics compared to CPU results. Comment these out until we have a fix.
# test_name = output_dir / f"test_from_template_bmm_2_{lhs_type}_{acc_type}.mlir"
# generate_matmul_test(test_name, template_name, 64, 64, 64, lhs_type, acc_type, b=2)
# aie_vs_llvm_cpu(config, test_name, tile_pipeline="pack-peel", lower_to_aie_pipeline="objectFifo")


class SmokeSet(TestSet):
def __init__(self):
super().__init__("Smoke")
Expand Down Expand Up @@ -838,7 +861,20 @@ def all_tests(
),
)

parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument(
"-v",
"--verbose",
action="count",
default=0,
help=dedent(
"""
Verbosity level. Currently
0: total silence.
1 (-v) : almost everything.
2 (-vv) : everything.
"""
),
)

parser.add_argument(
"--reset-npu-between-runs",
Expand Down

0 comments on commit f537d4a

Please sign in to comment.