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

Open
#503 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@emeraldsoft3 is already working on this.

Since Dec 2, 2026.

  • #571 by @emeraldsoft3 — open

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
22/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Domain
performance

Research direction

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.

Written by the indexing model from the issue text.

Description

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

Dominant language
Verilog
Stars
2.4k
Forks
563
Avg merge
1d 7h
Merged PRs (30d)
71

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vortexgpgpu/vortex

All issues in vortexgpgpu/vortex

Similar issues

More Performance issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.