Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

SHELL := /bin/bash

CMAKE_BUILDDIR ?= build
BUILD_DIR ?= ../sw/tests/$(test)
MAGIA_DIR ?= ../
GVSOC_DIR ?= ./gvsoc
Expand All @@ -39,7 +40,9 @@ tiles_2 := $(shell echo $$(( $(tiles) * $(tiles) )))
tiles_log := $(shell awk 'BEGIN { printf "%.0f", log($(tiles_2))/log(2) }')
tiles_log_real := $(shell awk 'BEGIN { printf "%.0f", log($(tiles))/log(2) }')

.PHONY: gvsoc
GVRUN ?= $(GVSOC_DIR)/install/bin/gvrun

.PHONY: gvsoc build

clean:
rm -rf build/
Expand All @@ -66,8 +69,8 @@ ifeq ($(compiler), GCC_MULTILIB)
sed -i -E 's/^#add_subdirectory\(flatatt\)/add_subdirectory\(flatatt\)/' ./tests/magia/mesh/CMakeLists.txt
sed -i -E 's/^\/\/#include "utils\/attention_utils.h"/#include "utils\/attention_utils.h"/' ./targets/magia/include/tile.h
endif
cmake -DTARGET_PLATFORM=$(target_platform) -DEVAL=$(eval) -DCOMPILER=$(compiler) -B build --trace-expand
cmake --build build --verbose
cmake -DTARGET_PLATFORM=$(target_platform) -DEVAL=$(eval) -DCOMPILER=$(compiler) -B $(CMAKE_BUILDDIR) --trace-expand
cmake --build $(CMAKE_BUILDDIR) --verbose

set_mesh:
ifeq ($(tiles), 1)
Expand All @@ -81,14 +84,14 @@ run: set_mesh
ifndef test
$(error Proper formatting is: make run test=<test_name> platform=rtl|gvsoc)
endif
ifeq (,$(wildcard ./build/bin/$(test)))
ifeq (,$(wildcard $(CMAKE_BUILDDIR)/bin/$(test)))
$(error No test found with name: $(test))
endif
ifndef platform
$(error Proper formatting is: make run test=<test_name> platform=rtl|gvsoc)
endif
ifeq ($(platform), gvsoc)
$(GVSOC_DIR)/install/bin/gvsoc --target=magia --binary=./build/bin/$(test) --trace-level=trace run
$(GVRUN) --target=magia --param binary=$(CMAKE_BUILDDIR)/bin/$(test) $(GVRUN_ARGS) run
else ifeq ($(platform), rtl)
mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && mkdir -p build
cp ./build/bin/$(test) $(BUILD_DIR)/build/verif
Expand Down
65 changes: 65 additions & 0 deletions testset.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from gvtest.testsuite import *
from functools import partial

# This script can be used to run all the tests for different tile sizes on gvsoc
# First compile all the tests for all the tiles with:
# make build compiler=GCC_PULP tiles=2 CMAKE_BUILDDIR=$PWD/build/tile2
# make build compiler=GCC_PULP tiles=4 CMAKE_BUILDDIR=$PWD/build/tile4
# make build compiler=GCC_PULP tiles=8 CMAKE_BUILDDIR=$PWD/build/tile8
# Then execute:
# gvtest
# Available tests can be obtained with:
# gvtest tests
# Single test can be run with:
# gvtest --test magia-sdk:tile8:test_float --stdout

def tests_build(tile_name, nb_tile, testset):

tests = [
"test_helloworld",
"test_fsync_levels",
"test_fsync_diag",
"test_mm_is",
"test_fsync_sync",
"test_mm_os",
"test_idma",
"test_fsync_rc",
"test_float",
"test_cemm_global",
"test_mm_is_nb",
"test_mm_is_2",
"test_mm_ws_2",
"test_mm_ws",
"test_amo",
"test_mm_ws_nb",
"test_brah",
"test_mm_os_2",
]

skipped_tests = {
'tile2': ['test_mm_is_nb', 'test_mm_ws_2', 'test_brah', 'test_mm_os_2'],
'tile4': ['test_cemm_global', 'test_mm_is_nb', 'test_mm_is_2', 'test_brah', 'test_mm_os_2'],
'tile8': ['test_mm_ws', 'test_amo', 'test_mm_ws_nb', 'test_brah', 'test_mm_os_2'],
}

for test_name in tests:
test = testset.new_test(test_name)
cwd = testset.get_path()
work_dir = f'{cwd}/build/{tile_name}/work/{test_name}'
test.add_command(Shell('run', f'make run platform=gvsoc CMAKE_BUILDDIR={cwd}/build/{tile_name} GVRUN=gvrun test={test_name} GVRUN_ARGS="--work-dir {work_dir}'
f' --attr magia/n_tiles_x={nb_tile} --attr magia/n_tiles_y={nb_tile}"'))

if skipped_tests.get(tile_name) is not None and test_name in skipped_tests.get(tile_name):
print(f"\033[31mSkipping Magia test {test_name} for tile {tile_name}\033")
test.skip('Failing, to be fixed')


def testset_build(testset):

testset.set_name('magia-sdk')

for tile in [2, 4, 8]:
name = f'tile{tile}'
tile_testset = testset.new_testset(name)
tile_testset.add_target('magia')
tile_testset.add_testset(callback=partial(tests_build, name, tile))