From e83493b69fc827bf6623f8fe77a1edb23502306a Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Fri, 27 Nov 2026 17:54:15 +0100 Subject: [PATCH 1/2] [apps] Fix log algorithm bug, tighten FP result checks for several kernels, add check for FFT imaginary parts; [hw] Fix axi_cut parameter names for gate-level simulation --- .github/workflows/ci.yml | 2 +- apps/cos/main.c | 2 +- apps/exp/main.c | 2 +- apps/fft/main.c | 5 +++-- apps/log/kernel/log.h | 2 ++ apps/log/main.c | 2 +- hardware/src/ara_soc.sv | 4 ++-- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7464f3129..60439d88e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -318,7 +318,7 @@ jobs: strategy: max-parallel: 2 matrix: - app: [hello_world, imatmul, fmatmul, iconv2d, fconv2d, fconv3d, jacobi2d, dropout, fft, dwt, exp, cos, softmax, rmsnorm, layernorm, swiglu, geglu, dotproduct, fdotproduct, pathfinder, roi_align, lavamd] + app: [hello_world, imatmul, fmatmul, iconv2d, fconv2d, fconv3d, jacobi2d, dropout, fft, dwt, exp, log, cos, softmax, rmsnorm, layernorm, swiglu, geglu, dotproduct, fdotproduct, pathfinder, roi_align, lavamd] ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] needs: ["compile-ara", "compile-apps"] steps: diff --git a/apps/cos/main.c b/apps/cos/main.c index aa6f1a46a..7e030ccbd 100644 --- a/apps/cos/main.c +++ b/apps/cos/main.c @@ -42,7 +42,7 @@ extern float angles_f32[] __attribute__((aligned(4 * NR_LANES))); extern float results_f32[] __attribute__((aligned(4 * NR_LANES))); extern float gold_results_f32[] __attribute__((aligned(4 * NR_LANES))); -#define THRESHOLD 1 +#define THRESHOLD 1e-4 #define CHECK diff --git a/apps/exp/main.c b/apps/exp/main.c index 9c2e42984..6205852c3 100644 --- a/apps/exp/main.c +++ b/apps/exp/main.c @@ -41,7 +41,7 @@ extern float exponents_f32[] __attribute__((aligned(4 * NR_LANES))); extern float results_f32[] __attribute__((aligned(4 * NR_LANES))); extern float gold_results_f32[] __attribute__((aligned(4 * NR_LANES))); -#define THRESHOLD 1 +#define THRESHOLD 1e-4 #define CHECK diff --git a/apps/fft/main.c b/apps/fft/main.c index 37f24d8d5..d0378852c 100644 --- a/apps/fft/main.c +++ b/apps/fft/main.c @@ -55,7 +55,7 @@ signed short SwapTable[MAX_NFFT] __attribute__((aligned(32 * NR_LANES), section(".l2"))); // Threshold for FP numbers comparison during the final check -#define THRESHOLD 1 +#define THRESHOLD 1e-4 int main() { printf("\n"); @@ -235,7 +235,8 @@ int main() { printf("Real part error at index %d\n", i); error = 1; } - if (!similarity_check(samples_reim[i], samples_copy[i][0], THRESHOLD)) { + if (!similarity_check(samples_reim[i + NFFT], samples_copy[i][1], + THRESHOLD)) { printf("Img part error at index %d\n", i); error = 1; } diff --git a/apps/log/kernel/log.h b/apps/log/kernel/log.h index f8527d0f6..d11f9c897 100644 --- a/apps/log/kernel/log.h +++ b/apps/log/kernel/log.h @@ -84,6 +84,7 @@ inline _MMR_f64 __log_1xf64(_MMR_f64 x, unsigned long int gvl) { y = _MM_MADD_f64(y, x, _MM_SET_f64(2.0000714765E-1, gvl), gvl); y = _MM_MADD_f64(y, x, _MM_SET_f64(-2.4999993993E-1, gvl), gvl); y = _MM_MADD_f64(y, x, _MM_SET_f64(3.3333331174E-1, gvl), gvl); + y = _MM_MUL_f64(y, x, gvl); y = _MM_MUL_f64(y, z, gvl); y = _MM_MACC_f64(y, e, _MM_SET_f64(-2.12194440e-4, gvl), gvl); tmp = _MM_MUL_f64(z, _MM_SET_f64(0.5f, gvl), gvl); @@ -141,6 +142,7 @@ inline _MMR_f32 __log_2xf32(_MMR_f32 x, unsigned long int gvl) { y = _MM_MADD_f32(y, x, _MM_SET_f32(2.0000714765E-1, gvl), gvl); y = _MM_MADD_f32(y, x, _MM_SET_f32(-2.4999993993E-1, gvl), gvl); y = _MM_MADD_f32(y, x, _MM_SET_f32(3.3333331174E-1, gvl), gvl); + y = _MM_MUL_f32(y, x, gvl); y = _MM_MUL_f32(y, z, gvl); y = _MM_MACC_f32(y, e, _MM_SET_f32(-2.12194440e-4, gvl), gvl); tmp = _MM_MUL_f32(z, _MM_SET_f32(0.5f, gvl), gvl); diff --git a/apps/log/main.c b/apps/log/main.c index 823273f3c..ced753c07 100644 --- a/apps/log/main.c +++ b/apps/log/main.c @@ -31,7 +31,7 @@ #include "printf.h" #endif -#define THRESHOLD 1 +#define THRESHOLD 1e-4 #define CHECK diff --git a/hardware/src/ara_soc.sv b/hardware/src/ara_soc.sv index 5ee64e17c..163045d25 100644 --- a/hardware/src/ara_soc.sv +++ b/hardware/src/ara_soc.sv @@ -567,8 +567,8 @@ module ara_soc import axi_pkg::*; import ara_pkg::*; #( .b_chan_t (system_b_chan_t ), .r_chan_t (system_r_chan_t ), .w_chan_t (system_w_chan_t ), - .req_t (system_req_t ), - .resp_t (system_resp_t ) + .axi_req_t (system_req_t ), + .axi_resp_t (system_resp_t ) ) i_system_cut ( .clk_i (clk_i), .rst_ni (rst_ni), From de41f920010952fa144810b62205eb5a259f240a Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Fri, 27 Nov 2026 18:09:45 +0100 Subject: [PATCH 2/2] [CHANGELOG] Update Changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42928d8d0..29cb86e42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed src emul check for vector integer extension operation - Fix VSTU queue overrun due to pointer comparison - Fix latency stall bug in vmfpu + - Fix the missing `x` factor in the `log` polynomial (FP64 and FP32) + - Check the imaginary parts of the `fft` result + - Fix the `axi_cut` parameter names in `ara_soc` for gate-level simulation ### Added @@ -83,6 +86,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Add fmatmul-loop application - Add high-performance patches to cheshire and opensbi for AraOS - Add LLM kernels `rmsnorm`, `layernorm`, `swiglu` and `geglu` (FP32) and simulate them in the CI + - Simulate `log` in the CI ### Changed @@ -137,6 +141,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Update documentation - Fuse the multiply-add pairs of `cos` (`vfmacc`, `vfmadd`, `vfnmsac`) - Ignore the generated `apps/*/data.S` + - Tighten the result-check threshold of `cos`, `exp`, `log` and `fft` from 1 to 1e-4 ## 3.0.0 - 2023-09-08