From 577433d2008641eb03743aca6cf42e9037594219 Mon Sep 17 00:00:00 2001 From: Viviane Potocnik Date: Fri, 28 Jun 2024 11:35:07 +0200 Subject: [PATCH] [tests] FA-2: fix indents [lint] FA-2 FP8 and GEMM --- sw/blas/gemm/src/gemm.h | 7 +++---- sw/dnn/flashattention_2/src/flashattention_2_fp8.h | 8 ++++---- .../tcasai/cfg/fp16-opt-gpt-3-xl-inf.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp16-opt-gpt-3-xl.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp16-opt-gpt-j-inf.json | 4 ++-- .../dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-j.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp16-opt-vit-base.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp16-opt-vit-huge.json | 4 ++-- .../tcasai/cfg/fp32-opt-gpt-3-xl-inf.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp32-opt-gpt-3-xl.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp32-opt-gpt-j-inf.json | 4 ++-- .../dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-j.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp32-opt-vit-base.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp32-opt-vit-huge.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl-inf.json | 4 ++-- .../dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl.json | 4 ++-- .../flashattention_2/tcasai/cfg/fp8-opt-gpt-j-inf.json | 4 ++-- .../dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-j.json | 4 ++-- .../dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-base.json | 4 ++-- .../dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-huge.json | 4 ++-- .../sw/apps/dnn/flashattention_2/test/cfg/fp16-base.json | 4 ++-- .../sw/apps/dnn/flashattention_2/test/cfg/fp16-opt.json | 4 ++-- .../sw/apps/dnn/flashattention_2/test/cfg/fp32-base.json | 4 ++-- .../sw/apps/dnn/flashattention_2/test/cfg/fp32-opt.json | 4 ++-- .../sw/apps/dnn/flashattention_2/test/cfg/fp8-base.json | 4 ++-- .../sw/apps/dnn/flashattention_2/test/cfg/fp8-opt.json | 4 ++-- 26 files changed, 55 insertions(+), 56 deletions(-) diff --git a/sw/blas/gemm/src/gemm.h b/sw/blas/gemm/src/gemm.h index 7203fe905b..43a9745564 100644 --- a/sw/blas/gemm/src/gemm.h +++ b/sw/blas/gemm/src/gemm.h @@ -79,9 +79,8 @@ typedef struct { // distinct cores. // TODO: beta (and alpha) should be of floating-point type (same precision as // operands) -void sc_st_gemm(gemm_args_t* gemm_args, void* a, void* b, - uint32_t beta, void* c) { - +void sc_st_gemm(gemm_args_t* gemm_args, void* a, void* b, uint32_t beta, + void* c) { gemm_fp_t impl = (gemm_fp_t)gemm_args->gemm_fp; precision_t prec = gemm_args->prec; uint32_t setup_ssr = gemm_args->setup_ssr; @@ -94,7 +93,7 @@ void sc_st_gemm(gemm_args_t* gemm_args, void* a, void* b, uint32_t lda = k; uint32_t ldb; - if(transb) { + if (transb) { ldb = k; } else { ldb = n; diff --git a/sw/dnn/flashattention_2/src/flashattention_2_fp8.h b/sw/dnn/flashattention_2/src/flashattention_2_fp8.h index 403f544aad..19707d34e0 100644 --- a/sw/dnn/flashattention_2/src/flashattention_2_fp8.h +++ b/sw/dnn/flashattention_2/src/flashattention_2_fp8.h @@ -10,8 +10,8 @@ static inline float fp8_to_float(char val) { asm volatile( "fmv.b.x %[res], %[val]\n" "fcvt.s.b %[res], %[res]\n" - : [res] "=f"(res) - : [val] "r"(val)); + : [ res ] "=f"(res) + : [ val ] "r"(val)); return res; } @@ -20,8 +20,8 @@ static inline char float_to_fp8(float val) { asm volatile( "fcvt.b.s ft3, %[val]\n" "fmv.x.b %[res], ft3\n" - : [res] "=r"(res) - : [val] "f"(val) + : [ res ] "=r"(res) + : [ val ] "f"(val) : "ft3"); return res; } diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-3-xl-inf.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-3-xl-inf.json index a6471409b4..af98121e6d 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-3-xl-inf.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-3-xl-inf.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 1, - S: 64, + L: 1, + S: 64, d: 128, B_r: 1, B_c: 32, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-3-xl.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-3-xl.json index 744f6c92fe..06bfb14b7c 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-3-xl.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-3-xl.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 64, - S: 64, + L: 64, + S: 64, d: 128, B_r: 32, B_c: 32, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-j-inf.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-j-inf.json index bf1666113b..799039db53 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-j-inf.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-j-inf.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 1, - S: 32, + L: 1, + S: 32, d: 256, B_r: 1, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-j.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-j.json index 73e21862ef..d32af344e9 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-j.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-gpt-j.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 32, - S: 32, + L: 32, + S: 32, d: 256, B_r: 16, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-vit-base.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-vit-base.json index e02717bd11..fdcba7d512 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-vit-base.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-vit-base.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 32, - S: 128, + L: 32, + S: 128, d: 64, B_r: 16, B_c: 64, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-vit-huge.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-vit-huge.json index 7bbd6dd480..ebdd40d7b7 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-vit-huge.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp16-opt-vit-huge.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 32, - S: 128, + L: 32, + S: 128, d: 80, B_r: 16, B_c: 64, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-3-xl-inf.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-3-xl-inf.json index 1389c980eb..f8f3170ccd 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-3-xl-inf.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-3-xl-inf.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 1, - S: 64, + L: 1, + S: 64, d: 128, B_r: 1, B_c: 32, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-3-xl.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-3-xl.json index faa9c3b059..61913a829e 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-3-xl.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-3-xl.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 64, - S: 64, + L: 64, + S: 64, d: 128, B_r: 32, B_c: 32, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-j-inf.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-j-inf.json index a13c559f05..60785ba836 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-j-inf.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-j-inf.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 1, - S: 32, + L: 1, + S: 32, d: 256, B_r: 1, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-j.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-j.json index bed2b92533..59a4a53b4b 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-j.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-gpt-j.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 32, - S: 32, + L: 32, + S: 32, d: 256, B_r: 16, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-vit-base.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-vit-base.json index 57bc80d7fb..fc7e4aa4f3 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-vit-base.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-vit-base.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 32, - S: 128, + L: 32, + S: 128, d: 64, B_r: 16, B_c: 64, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-vit-huge.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-vit-huge.json index 969376270a..34f7162179 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-vit-huge.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp32-opt-vit-huge.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 32, - S: 128, + L: 32, + S: 128, d: 80, B_r: 16, B_c: 64, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl-inf.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl-inf.json index 3ea3d9a84e..32f273a8ce 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl-inf.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl-inf.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 1, - S: 64, + L: 1, + S: 64, d: 128, B_r: 1, B_c: 32, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl.json index 5bebebb1c1..874a4900a0 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-3-xl.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 64, - S: 64, + L: 64, + S: 64, d: 128, B_r: 32, B_c: 32, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-j-inf.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-j-inf.json index 252eba3460..45c619f508 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-j-inf.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-j-inf.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 1, - S: 32, + L: 1, + S: 32, d: 256, B_r: 1, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-j.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-j.json index f91b8f1a1a..591898d08f 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-j.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-gpt-j.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 32, - S: 32, + L: 32, + S: 32, d: 256, B_r: 16, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-base.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-base.json index 89a8a5840e..95a2088b85 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-base.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-base.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 32, - S: 128, + L: 32, + S: 128, d: 64, B_r: 16, B_c: 64, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-huge.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-huge.json index 5d766ad12c..027a2489fb 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-huge.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/tcasai/cfg/fp8-opt-vit-huge.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 { - L: 32, - S: 128, + L: 32, + S: 128, d: 80, B_r: 16, B_c: 64, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp16-base.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp16-base.json index 3bb4535cf5..f3f1664a7a 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp16-base.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp16-base.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: SHL-0.51 { - L: 16, - S: 32, + L: 16, + S: 32, d: 16, B_r: 16, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp16-opt.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp16-opt.json index 3165e032be..e0acaa571e 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp16-opt.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp16-opt.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: SHL-0.51 { - L: 16, - S: 32, + L: 16, + S: 32, d: 16, B_r: 16, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp32-base.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp32-base.json index a65c855bb2..fe1d5c9b8d 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp32-base.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp32-base.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: SHL-0.51 { - L: 16, - S: 32, + L: 16, + S: 32, d: 16, B_r: 16, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp32-opt.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp32-opt.json index 27ae9d44c1..e465fc4b9d 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp32-opt.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp32-opt.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: SHL-0.51 { - L: 16, - S: 32, + L: 16, + S: 32, d: 16, B_r: 16, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp8-base.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp8-base.json index 2a40164b80..a27a610fc8 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp8-base.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp8-base.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: SHL-0.51 { - L: 16, - S: 32, + L: 16, + S: 32, d: 16, B_r: 16, B_c: 16, diff --git a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp8-opt.json b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp8-opt.json index b0dc308f4b..88bfdc2068 100644 --- a/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp8-opt.json +++ b/target/snitch_cluster/sw/apps/dnn/flashattention_2/test/cfg/fp8-opt.json @@ -3,8 +3,8 @@ // SPDX-License-Identifier: SHL-0.51 { - L: 16, - S: 32, + L: 16, + S: 32, d: 16, B_r: 16, B_c: 16,