Skip to content

Commit

Permalink
Add data generation for both simple vec examples (pulp-platform#36)
Browse files Browse the repository at this point in the history
* sw: Move files into snax-mac-simple folder

* sw: Fix relative paths for CI after move

* sw: Rename files for move

* sw: Adapt relative paths for compilation

* sw: Rename snax-mac-simple to untiled

* sw: Use datagen to drive untiled example

* sw: Fix C linting
  • Loading branch information
JosseVanDelm committed Dec 11, 2023
1 parent a4ab575 commit 84d163e
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 48 deletions.
4 changes: 2 additions & 2 deletions target/snitch_cluster/sw/apps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ SUBDIRS += dnn/maxpool
SUBDIRS += dnn/softmax
SUBDIRS += montecarlo/pi_estimation
SUBDIRS += snax-mac
SUBDIRS += snax-mac-simple
SUBDIRS += snax-mac-tiled
SUBDIRS += snax-mac-simple/untiled
SUBDIRS += snax-mac-simple/tiled
SUBDIRS += snax-gemm-engine
SUBDIRS += snax-gemm-base

Expand Down
4 changes: 2 additions & 2 deletions target/snitch_cluster/sw/apps/snax-mac-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ runs:
- app: dnn/maxpool
- app: dnn/gemm
- app: snax-mac
- app: snax-mac-simple
- app: snax-mac-tiled
- app: snax-mac-simple/untiled
- app: snax-mac-simple/tiled
# dnn/gelu # seems like it stalls
# dnn/conv2d # fails with exit code 32
# dnn/fusedconv # fails newly
Expand Down
28 changes: 23 additions & 5 deletions target/snitch_cluster/sw/apps/snax-mac-simple/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,28 @@
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Ryan Antonio <[email protected]>
# Gianna Paulin <[email protected]>
# Josse Van Delm <[email protected]>

APP = snax-mac-simple
SRCS = src/snax-mac-simple.c
INCDIRS = data
# Usage of absolute paths is required to externally include this Makefile
MK_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
SRC_DIR := $(realpath $(MK_DIR)/$(APP)/src)

include ../common.mk
INCDIRS += $(SRC_DIR)

SRCS = $(realpath $(SRC_DIR)/$(APP).c)

LENGTH ?= 20
TILE_SIZE ?= 4

DATA_H = $(SRC_DIR)/data.h

$(DATA_H): $(MK_DIR)/datagen.py
$< --length=$(LENGTH) --tile_size=$(TILE_SIZE) > $@

.PHONY: clean-data clean

clean-data:
rm -f $(DATA_H)

clean: clean-data
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Add data utility path
sys.path.append(os.path.join(os.path.dirname(__file__),
"../../../../../../util/sim/"))
"../../../../../util/sim/"))
from data_utils import format_scalar_definition, \
format_vector_definition # noqa: E402

Expand Down
13 changes: 13 additions & 0 deletions target/snitch_cluster/sw/apps/snax-mac-simple/tiled/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Ryan Antonio <[email protected]>
# Josse Van Delm <[email protected]>

APP = tiled

include ../Makefile
include ../../common.mk

$(DEP): $(DATA_H)
12 changes: 12 additions & 0 deletions target/snitch_cluster/sw/apps/snax-mac-simple/untiled/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Ryan Antonio <[email protected]>

APP = untiled

include ../../common.mk
include ../Makefile

$(DEP): $(DATA_H)
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ int main() {
write_csr(0x3d3, (uint32_t)local_o);

// Set configs
write_csr(0x3d4, 1); // Number of iterations
write_csr(0x3d5, 19); // Vector length
write_csr(0x3d6, 1); // Set simple multiplication
write_csr(0x3d4, 1); // Number of iterations
write_csr(0x3d5, VEC_LEN); // Vector length
write_csr(0x3d6, 1); // Set simple multiplication

// Write start CSR to launch accelerator
write_csr(0x3c0, 0);
Expand Down
35 changes: 0 additions & 35 deletions target/snitch_cluster/sw/apps/snax-mac-tiled/Makefile

This file was deleted.

0 comments on commit 84d163e

Please sign in to comment.