Why does fflags serialize independent fmadd.s instructions in the same warp?
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 22/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- performance
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
Tested on Vortex commit 1061088aa91bd6f295d91945832acdc8408223c4
- Vorherrschende Sprache
- Verilog
- Sterne
- 2.4k
- Forks
- 563
- Ø Merge
- 2 T. 12 Std.
- Gemergte PRs (30 T.)
- 33
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus vortexgpgpu/vortex
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
vortexgpgpu/vortex#501 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
vortexgpgpu/vortex#499 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
vortexgpgpu/vortex#505 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 28/100
vortexgpgpu/vortex#504 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
vortexgpgpu/vortex#500 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in vortexgpgpu/vortex
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
we-promise/sure#5843 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Minor performance
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
linagora/twake-directory-manager#397 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug untriaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
opensearch-project/sql#5990 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
-
Memory leak: `taskIdentifiers` cache keeps every `run()`'s options for the life of the processOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100