Skip to content

Commit

Permalink
Merge pull request #318 from opencompl/sasha/plane-hack
Browse files Browse the repository at this point in the history
add fill baseline, linalg, and linalg_xdsl f32
  • Loading branch information
superlopuh authored Oct 22, 2024
2 parents 1fc89dd + db5f48a commit 7a3c617
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ TESTSET_FAST = [
*expand(
"relu/4x8xf32/{variant}", variant=["baseline", "linalg", "snrt", "snitch_stream"]
),
*expand(
"fill/4x8xf32/{variant}", variant=["baseline", "linalg", "linalg_xdsl"]
),
*expand(
"sum/4x8xf32/{variant}", variant=["baseline", "snrt", "linalg", "linalg_xdsl"]
),
Expand Down
2 changes: 1 addition & 1 deletion kernels/fill/baseline.c.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <stdint.h>

void fill(const double x, double* restrict y) {
void fill(const DTYPE x, DTYPE* restrict y) {
for (uint32_t i = 0; i < M; ++i) {
for (uint32_t j = 0; j < N; ++j) {
// row-major accesses
Expand Down
15 changes: 13 additions & 2 deletions kernels/fill/data.h.template
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
#pragma once

#define PRECISION {{precision}}
#if PRECISION == 16
#define DTYPE __fp16
#elif PRECISION == 32
#define DTYPE float
#elif PRECISION == 64
#define DTYPE double
#else
#error Unsupported precision
#endif

#define M {{M}}
#define N {{N}}

extern const double X;
extern const double Y[M * N];
extern const DTYPE X;
extern const DTYPE Y[M * N];

#define TEST_COUNT (M * N)
6 changes: 3 additions & 3 deletions kernels/fill/linalg.mlir.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

func.func public @fill(%X: f64,
%Y: memref<{{M}}x{{N}}xf64> {llvm.noalias}) -> () {
linalg.fill ins(%X : f64) outs(%Y : memref<{{M}}x{{N}}xf64>) -> ()
func.func public @fill(%X: f{{precision}},
%Y: memref<{{M}}x{{N}}xf{{precision}}> {llvm.noalias}) -> () {
linalg.fill ins(%X : f{{precision}}) outs(%Y : memref<{{M}}x{{N}}xf{{precision}}>) -> ()
return
}
6 changes: 3 additions & 3 deletions kernels/fill/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
#include <math.h>

// Kernel provided via external definition
void fill(double x, double *y);
void fill(DTYPE x, DTYPE *y);

int main() {
// Allocate shared local memory
// By avoiding allocators and bumping by a known offset a base pointer
// (snrt_l1_next()) that is the same for all the cores in the cluster, we are
// essentially providing the same memory regions to all the cores in this cluster.
double local_x = X;
double *local_y = (double *)snrt_l1_next();
DTYPE local_x = X;
DTYPE *local_y = (DTYPE *)snrt_l1_next();

snrt_cluster_hw_barrier();

Expand Down
3 changes: 3 additions & 0 deletions results/kernels.csv
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ dense,8x8xf64,snrt,2723,3538,3535,2.630311614730878,0.0,512,706,1857,0.259272860
fill,4x4xf64,baseline,50,760,757,0.0,0.0,0,1,0,0.02,0.058823529411764705,17,0,0,0.34,0,16,1.0,1.0,1,0.0,17,0.7391304347826086,6,0,0,0.12,0,711,0.0,0.46,0.0
fill,4x4xf64,linalg,50,760,757,0.0,0.0,0,1,0,0.02,0.058823529411764705,17,0,0,0.34,0,16,1.0,1.0,1,0.0,17,0.7391304347826086,6,0,0,0.12,0,711,0.0,0.46,0.0
fill,4x4xf64,linalg_xdsl,64,766,763,0.9444444444444444,0.0,0,18,17,0.28125,0.9,20,0,0,0.3125,0,0,3.333333333333333,3.3333333333333335,1,0.0,6,0.3,14,0,0,0.21875,0,703,0.0,0.53125,0.0
fill,4x8xf32,baseline,74,798,795,0.0,0.0,0,1,0,0.013513513513513514,0.030303030303030304,33,0,0,0.44594594594594594,0,32,1.0,1.0,1,0.0,33,0.8461538461538461,6,0,0,0.08108108108108109,0,725,0.0,0.527027027027027,0.0
fill,4x8xf32,linalg,74,798,795,0.0,0.0,0,1,0,0.013513513513513514,0.030303030303030304,33,0,0,0.44594594594594594,0,32,1.0,1.0,1,0.0,33,0.8461538461538461,6,0,0,0.08108108108108109,0,725,0.0,0.527027027027027,0.0
fill,4x8xf32,linalg_xdsl,68,788,785,0.9444444444444444,0.0,0,18,17,0.2647058823529412,0.9,20,0,0,0.29411764705882354,0,0,3.333333333333333,3.3333333333333335,1,0.0,6,0.3,14,0,0,0.20588235294117646,0,721,0.0,0.5,0.0
matmul,1x20x5xf64,linalg_0_xdsl,4136,4896,4893,2.950980392156863,1.0,100,102,301,0.024661508704061894,0.20118343195266272,507,300,300,0.12258220502901354,0,105,1.0,1.0,1,0.0,507,0.19735305566368236,2062,0,0,0.4985493230174081,0,761,0.0,0.6211315280464217,0.0
matmul,1x20x5xf64,linalg_1_xdsl,2050,2829,2826,2.8598130841121496,1.0,100,107,306,0.05219512195121951,0.3440514469453376,311,100,100,0.15170731707317073,0,100,1.0,1.0,1,0.0,311,0.22552574329224076,1068,0,0,0.5209756097560976,0,780,0.0,0.6726829268292683,0.0
matmul,1x20x5xf64,linalg_2_xdsl,541,1320,1317,2.8598130841121496,1.0,100,107,306,0.1977818853974122,0.8842975206611571,121,5,5,0.22365988909426987,0,5,1.0,1.0,1,0.0,121,0.28205128205128205,308,0,0,0.5693160813308688,0,780,0.0,0.7929759704251387,0.0
Expand Down
3 changes: 3 additions & 0 deletions results/kernels.fast.csv
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ dense,8x8xf64,snrt,2723,3538,3535,2.630311614730878,0.0,512,706,1857,0.259272860
fill,4x4xf64,baseline,50,760,757,0.0,0.0,0,1,0,0.02,0.058823529411764705,17,0,0,0.34,0,16,1.0,1.0,1,0.0,17,0.7391304347826086,6,0,0,0.12,0,711,0.0,0.46,0.0
fill,4x4xf64,linalg,50,760,757,0.0,0.0,0,1,0,0.02,0.058823529411764705,17,0,0,0.34,0,16,1.0,1.0,1,0.0,17,0.7391304347826086,6,0,0,0.12,0,711,0.0,0.46,0.0
fill,4x4xf64,linalg_xdsl,64,766,763,0.9444444444444444,0.0,0,18,17,0.28125,0.9,20,0,0,0.3125,0,0,3.333333333333333,3.3333333333333335,1,0.0,6,0.3,14,0,0,0.21875,0,703,0.0,0.53125,0.0
fill,4x8xf32,baseline,74,798,795,0.0,0.0,0,1,0,0.013513513513513514,0.030303030303030304,33,0,0,0.44594594594594594,0,32,1.0,1.0,1,0.0,33,0.8461538461538461,6,0,0,0.08108108108108109,0,725,0.0,0.527027027027027,0.0
fill,4x8xf32,linalg,74,798,795,0.0,0.0,0,1,0,0.013513513513513514,0.030303030303030304,33,0,0,0.44594594594594594,0,32,1.0,1.0,1,0.0,33,0.8461538461538461,6,0,0,0.08108108108108109,0,725,0.0,0.527027027027027,0.0
fill,4x8xf32,linalg_xdsl,68,788,785,0.9444444444444444,0.0,0,18,17,0.2647058823529412,0.9,20,0,0,0.29411764705882354,0,0,3.333333333333333,3.3333333333333335,1,0.0,6,0.3,14,0,0,0.20588235294117646,0,721,0.0,0.5,0.0
matmul,1x20x5xf64,linalg_0_xdsl,4136,4896,4893,2.950980392156863,1.0,100,102,301,0.024661508704061894,0.20118343195266272,507,300,300,0.12258220502901354,0,105,1.0,1.0,1,0.0,507,0.19735305566368236,2062,0,0,0.4985493230174081,0,761,0.0,0.6211315280464217,0.0
matmul,1x20x5xf64,linalg_1_xdsl,2050,2829,2826,2.8598130841121496,1.0,100,107,306,0.05219512195121951,0.3440514469453376,311,100,100,0.15170731707317073,0,100,1.0,1.0,1,0.0,311,0.22552574329224076,1068,0,0,0.5209756097560976,0,780,0.0,0.6726829268292683,0.0
matmul,1x20x5xf64,linalg_2_xdsl,541,1320,1317,2.8598130841121496,1.0,100,107,306,0.1977818853974122,0.8842975206611571,121,5,5,0.22365988909426987,0,5,1.0,1.0,1,0.0,121,0.28205128205128205,308,0,0,0.5693160813308688,0,780,0.0,0.7929759704251387,0.0
Expand Down
1 change: 1 addition & 0 deletions results/pivoted.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ conv2d_d1_s1_3x3 4x4xf64,667,858,308,,
ddot 128xf64,956,965,,213,577
dense 8x8xf64,3206,3530,,2741,2723
fill 4x4xf64,50,50,64,,
fill 4x8xf32,74,74,68,,
matmul 4x16x8xf64,2495,2694,708,,
matmul_transb 4x16x16xf32,3386,5038,,845,849
matmul_transb 4x16x16xf64,,5142,1295,,
Expand Down
1 change: 1 addition & 0 deletions results/pivoted.fast.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ conv2d_d1_s1_3x3 4x4xf64,667,858,308,,
ddot 128xf64,956,965,,213,577
dense 8x8xf64,3206,3530,,2741,2723
fill 4x4xf64,50,50,64,,
fill 4x8xf32,74,74,68,,
matmul 4x16x8xf64,2495,2694,708,,
matmul_transb 4x16x16xf32,3386,5038,,845,849
matmul_transb 4x16x16xf64,,5142,1295,,
Expand Down
1 change: 1 addition & 0 deletions results/pivoted_fpu.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ conv2d_d1_s1_3x3 4x4xf64,0.22,0.17,0.58,,
ddot 128xf64,0.13,0.13,,0.64,0.22
dense 8x8xf64,0.20,0.18,,0.26,0.26
fill 4x4xf64,0.02,0.02,0.28,,
fill 4x8xf32,0.01,0.01,0.26,,
matmul 4x16x8xf64,0.21,0.19,0.82,,
matmul_transb 4x16x16xf32,0.21,0.20,,0.76,0.79
matmul_transb 4x16x16xf64,,0.20,0.89,,
Expand Down
1 change: 1 addition & 0 deletions results/pivoted_fpu.fast.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ conv2d_d1_s1_3x3 4x4xf64,0.22,0.17,0.58,,
ddot 128xf64,0.13,0.13,,0.64,0.22
dense 8x8xf64,0.20,0.18,,0.26,0.26
fill 4x4xf64,0.02,0.02,0.28,,
fill 4x8xf32,0.01,0.01,0.26,,
matmul 4x16x8xf64,0.21,0.19,0.82,,
matmul_transb 4x16x16xf32,0.21,0.20,,0.76,0.79
matmul_transb 4x16x16xf64,,0.20,0.89,,
Expand Down
1 change: 1 addition & 0 deletions results/pivoted_ipc.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ conv2d_d1_s1_3x3 4x4xf64,0.40,0.45,0.80,,
ddot 128xf64,0.95,0.94,,0.74,0.25
dense 8x8xf64,0.51,0.55,,0.39,0.33
fill 4x4xf64,0.46,0.46,0.53,,
fill 4x8xf32,0.53,0.53,0.50,,
matmul 4x16x8xf64,0.56,0.58,0.93,,
matmul_transb 4x16x16xf32,0.95,0.55,,0.99,0.88
matmul_transb 4x16x16xf64,,0.56,0.97,,
Expand Down
1 change: 1 addition & 0 deletions results/pivoted_ipc.fast.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ conv2d_d1_s1_3x3 4x4xf64,0.40,0.45,0.80,,
ddot 128xf64,0.95,0.94,,0.74,0.25
dense 8x8xf64,0.51,0.55,,0.39,0.33
fill 4x4xf64,0.46,0.46,0.53,,
fill 4x8xf32,0.53,0.53,0.50,,
matmul 4x16x8xf64,0.56,0.58,0.93,,
matmul_transb 4x16x16xf32,0.95,0.55,,0.99,0.88
matmul_transb 4x16x16xf64,,0.56,0.97,,
Expand Down
1 change: 1 addition & 0 deletions results/regalloc.fast.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ conv2d_d1_s1_3x3,4x4xf64,8,8
ddot,128xf64,6,7
dense,8x8xf64,5,11
fill,4x4xf64,3,3
fill,4x8xf32,3,3
matmul,4x16x8xf64,8,8
matmul_transb,4x16x16xf32,11,12
matmul_transb,4x16x16xf64,8,8
Expand Down

0 comments on commit 7a3c617

Please sign in to comment.