From 95f94aeda67e94553bf9a1934801c7a6d9ba7cbe Mon Sep 17 00:00:00 2001 From: SharzyL Date: Tue, 3 Sep 2024 15:35:10 +0800 Subject: [PATCH] =?UTF-8?q?[libspike]=20add=20=E2=80=9Crelax=20vsew=20>=20?= =?UTF-8?q?vlmul=20*=20ELEN=20check=E2=80=9D=20patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...-lanewise-order-for-unordered-reduce.patch | 2 +- .../0002-disable-NaN-normalization.patch | 2 +- .../0003-relax-vsew-vlmul-ELEN-check.patch | 26 +++++++++++++++++++ nix/pkgs/libspike.nix | 1 + 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 nix/patches/spike/0003-relax-vsew-vlmul-ELEN-check.patch diff --git a/nix/patches/spike/0001-enforce-lanewise-order-for-unordered-reduce.patch b/nix/patches/spike/0001-enforce-lanewise-order-for-unordered-reduce.patch index 3991f9e4c..e387769b5 100644 --- a/nix/patches/spike/0001-enforce-lanewise-order-for-unordered-reduce.patch +++ b/nix/patches/spike/0001-enforce-lanewise-order-for-unordered-reduce.patch @@ -1,7 +1,7 @@ From 0ad6da899c20df0ce6120bc4ebd32edf01bdcd36 Mon Sep 17 00:00:00 2001 From: SharzyL Date: Sun, 25 Feb 2024 01:28:18 +0800 -Subject: [PATCH 1/2] enforce lanewise order for unordered reduce +Subject: [PATCH 1/3] enforce lanewise order for unordered reduce --- riscv/insns/vfredusum_vs.h | 2 +- diff --git a/nix/patches/spike/0002-disable-NaN-normalization.patch b/nix/patches/spike/0002-disable-NaN-normalization.patch index c61068ce7..5cb57a514 100644 --- a/nix/patches/spike/0002-disable-NaN-normalization.patch +++ b/nix/patches/spike/0002-disable-NaN-normalization.patch @@ -1,7 +1,7 @@ From 09a503dc94382798a1ee2f23b4b6894a12bc8207 Mon Sep 17 00:00:00 2001 From: SharzyL Date: Mon, 26 Aug 2024 20:08:47 +0800 -Subject: [PATCH 2/2] disable NaN normalization +Subject: [PATCH 2/3] disable NaN normalization --- riscv/v_ext_macros.h | 6 +++--- diff --git a/nix/patches/spike/0003-relax-vsew-vlmul-ELEN-check.patch b/nix/patches/spike/0003-relax-vsew-vlmul-ELEN-check.patch new file mode 100644 index 000000000..7d56b10d7 --- /dev/null +++ b/nix/patches/spike/0003-relax-vsew-vlmul-ELEN-check.patch @@ -0,0 +1,26 @@ +From cbf79540b42a56df47df541848d47b34a0d04128 Mon Sep 17 00:00:00 2001 +From: SharzyL +Date: Tue, 3 Sep 2024 15:33:33 +0800 +Subject: [PATCH 3/3] relax 'vsew > vlmul * ELEN' check + +--- + riscv/vector_unit.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/riscv/vector_unit.cc b/riscv/vector_unit.cc +index 08adc616..8fbbe16d 100644 +--- a/riscv/vector_unit.cc ++++ b/riscv/vector_unit.cc +@@ -39,7 +39,8 @@ reg_t vectorUnit_t::vectorUnit_t::set_vl(int rd, int rs1, reg_t reqVL, reg_t new + vma = extract64(newType, 7, 1); + + vill = !(vflmul >= 0.125 && vflmul <= 8) +- || vsew > std::min(vflmul, 1.0f) * ELEN ++ || vsew > ELEN ++ || vflmul < ((float) /* vsew_min */ 8 / ELEN) + || (newType >> 8) != 0; + + if (vill) { +-- +2.43.0 + diff --git a/nix/pkgs/libspike.nix b/nix/pkgs/libspike.nix index 82e171142..3f585968c 100644 --- a/nix/pkgs/libspike.nix +++ b/nix/pkgs/libspike.nix @@ -31,6 +31,7 @@ stdenv.mkDerivation { patches = [ ../patches/spike/0001-enforce-lanewise-order-for-unordered-reduce.patch ../patches/spike/0002-disable-NaN-normalization.patch + ../patches/spike/0003-relax-vsew-vlmul-ELEN-check.patch ]; installPhase = ''