`fmadd.s` on a tiny product loses `fflags.UF`, `fmsub.s` returns a normal number
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 28/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
Run the supplied fma-tiny-product.elf under rtlsim with the stated XLEN and FPU config to reproduce the four failing FMA forms, then locate the fused multiply-add RTL path and its underflow-flag generation. Compare it with the fmul.s path, which already raises UF|NX correctly, and check where tininess is detected relative to rounding. Done means all four forms return the architecturally expected signed zero or minimum subnormal and commit fflags = 0x3.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
fma-tiny-product.elf fma-tiny-product.zip is a bare-metal RV32IMF probe that runs seven single-instruction cases on one thread and stores each destination word followed by its fflags word to memory. Each of the four failing cases sets f0 = f1 = 0x00000001 (2^-149, the minimum subnormal) and f2 = 0x00000000, so the exact value is 2^-298 - or -2^-298 for fnmsub.s. Running it on rtlsim (XLEN=32, CONFIGS="-DVX_CFG_FPU_TYPE=STD", DEBUG=1, commit 1061088aa), the four FMA forms commit these values:
80000034: 101001c3 fmadd.s f3, f0, f1, f2, rne # f3 = 0x00000000, fflags = 0x1
80000040: csrr t1, fflags # commits 0x1
80000064: 101031c3 fmadd.s f3, f0, f1, f2, rup # f3 = 0x00000000, fflags = 0x1
80000070: csrr t1, fflags # commits 0x1
80000094: 101001c7 fmsub.s f3, f0, f1, f2, rne # f3 = 0x01800000, fflags = 0x1
800000a0: csrr t1, fflags # commits 0x1
800000c4: 101001cb fnmsub.s f3, f0, f1, f2, rne # f3 = 0x81800000, fflags = 0x1
800000d0: csrr t1, fflags # commits 0x1
All four fflags read-backs commit 0x1 (NX alone) where 0x3 (UF|NX) is required. Three of the four destination words are also wrong: the RUP form should round up to the minimum subnormal 0x00000001 and commits 0x00000000; fmsub.s should produce +0 and produces 0x01800000; fnmsub.s should produce -0 (0x80000000) and produces 0x81800000. 0x01800000 is 2^-124 (exponent field 3, mantissa 0) and 0x81800000 is -2^-124, a normal number some 2^174 times the exact 2^-298, so no rounding of 2^-298 can produce it.
The behaviour does not look like a flush-to-zero mode. Three control cases in the same run are correct: fmul.s on the identical operands (800000f4: 101001d3) commits f3 = 0x00000000 with fflags = 0x3, i.e. UF|NX; fmadd.s with an addend of 1.0 commits 0x3f800000 with NX alone; and fmadd.s of 2^-148 * 0.5 commits the exact minimum subnormal 0x00000001 with no flags. The underflow flag and the subnormal results therefore seem to work elsewhere in the same core, which suggests that the missing UF and the normal-number results in the FMA forms above come from those paths rather than from a deliberate flush-to-zero policy.
As specified in the RISC-V Unprivileged ISA, F extension, "Subnormal Arithmetic":
In the parlance of IEEE 754-2008, tininess is detected after rounding.
A result that rounds to +0 from the tiny and inexact 2^-298 is therefore still tiny and raises UF together with NX, and under RUP the same input rounds up to the minimum subnormal rather than down to zero.
Expect Behavior
fmadd.s, fmsub.s and fnmsub.s whose exact value is the tiny, inexact 2^-298 (-2^-298 for fnmsub.s) must round to the architecturally defined signed zero and raise UF with NX; under RUP they must round up to the minimum subnormal 0x00000001. No rounding of a 2^-298 product can produce a normal number such as 2^-124, and the destination register must not be written with one.
- Ngôn ngữ chính
- Verilog
- Star
- 2.4k
- Fork
- 563
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 33
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của vortexgpgpu/vortex
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
vortexgpgpu/vortex#501 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
vortexgpgpu/vortex#499 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
vortexgpgpu/vortex#505 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 22/100
vortexgpgpu/vortex#503 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
vortexgpgpu/vortex#500 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của vortexgpgpu/vortex
Issue tương tự
-
nuttx/esp32s3: sdkconfig.h has no "no console" case, so CONFIG_NO_SERIAL_CONSOLE builds failĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
-
mass-storage-gadget64: eMMC is exported as removable media, so Windows cannot write a GPT imageĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
raspberrypi/usbboot#419 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
crosspoint-reader/crosspoint-reader#4595 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày