From c282026251ff5b6b468013336eec019cb66c4fe2 Mon Sep 17 00:00:00 2001 From: xiaoling-yi Date: Tue, 29 Oct 2024 23:35:55 +0100 Subject: [PATCH] add utils --- .../device/apps/snax/snax-gemmx-conv/data/datagen.py | 11 ++++++++++- .../apps/snax/snax-gemmx-matmul/data/datagen.py | 10 +++++++++- target/sim/sw/sim_elf.yaml | 3 ++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/target/sim/sw/device/apps/snax/snax-gemmx-conv/data/datagen.py b/target/sim/sw/device/apps/snax/snax-gemmx-conv/data/datagen.py index cd53663f6..9c474c708 100755 --- a/target/sim/sw/device/apps/snax/snax-gemmx-conv/data/datagen.py +++ b/target/sim/sw/device/apps/snax/snax-gemmx-conv/data/datagen.py @@ -13,11 +13,20 @@ import sys import os +import subprocess + # Add data utility path -sys.path.append(os.path.join(os.path.dirname(__file__), "../../../../../../util/sim/")) +sys.path.append(os.path.join(os.path.dirname(__file__), + "../../../../../../../../util/sim/")) from data_utils import format_scalar_definition, format_vector_definition # noqa E402 # Add golden model path +bender_command = subprocess.run(['bender', 'path', 'snitch_cluster'], + capture_output=True, text=True) +snax_utils_path = bender_command.stdout.strip() + +sys.path.append(snax_utils_path + "/util/sim/") + from snax_utils import ( # noqa E402 conv2d, im2col, diff --git a/target/sim/sw/device/apps/snax/snax-gemmx-matmul/data/datagen.py b/target/sim/sw/device/apps/snax/snax-gemmx-matmul/data/datagen.py index cfc8a0d27..e525f740d 100755 --- a/target/sim/sw/device/apps/snax/snax-gemmx-matmul/data/datagen.py +++ b/target/sim/sw/device/apps/snax/snax-gemmx-matmul/data/datagen.py @@ -13,11 +13,19 @@ import sys import os +import subprocess + # Add data utility path -sys.path.append(os.path.join(os.path.dirname(__file__), "../../../../../../util/sim/")) +sys.path.append(os.path.join(os.path.dirname(__file__), + "../../../../../../../../util/sim/")) from data_utils import format_scalar_definition, format_vector_definition # noqa E402 # Add golden model path +bender_command = subprocess.run(['bender', 'path', 'snitch_cluster'], + capture_output=True, text=True) +snax_utils_path = bender_command.stdout.strip() + +sys.path.append(snax_utils_path + "/util/sim/") from snax_utils import ( # noqa E402 conv2d, im2col, diff --git a/target/sim/sw/sim_elf.yaml b/target/sim/sw/sim_elf.yaml index a9d00d5f7..0f8aa4b07 100644 --- a/target/sim/sw/sim_elf.yaml +++ b/target/sim/sw/sim_elf.yaml @@ -4,4 +4,5 @@ runs: - elf: host/apps/offload/build/offload-snax-test-integration.elf - - elf: host/apps/offload/build/offload-snax-gemmx.elf + - elf: host/apps/offload/build/offload-snax-gemmx-matmul.elf + - elf: host/apps/offload/build/offload-snax-gemmx-conv.elf