Why does fflags serialize independent fmadd.s instructions in the same warp?
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 22/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 領域
- performance
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Verilog
- スター
- 2.4k
- フォーク
- 563
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 33
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vortexgpgpu/vortex のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
vortexgpgpu/vortex#501 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
vortexgpgpu/vortex#499 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
vortexgpgpu/vortex#505 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
vortexgpgpu/vortex#504 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
vortexgpgpu/vortex#500 ·
メンテナーはふだん 1 日以内に返信
vortexgpgpu/vortex の issue をすべて見る
似ている issue
-
bug untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
opensearch-project/sql#5990 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jesdga95/basalt#747 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Device]: Share verified Stage 1-5 benchmarks for Samsung One UI, Xiaomi HyperOS, and Pixel/AOSPオープンdevice-compatibility help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
siyuan-note/siyuan#21691 ·
メンテナーはふだん 1 日以内に返信