Skip to content

Commit

Permalink
[software] Complete data generation for tests and systolic apps
Browse files Browse the repository at this point in the history
  • Loading branch information
mbertuletti committed Oct 25, 2024
1 parent 4f01cec commit 42ee2cd
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 12 deletions.
4 changes: 1 addition & 3 deletions software/apps/systolic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ RUNTIME_DIR := $(abspath $(SOFTWARE_DIR)/runtime)
include $(RUNTIME_DIR)/runtime.mk

APPS := $(patsubst $(APPS_DIR)/%/main.c,%,$(shell find $(APPS_DIR) -name "main.c"))
DATA := $(patsubst %.args,%.h,$(shell find $(APPS_DIR) -name "data.args"))
ALLPYS := $(patsubst %.py,%.h,$(wildcard $(DATA_DIR)/*.py))
BINARIES := $(addprefix $(BIN_DIR)/,$(APPS))

# Define the rule to build all applications
Expand All @@ -26,7 +24,7 @@ $(APPS): % : $(BIN_DIR)/% $(APPS_DIR)/Makefile $(shell find $(RUNTIME_DIR)/**.{S
# Check if the config is set to systolic
ifeq ($(config),systolic)
.PHONY: $(BINARIES)
$(BINARIES): $(BIN_DIR)/%: %/main.c.o $(RUNTIME) $(LINKER_SCRIPT) $(DATA) $(ALLPYS) update_opcodes
$(BINARIES): $(BIN_DIR)/%: %/main.c.o $(RUNTIME) $(LINKER_SCRIPT) data_%.h update_opcodes
mkdir -p $(dir $@)
$(RISCV_CC) -Iinclude $(RISCV_LDFLAGS) -o $@ $< $(RUNTIME) -T$(RUNTIME_DIR)/link.ld
$(RISCV_OBJDUMP) $(RISCV_OBJDUMP_FLAGS) -D $@ > $@.dump
Expand Down
7 changes: 7 additions & 0 deletions software/data/gendata_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,12 @@ def get_type(type_string):
arrays = [(result[i], *arrays[i]) for i in range(len(arrays))]
print_file(header, defnes, arrays, filename)

elif (app_name == "fence") | (app_name == "memcpy"):

result = blas.generate_iarray(
**{name: value for name, value in defnes}, my_type=my_type)
arrays = [(result, *arrays[0])]
print_file(header, defnes, arrays, filename)

else:
print("No need for data generation.")
24 changes: 22 additions & 2 deletions software/data/gendata_params.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"cfft_radix4_q16": {
"type": "int16",
"defines": [
("N_CSAMPLES", 1024)
("N_CSAMPLES", 64)
]
"arrays": [
("int16_t", "l2_pSrc")
Expand All @@ -35,7 +35,7 @@
"cfft_radix2_q16": {
"type": "int16",
"defines": [
("N_CSAMPLES", 1024)
("N_CSAMPLES", 256)
]
"arrays": [
("int16_t", "l2_pSrc")
Expand Down Expand Up @@ -142,4 +142,24 @@
]
}

"fence": {
"type": "int32",
"defines": [
("array_N", 12288)
]
"arrays": [
("int32_t", "l2_data")
]
},

"memcpy": {
"type": "int32",
"defines": [
("array_N", 2048)
]
"arrays": [
("int32_t", "l2_data")
]
},

}
4 changes: 1 addition & 3 deletions software/tests/baremetal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ RUNTIME_DIR := $(abspath $(SOFTWARE_DIR)/runtime)
include $(RUNTIME_DIR)/runtime.mk

TESTS := $(patsubst $(TESTS_DIR)/%/main.c,%,$(shell find $(TESTS_DIR) -name "main.c"))
DATA := $(patsubst %.args,%.h,$(shell find $(TESTS_DIR) -name "data.args"))
ALLPYS := $(patsubst %.py,%.h,$(wildcard $(DATA_DIR)/*.py))
BINARIES := $(addprefix $(BIN_DIR)/,$(TESTS))

# Make all applications
Expand All @@ -26,7 +24,7 @@ all: $(TESTS)
$(TESTS): % : $(BIN_DIR)/% $(TESTS_DIR)/Makefile $(shell find $(RUNTIME_DIR)/**.{S,c,h,ld} -type f)

.PHONY: $(BINARIES)
$(BINARIES): $(BIN_DIR)/%: %/main.c.o $(RUNTIME) $(LINKER_SCRIPT) $(DATA) $(ALLPYS) update_opcodes
$(BINARIES): $(BIN_DIR)/%: %/main.c.o $(RUNTIME) $(LINKER_SCRIPT) data_%.h update_opcodes
mkdir -p $(dir $@)
$(RISCV_CC) -Iinclude $(RISCV_LDFLAGS) -o $@ $< $(RUNTIME) -T$(RUNTIME_DIR)/link.ld
$(RISCV_OBJDUMP) $(RISCV_OBJDUMP_FLAGS) -D $@ > $@.dump
Expand Down
1 change: 0 additions & 1 deletion software/tests/baremetal/fence/data.args

This file was deleted.

2 changes: 1 addition & 1 deletion software/tests/baremetal/fence/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <stdint.h>
#include <string.h>

#include "data.h"
#include "data_fence.h"
#include "dma.h"
#include "encoding.h"
#include "mempool_dma_frontend.h"
Expand Down
1 change: 0 additions & 1 deletion software/tests/baremetal/memcpy/data.args

This file was deleted.

2 changes: 1 addition & 1 deletion software/tests/baremetal/memcpy/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <stdint.h>
#include <string.h>

#include "data.h"
#include "data_memcpy.h"
#include "dma.h"
#include "encoding.h"
#include "mempool_dma_frontend.h"
Expand Down

0 comments on commit 42ee2cd

Please sign in to comment.