Why does fflags serialize independent fmadd.s instructions in the same warp?

Đang mở
#503 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
22/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
performance

Hướng nghiên cứu

This is a microarchitecture question, not a scoped edit. Start by reading the decode-stage reservation of XREG_0 for fflags and the FPU writeback/scoreboard path in the RV32 core; run the attached fflags-repro.zip under rtlsim and reproduce the 16-cycle issue interval. Done means either identifying the ordering constraint that requires serialization or demonstrating a safe overlap that preserves FP flag semantics and measuring it with the same loop.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi, I'm trying to get Vortex's FP32 throughput close to its theoretical peak. I noticed a stall while testing a loop of independent FMAs on a 4-wide issue configuration. I reran the loop in rtlsim on the default RV32 core with only one warp active so I could count the cycles between FMAs in the issue trace. Here are two consecutive instructions from the loop.

fmadd.s f8, f0, f1, f2, rne
fmadd.s f9, f0, f1, f2, rne

The second instruction waits for the first one to write back even though they write different registers. In the trace, consecutive FMAs from this warp issue 16 cycles apart. Both reserve XREG_0 for fflags in decode. As a quick test I skipped that reservation for the FMAs and left the FPU flag update alone. The issue interval dropped to 9 cycles.

On some configurations the fflags check barely affects throughput. For example, with all four warps active on the default core, the two-entry FPU queue already limits how fast the core can issue FMAs.

What got me looking at this was trying to keep all four FMA pipelines busy on the 4-wide core. Together they can take four warp FMAs per cycle. With 32 active warps and both the FPU and dispatch queues at depth 8, I measured 1.88 warp FMAs per cycle. Bypassing just the fflags check brought that up to 3.16. That's about 1.3 more FMAs the core could have issued each cycle while those warps were waiting on fflags.

I measured throughput in warp FMAs issued per core cycle. The last column shows the throughput loss relative to the run with the interlock bypassed.

Hardware Active warps Loop Current interlock Bypassed Throughput loss
Default RV32 1 Independent FMAs 0.0623 0.1099 43.3%
Default RV32 4 Independent FMAs 0.1996 0.2000 0.2%
Default RV32, only the FPU queue raised from 2 to 8 4 Independent FMAs 0.2492 0.4389 43.2%
Four 32-lane compute slices, FPU and dispatch queues both at 8 32 Independent FMAs 1.875 3.164 40.7%
Same four-slice core 32 Single-accumulator FMA chain 1.769 1.769 0.0%

I understand why a later frflags has to wait for the flags. What I'm wondering is why the next FMA has to wait too. If the loop never touches the FP CSRs explicitly and the FPU ORs the flags together anyway, is there another ordering constraint I'm missing?

If there's no other reason these FMAs need to serialize, I'd be happy to try a change that lets them overlap.

I've attached the small test and the commands I used to run it.

fflags-repro.zip

Tested on Vortex commit 1061088aa91bd6f295d91945832acdc8408223c4

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vortexgpgpu/vortex

Tất cả issue của vortexgpgpu/vortex

Issue tương tự

Thêm issue về Performance

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.