Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
ba01027
add placeholdeer code for spatz platform
Bumblebee00 Mar 2, 2026
9fc201d
code generation with generic c code
Bumblebee00 Mar 2, 2026
8dd7d32
modified spatz c code to use proper memory allocation and copying fun…
Bumblebee00 Mar 12, 2026
f04f3c0
tmp commit to send to badie103
Bumblebee00 Mar 16, 2026
9e26bb0
modified Makefile and cmakefiles to build and use spatz runtime. ugly…
Mar 23, 2026
9136b05
vsim simulator runnable by deeployRunner
Mar 23, 2026
f7456f9
Removed reverence to conda environment and added commands to create v…
Mar 23, 2026
6e565f4
typo
Mar 27, 2026
0bc60d4
double gvsoc temporaney configuration
Mar 27, 2026
c780baa
reunited gvsoc build for spatz and other platforms
Mar 27, 2026
8c6bfdd
forgot comment
Mar 27, 2026
cc1d7b6
forgot comment
Mar 27, 2026
49f2ce8
added topk generic binding (hardcoded k=10)
Mar 29, 2026
e1fa310
added matmul softmax and topk generic bindings to spatz
Mar 29, 2026
4788bac
switched default simulator to gvsoc bc is faster
Mar 29, 2026
204d522
added topk test network
Mar 29, 2026
bff3402
added sparse attention test network
Mar 29, 2026
5e12f08
added topk binding to generic platform
Mar 29, 2026
3167dda
improved generic gather node to support more than one index
Mar 29, 2026
68b5e7d
added gather binding for spatz
Mar 29, 2026
621cc87
now for any k inot the graph
Apr 1, 2026
4780de4
added big attention
Apr 13, 2026
24b4031
first draft of tiling (not working)
Apr 13, 2026
dbe43e9
minimalloc fix
Apr 13, 2026
ba347e1
fixed makefile adding missing things
Apr 13, 2026
9d0b187
added yaml for my conda environment
Apr 14, 2026
a1f7cb7
modified bindings to use snrt_dma_wait_all function
Apr 14, 2026
b872a2e
added different dimensions of FP32/MatMul
Apr 16, 2026
bb818db
fixed simulation staling issue
Apr 16, 2026
94d6357
fixed memory levels
Apr 16, 2026
b9bb792
added cycles indication
Apr 21, 2026
0c35b57
added fp32 matmul kernel that uses vector instructions
Apr 21, 2026
39d45a8
went back to not using snrt_l3alloc because its not working
Apr 21, 2026
2c0d624
[tiling] enable tiling extension on Spatz
bowwwang Apr 23, 2026
cdfa5e0
[template] Add proper allocation template and fix DMA template
bowwwang Apr 23, 2026
cea39d7
[sw] use memcpy instead of DMA for DRAM buffer init
bowwwang Apr 23, 2026
df652e8
changed commit hash to include new version of spatz that has snrt_l3a…
Apr 23, 2026
27c6ccc
removed redundant memcpy
Apr 23, 2026
bddacf8
added gather only test
Apr 23, 2026
878a3fd
improved gather template
Apr 23, 2026
eb0c971
added nice dimensions of Matmul
Apr 27, 2026
0e2a78a
improved main
Apr 27, 2026
dec2ba2
spatz matmulfunction now splits work between cores
Apr 27, 2026
8bca32e
fixed name of input in graph
Apr 27, 2026
366af52
removed unnecessary print
Apr 27, 2026
9a7b3aa
gather tiling
Apr 27, 2026
585e49f
topk tiling
Apr 27, 2026
fe70c52
updated tiling to work with constant buffers
Apr 27, 2026
4871b1b
updated tiling to work with nodes with >1 output
Apr 27, 2026
ca2112c
fixed topk template
Apr 28, 2026
4ea8c14
added softmax tiled (not working)
Apr 30, 2026
7523a2b
added another softmax test
Apr 30, 2026
76d7cef
added softmax function with custom exp and inv functions
May 1, 2026
585321c
detect quiet nan float output
May 8, 2026
9e6c79c
use non vector for when one dim is one
May 8, 2026
80e43a4
fixed matmul kernel
May 13, 2026
6698acd
divide on p to have double performance
May 18, 2026
06e391e
added benchmarking code transformation pass
May 20, 2026
82eeecd
include necessary for benchmark code
May 20, 2026
eb75093
improved code transformation passes for allocation of all necessary b…
May 20, 2026
3dfaf23
split gather workload on two cores
May 20, 2026
d352d87
cleaner matmul template
May 22, 2026
c322c7a
initial version of dynamic dma code
May 22, 2026
6ed9ede
fixed sizes of gather template
May 22, 2026
e1aee4f
fixed sizes of gather template
May 22, 2026
61a4220
fixed gather tile contraint (removed contraint on tile fo data_in)
May 26, 2026
82593e7
removed unnecessary prints
May 26, 2026
9ae2f48
modified matmul variable to be bigger integers
May 26, 2026
43fafe8
removed very long memcopy
May 26, 2026
3f4467a
added hw barrier
May 26, 2026
2036eea
added new tests
May 26, 2026
1973309
added another main.c for spatz
May 26, 2026
17ce78a
improved hack to avoid memcpy
May 26, 2026
ffaaa34
new faster expf function, and softmax smartly devided between cores
May 27, 2026
d20847c
minor fixes
May 27, 2026
9dbea0a
added new template for topk that uses min heap
May 27, 2026
e303796
smal fix
May 27, 2026
18621e9
added topk function
May 28, 2026
3cb8165
added new test networks
Jun 2, 2026
bbd9306
work on matmul kernel
Jun 10, 2026
c6a9828
[fix] enforce 8-byte alignment for memory allocation
bowwwang Jun 12, 2026
267ea2d
[fix] 8-byte aligned tiling constraints
bowwwang Jun 12, 2026
0732873
cleaned topk template
Jun 12, 2026
07ae93f
added matmul columns reduction function
Jun 12, 2026
61d5f08
better condition for column matmul
Jun 12, 2026
e40dd50
how to do double buffering on spatz
Jun 17, 2026
c7c37ea
investigated double buffering
Jun 22, 2026
8a41c8d
[cleanup] removed deadcode, cleaned allocation template and bindings
bowwwang Jun 12, 2026
16a97ef
[cleanup] revert debug print
bowwwang Jun 12, 2026
f44e89a
[cleanup] only keep necessary changes in tiling extension
bowwwang Jun 12, 2026
e36e505
[cleanup] fix lint issues (partially)
bowwwang Jun 12, 2026
d149968
removed unnecessary tests
Jun 22, 2026
179a7c2
modified tests
Jun 22, 2026
bc2b8bd
removed unised comments
Jun 22, 2026
5ff85c6
necessary spatz makefile modification
Jun 22, 2026
68875c5
unecessary comment
Jun 22, 2026
520518b
missing slash in makefile
Jun 22, 2026
fd83c34
removed old gather templates
Jun 22, 2026
096571e
removed comments
Jun 22, 2026
2ee09ac
removed unnecessary matmuls
Jun 22, 2026
f8c6a6f
rmoved unnecessary softmax
Jun 22, 2026
d06e15a
renamed .yml
Jun 22, 2026
903eaeb
tmp commit
Jul 2, 2026
e917a03
fix merge error
Bumblebee00 Jul 2, 2026
ce4526f
fix merge error 2
Bumblebee00 Jul 2, 2026
ae6d3b9
updated readme and changelog
Bumblebee00 Jul 2, 2026
b76080b
added CI for Spatz
Bumblebee00 Jul 2, 2026
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
Prev Previous commit
Next Next commit
modified spatz c code to use proper memory allocation and copying fun…
…ctions
  • Loading branch information
Bumblebee00 authored and Bumblebee00 committed Jul 2, 2026
commit 8dd7d325e3d2b5aa67368ff758955d1bfc2afe3d
88 changes: 46 additions & 42 deletions DeeployTest/Platforms/Spatz/main.c
Original file line number Diff line number Diff line change
@@ -1,65 +1,69 @@
/*
* SPDX-FileCopyrightText: 2023 ETH Zurich and University of Bologna
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <stdint.h>
#include <string.h>
#include "printf.h"

#include "Network.h"
#include "testinputs.h"
#include "testoutputs.h"

int main() {
const unsigned int cid = snrt_cluster_core_idx();

printf("Initializing network...\r\n");
// do it only with one of the two spatz cores
if (cid==0){
printf("Initializing network...\r\n");

InitNetwork(0, 1);
InitNetwork(0, 1);

for (uint32_t buf = 0; buf < DeeployNetwork_num_inputs; buf++) {
memcpy(DeeployNetwork_inputs[buf], testInputVector[buf],
DeeployNetwork_inputs_bytes[buf]);
}
for (uint32_t buf = 0; buf < DeeployNetwork_num_inputs; buf++) {
snrt_dma_start_1d(DeeployNetwork_inputs[buf], testInputVector[buf], DeeployNetwork_inputs_bytes[buf]);
}

printf("Running network...\r\n");
RunNetwork(0, 1);
printf("Running network...\r\n");
RunNetwork(0, 1);

int32_t tot_err = 0;
uint32_t tot = 0;
OUTPUTTYPE diff;
OUTPUTTYPE expected, actual;
int32_t tot_err = 0;
uint32_t tot = 0;
OUTPUTTYPE diff;
OUTPUTTYPE expected, actual;

for (uint32_t buf = 0; buf < DeeployNetwork_num_outputs; buf++) {
tot += DeeployNetwork_outputs_bytes[buf] / sizeof(OUTPUTTYPE);
for (uint32_t i = 0;
i < DeeployNetwork_outputs_bytes[buf] / sizeof(OUTPUTTYPE); i++) {
expected = ((OUTPUTTYPE *)testOutputVector[buf])[i];
actual = ((OUTPUTTYPE *)DeeployNetwork_outputs[buf])[i];
diff = expected - actual;
for (uint32_t buf = 0; buf < DeeployNetwork_num_outputs; buf++) {
tot += DeeployNetwork_outputs_bytes[buf] / sizeof(OUTPUTTYPE);
for (uint32_t i = 0;
i < DeeployNetwork_outputs_bytes[buf] / sizeof(OUTPUTTYPE); i++) {
expected = ((OUTPUTTYPE *)testOutputVector[buf])[i];
actual = ((OUTPUTTYPE *)DeeployNetwork_outputs[buf])[i];
diff = expected - actual;

#if ISOUTPUTFLOAT == 1
// RUNWANG: Allow margin of error for float32_t
if ((diff < -1e-4) || (diff > 1e-4)) {
tot_err += 1;
printf("Expected: %10.6f ", (float)expected);
printf("Actual: %10.6f ", (float)actual);
printf("Diff: %10.6f at Index %12u in Output %u\r\n", (float)diff, i,
buf);
}
// RUNWANG: Allow margin of error for float32_t
if ((diff < -1e-4) || (diff > 1e-4)) {
tot_err += 1;
printf("Expected: %10.6f ", (float)expected);
printf("Actual: %10.6f ", (float)actual);
printf("Diff: %10.6f at Index %12u in Output %u\r\n", (float)diff, i,
buf);
}
#else
// RUNWANG: No margin for integer comparison
if (diff != 0) {
tot_err += 1;
printf("Expected: %4d ", expected);
printf("Actual: %4d ", actual);
printf("Diff: %4d at Index %12u in Output %u\r\n", diff, i, buf);
}
// RUNWANG: No margin for integer comparison
if (diff != 0) {
tot_err += 1;
printf("Expected: %4d ", expected);
printf("Actual: %4d ", actual);
printf("Diff: %4d at Index %12u in Output %u\r\n", diff, i, buf);
}
#endif
}
}
}

printf("Errors: %d out of %d \r\n", tot_err, tot);
printf("Errors: %d out of %d \r\n", tot_err, tot);

return tot_err;
return tot_err;
} else {
// wait for core 0 to finish
snrt_cluster_hw_barrier();
return 0;
}

}
2 changes: 2 additions & 0 deletions TargetLibraries/Spatz/inc/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <stddef.h>
void *deeploy_malloc(const size_t size) ;
3 changes: 3 additions & 0 deletions TargetLibraries/Spatz/src/Util.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "utils.h"

void *deeploy_malloc(const size_t size) { return snrt_l1alloc(size); }