Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/tracer/dma' into rbarton/gemm
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbarton committed Jan 15, 2024
2 parents 3b2e6c1 + 330d115 commit b873897
Show file tree
Hide file tree
Showing 59 changed files with 892 additions and 564 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
name: build-docker
on:
push:
branches: [main]
branches: [tracer/dma]
workflow_dispatch:
jobs:
build-docker:
Expand All @@ -27,6 +27,6 @@ jobs:
context: .
file: util/container/Dockerfile
push: true
tags: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
tags: ghcr.io/pulp-platform/snitch_cluster:tracer-dma
build-args: |-
SNITCH_LLVM_VERSION=latest
20 changes: 17 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,26 @@ jobs:
name: Build documentation
runs-on: ubuntu-22.04
container:
image: ghcr.io/pulp-platform/snitch_cluster:main
image: ghcr.io/pulp-platform/snitch_cluster:tracer-dma
steps:
- uses: actions/checkout@v2
- name: Build docs
run: make docs

#####################
# Python unit tests #
#####################

pytest:
name: Python unit tests
runs-on: ubuntu-22.04
container:
image: ghcr.io/pulp-platform/snitch_cluster:tracer-dma
steps:
- uses: actions/checkout@v2
- name: Run pytest
run: pytest

##############################################
# Simulate SW on Snitch Cluster w/ Verilator #
##############################################
Expand All @@ -29,7 +43,7 @@ jobs:
name: Simulate SW on Snitch Cluster w/ Verilator
runs-on: ubuntu-22.04
container:
image: ghcr.io/pulp-platform/snitch_cluster:main
image: ghcr.io/pulp-platform/snitch_cluster:tracer-dma
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -54,7 +68,7 @@ jobs:
name: Simulate SW on Snitch Cluster w/ Banshee
runs-on: ubuntu-22.04
container:
image: ghcr.io/pulp-platform/snitch_cluster:main
image: ghcr.io/pulp-platform/snitch_cluster:tracer-dma
steps:
- uses: actions/checkout@v2
with:
Expand Down
8 changes: 8 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ docs:
script:
- make docs

#####################
# Python unit tests #
#####################

pytest:
script:
- pytest

#################################
# Build Snitch cluster software #
#################################
Expand Down
1 change: 1 addition & 0 deletions docs/rm/bench/join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: join
1 change: 1 addition & 0 deletions docs/rm/bench/roi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: roi
1 change: 1 addition & 0 deletions docs/rm/bench/visualize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: visualize
1 change: 1 addition & 0 deletions docs/rm/trace/annotate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: annotate
1 change: 1 addition & 0 deletions docs/rm/trace/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: events
1 change: 1 addition & 0 deletions docs/rm/trace/gen_trace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: gen_trace
2 changes: 0 additions & 2 deletions hw/future/src/dma/axi_dma_backend.sv
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ module axi_dma_backend #(
//--------------------------------------
//pragma translate_off
`ifndef SYNTHESYS
`ifndef VERILATOR
generate
if (DmaTracing) begin : gen_dma_tracer
string fn;
Expand Down Expand Up @@ -595,7 +594,6 @@ module axi_dma_backend #(
end
end
endgenerate
`endif
`endif
//pragma translate_on
endmodule : axi_dma_backend
10 changes: 9 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ plugins:
- mkdocstrings:
handlers:
python:
paths: [util/sim]
paths: [util/sim, util/trace, util/bench]
- macros:
on_error_fail: true
use_directory_urls: false
Expand Down Expand Up @@ -57,6 +57,14 @@ nav:
- sim_utils: rm/sim/sim_utils.md
- rm/sim/Simulation.md
- rm/sim/Simulator.md
- Trace Utilities:
- gen_trace.py: rm/trace/gen_trace.md
- annotate.py: rm/trace/annotate.md
- events.py: rm/trace/events.md
- Benchmarking Utilities:
- join.py: rm/bench/join.md
- roi.py: rm/bench/roi.md
- visualize.py: rm/bench/visualize.md
- Snitch Runtime:
- Pages: runtime/Pages/index.md
- Files: runtime/Files/index.md
Expand Down
16 changes: 10 additions & 6 deletions python-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Keep sorted.
bin2coe
dataclasses
editorconfig-checker==2.3.51
flake8
gitpython
hjson
json5
jsonref
jsonschema
mako
matplotlib
pandas
progressbar2
tabulate
yamllint
pyyaml
psutil
pyelftools
pytablewriter
pytest
pyyaml
tabulate
termcolor
pandas
pyelftools
psutil
yamllint

-r docs/requirements.txt
-r sw/dnn/requirements.txt
1 change: 1 addition & 0 deletions sw/snRuntime/api/sync_decls.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ typedef struct {

extern volatile uint32_t _snrt_mutex;
extern volatile snrt_barrier_t _snrt_barrier;
extern volatile uint32_t _reduction_result;

inline volatile uint32_t *snrt_mutex();

Expand Down
6 changes: 5 additions & 1 deletion sw/snRuntime/src/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,14 @@ static inline void snrt_init_libs() { snrt_alloc_init(); }
#endif

#ifdef SNRT_CRT0_EXIT
static inline void snrt_exit(int exit_code) {
static inline void snrt_exit_default(int exit_code) {
exit_code = snrt_global_all_to_all_reduction(exit_code);
if (snrt_global_core_idx() == 0)
*(snrt_exit_code_destination()) = (exit_code << 1) | 1;
}
#ifndef SNRT_CRT0_ALTERNATE_EXIT
static inline void snrt_exit(int exit_code) { snrt_exit_default(exit_code); }
#endif
#endif

void snrt_main() {
Expand Down
1 change: 1 addition & 0 deletions sw/snRuntime/src/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

volatile uint32_t _snrt_mutex;
volatile snrt_barrier_t _snrt_barrier;
volatile uint32_t _reduction_result;

//================================================================================
// Functions
Expand Down
6 changes: 6 additions & 0 deletions sw/snRuntime/src/sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ inline void snrt_global_barrier() {
snrt_cluster_hw_barrier();
}

inline uint32_t snrt_global_all_to_all_reduction(uint32_t value) {
__atomic_add_fetch(&_reduction_result, value, __ATOMIC_RELAXED);
snrt_global_barrier();
return _reduction_result;
}

/**
* @brief Generic barrier
*
Expand Down
1 change: 0 additions & 1 deletion sw/tests/event_unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ volatile static uint32_t sum = 0;
static void task(void *arg, uint32_t argc) {
uint32_t arg0 = ((uint32_t *)arg)[0];
__atomic_add_fetch(&sum, arg0, __ATOMIC_RELAXED);
printf("work arg[0] = %d argc = %d\n", arg0, argc);
}

uint32_t run_and_verify_task(uint32_t *arg, uint32_t n_workers) {
Expand Down
9 changes: 5 additions & 4 deletions sw/tests/fp16_comparison_scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "printf.h"

int main() {
int errs = 40;

if (snrt_is_compute_core()) {
int errs = 40;

uint32_t i8a = 0xFFFF4248; // 3.14
uint32_t i8an = 0xFFFFC248; // -3.14
uint32_t i8b = 0xFFFF3E79; // 1.618
Expand Down Expand Up @@ -210,7 +210,8 @@ int main() {

errs -= (cmp0 == 0x1);
errs -= (cmp1 == 0x1);
}

return errs;
return errs;
}
return 0;
}
9 changes: 5 additions & 4 deletions sw/tests/fp16_comparison_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "printf.h"

int main() {
int errs = 64;

if (snrt_is_compute_core()) {
int errs = 64;

uint32_t fa16 = 0x4048F5C3; // 0x4248 3.14
uint32_t fa16n = 0xC048F5C3; // 0xC248 -3.14
uint32_t fb16 = 0x3FCF1AA0; // 0x3E79 1.618
Expand Down Expand Up @@ -287,7 +287,8 @@ int main() {
"vfeq.h %1, ft8, ft0\n"
: "+r"(cmp0));
errs -= (cmp0 == 0xf);
}

return errs;
return errs;
}
return 0;
}
9 changes: 5 additions & 4 deletions sw/tests/fp16_computation_scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <snrt.h>

int main() {
int errs = 33;

if (snrt_is_compute_core()) {
int errs = 33;

uint32_t i_a = 0xFFFF4248; // 3.14
uint32_t i_an = 0xFFFFC248; // -3.14
uint32_t i_b = 0xFFFF3E79; // 1.618
Expand Down Expand Up @@ -317,7 +317,8 @@ int main() {
"feq.h %0, ft3, ft0\n"
: "+r"(res0));
errs -= (res0 == 0x1);
}

return errs;
return errs;
}
return 0;
}
9 changes: 5 additions & 4 deletions sw/tests/fp16_computation_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include "snrt.h"

int main() {
int errs = 46;

if (snrt_is_compute_core()) {
int errs = 46;

uint32_t i_a = 0x4048F5C3; // 3.14 0
uint32_t i_an = 0xC048F5C3; // -3.14
uint32_t i_b = 0x3FCF1AA0; // 1.618 2
Expand Down Expand Up @@ -563,7 +563,8 @@ int main() {
"vfeq.h %0, ft7, ft0\n"
: "+r"(res0));
errs -= (res0 == 0xf);
}

return errs;
return errs;
}
return 0;
}
9 changes: 5 additions & 4 deletions sw/tests/fp16alt_comparison_scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "printf.h"

int main() {
int errs = 40;

if (snrt_is_compute_core()) {
int errs = 40;

uint32_t i8a = 0xFFFF4049; // 3.14
uint32_t i8an = 0xFFFFC049; // -3.14
uint32_t i8b = 0xFFFF3FCF; // 1.618
Expand Down Expand Up @@ -213,7 +213,8 @@ int main() {

errs -= (cmp0 == 0x1);
errs -= (cmp1 == 0x1);
}

return errs;
return errs;
}
return 0;
}
9 changes: 5 additions & 4 deletions sw/tests/fp16alt_comparison_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "printf.h"

int main() {
int errs = 64;

if (snrt_is_compute_core()) {
int errs = 64;

uint32_t fa16 = 0x4048F5C3; // 0x4248 3.14
uint32_t fa16n = 0xC048F5C3; // 0xC248 -3.14
uint32_t fb16 = 0x3FCF1AA0; // 0x3E79 1.618
Expand Down Expand Up @@ -289,7 +289,8 @@ int main() {
"vfeq.ah %1, ft8, ft0\n"
: "+r"(cmp0));
errs -= (cmp0 == 0xf);
}

return errs;
return errs;
}
return 0;
}
9 changes: 5 additions & 4 deletions sw/tests/fp16alt_computation_scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <snrt.h>

int main() {
int errs = 33;

if (snrt_is_compute_core()) {
int errs = 33;

uint32_t i_a = 0xFFFF4049; // 3.14
uint32_t i_an = 0xFFFFC049; // -3.14
uint32_t i_b = 0xFFFF3FCF; // 1.618
Expand Down Expand Up @@ -319,7 +319,8 @@ int main() {
"feq.ah %0, ft3, ft0\n"
: "+r"(res0));
errs -= (res0 == 0x1);
}

return errs;
return errs;
}
return 0;
}
Loading

0 comments on commit b873897

Please sign in to comment.