Skip to content

Commit

Permalink
snDNN: Move kernels into library compatible with new Runtime (#26)
Browse files Browse the repository at this point in the history
* snDNN: Move applications into its own library called snDNN

* docker: Explicitly copy the snDNN python requirement file sw/snDNN/requirements.txt

* target/common: Update paths to allow usage in derived repos

* snDNN: remove fusedconv from passing apps due to reported errors

* snDNN/gemm: Fix gemm implementation (cores did not compute anything previously)

* sw/deps: Add install directory to .gitignore

* wave: Add default wave file for questasim for debugging purposes

* blas/gemm: Update blas/gemm fp16 and fp8 implementations

* deps: Use https for MUSL submodule

* dnn: Refactor software

* sw: Remove legacy `benchmark` and `cmake` folders

* musl: Remove submodule and vendor math sources only

* musl: Patch to build math library for Snitch

* ci: Update musl build

* sw/math: Exclude from linting

* dnn: Format C files

* .clang-format-ignore: Make more compact

---------

Co-authored-by: Gianna Paulin <[email protected]>
Co-authored-by: Luca Colagrande <[email protected]>
  • Loading branch information
3 people authored Aug 21, 2023
1 parent 1183399 commit ca5e744
Show file tree
Hide file tree
Showing 124 changed files with 5,506 additions and 6,735 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
# The CI runs on `clang-format` version 10
BasedOnStyle: Google
IndentWidth: 4
IncludeBlocks: Preserve
6 changes: 6 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 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

# Ignore vendored third-party code
./sw/math/*
22 changes: 0 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Build MUSL dependency
run: |
cd sw/deps
mkdir install
cd musl
CC=$LLVM_BINROOT/clang ./configure --disable-shared \
--prefix=../install/ --enable-wrapper=all \
CFLAGS="-mcpu=snitch -menable-experimental-extensions"
make -j4
make install
cd ../../../
- name: Build Software
run: |
make -C target/snitch_cluster sw
Expand All @@ -70,17 +59,6 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Build MUSL dependency
run: |
cd sw/deps
mkdir install
cd musl
CC=$LLVM_BINROOT/clang ./configure --disable-shared \
--prefix=../install/ --enable-wrapper=all \
CFLAGS="-mcpu=snitch -menable-experimental-extensions"
make -j4
make install
cd ../../../
- name: Build Software
run: |
make -C target/snitch_cluster SELECT_RUNTIME=banshee sw
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ jobs:
match_regex: true
exclude_paths: |
sw/snRuntime/src/omp/interface.h
sw/math/arch/generic/*
sw/math/arch/riscv64/bits/*
sw/math/include/*
sw/math/src/include/*
sw/math/src/internal/*
sw/math/src/math/*
sw/math/Makefile
##################
# Lint YML Files #
Expand Down
23 changes: 3 additions & 20 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,23 @@ docs:
# Build Snitch cluster software #
#################################

snitch-cluster-sw-musl:
script:
- cd sw/deps
- mkdir install
- cd musl
- CC=$CLANG ./configure --disable-shared --prefix=../install/
--enable-wrapper=all
CFLAGS="-mcpu=snitch -menable-experimental-extensions"
- make -j4
- make install
artifacts:
paths:
- sw/deps/install/bin/*
- sw/deps/install/include/*
- sw/deps/install/lib/*
expire_in: 1 day

snitch-cluster-sw:
needs: [snitch-cluster-sw-musl]
script:
- cd target/snitch_cluster
- make sw
artifacts:
paths:
- sw/math/include/bits/alltypes.h
- target/snitch_cluster/sw/**/build/*.elf
expire_in: 1 day

snitch-cluster-sw-banshee:
needs: [snitch-cluster-sw-musl]
script:
- cd target/snitch_cluster
- make SELECT_RUNTIME=banshee sw
artifacts:
paths:
- sw/math/include/bits/alltypes.h
- target/snitch_cluster/sw/**/build/*.elf
expire_in: 1 day

Expand Down Expand Up @@ -144,7 +127,7 @@ snitch-cluster-banshee:
- rustup --version
- git clone [email protected]:pulp-platform/banshee.git --recurse-submodules
- cd banshee
- cargo install --path .
- cargo install --debug --path .
- cd ../target/snitch_cluster
- ./sw/tests/run.py sw/tests/banshee-apps.list --simulator banshee
- ./sw/apps/run.py sw/apps/passing-apps.list --simulator banshee
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
[submodule "sw/deps/printf"]
path = sw/deps/printf
url = https://github.com/mpaland/printf.git
[submodule "sw/deps/musl"]
path = sw/deps/musl
url = [email protected]:kraj/musl.git
25 changes: 25 additions & 0 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,31 @@ dependencies:
tech_cells_generic: { git: https://github.com/pulp-platform/tech_cells_generic, version: 0.2.11 }
riscv-dbg: { git: https://github.com/pulp-platform/riscv-dbg, rev: ec0d92fa5fdaaf611e5b8a4cc8ee84017ff98710 }

# Note: used to vendor-in the musl sources, but cannot be used consistently
# until this issue is solved https://github.com/pulp-platform/bender/issues/133
vendor_package:
- name: musl
target_dir: sw/math
upstream: { git: https://github.com/kraj/musl.git, rev: 7a43f6fea9081bdd53d8a11cef9e9fab0348c53d } # v1.2.4
patch_dir: sw/deps/patches/musl
include_from_upstream:
- "COPYRIGHT"
- "Makefile"
- ".gitignore"
- "README"
- "src/math/tanh.c"
- "src/math/expm1.c"
- "src/internal/libm.h"
- "src/include/features.h"
- "include/endian.h"
- "include/math.h"
- "include/features.h"
- "include/alltypes.h.in"
- "arch/riscv64/bits/alltypes.h.in"
- "arch/riscv64/bits/float.h"
- "tools/mkalltypes.sed"
- "arch/generic/fp_arch.h"

export_include_dirs:
- hw/reqrsp_interface/include
- hw/mem_interface/include
Expand Down
1 change: 1 addition & 0 deletions python-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ termcolor
pandas

-r docs/requirements.txt
-r sw/dnn/requirements.txt
13 changes: 13 additions & 0 deletions sw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ This subdirectory contains the various bits and pieces of software for the Snitc
- `snRuntime`: The fundamental, bare-metal runtime for Snitch systems. Exposes a minimal API to manage execution of code across the available cores and clusters, query information about a thread's context, and to coordinate and exchange data with other threads. Hardware configuration dependent implementations of the `snRuntime` can be found, e.g., under `target/snitch_cluster/sw/snRuntime`.
- `snBLAS`: A minimal reference implementation of the basic linear algebra subprograms that demonstrates the use of Snitch and its extensions.

#### math

The math sources are taken from the musl library, patched with our own modifications. The bender vendor snippet in `Bender.yml` was used to copy in the original sources. Patches were generated using the following command (from the root of the repo):
```
git format-patch --relative -o sw/deps/patches/musl/ HEAD^1
```
And can be applied by running (in the root of the repo):
```
git apply sw/deps/patches/musl/0001-musl-Patch-to-build-math-library-for-Snitch.patch
```

The `all` target in `sw/math/Makefile` should be run to generate some files.

### Tests

- `benchmark`: Benchmarking executables that evaluate the performance characteristics of a system.
Expand Down
64 changes: 0 additions & 64 deletions sw/applications/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion sw/applications/data/.gitignore

This file was deleted.

Loading

0 comments on commit ca5e744

Please sign in to comment.