Why does fflags serialize independent fmadd.s instructions in the same warp?
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 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 小时
- 30 天内合并 PR
- 33
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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
维护者通常 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 天内回复