[PATCH] D153666: [RISCV] Add GPR bypasses for most integer instructions to the SiFive7 scheduler model.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 14:50:41 PDT 2023


craig.topper created this revision.
craig.topper added reviewers: michaelmaitland, reames, wangpc, monkchiang.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, gbedwell, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a reviewer: andreadb.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: eopXD, MaskRay.
Herald added a project: LLVM.

SiFive7's scalar execution consists of 4 stages AG, M1 <https://reviews.llvm.org/M1>, M2 <https://reviews.llvm.org/M2>, WB.
Most simple arithmetic and branch instructions can execute in
either AG or M2 <https://reviews.llvm.org/M2>.

If the operands are ready, the instruction will execute in the AG
stage. Otherwise, it executes in the M2 <https://reviews.llvm.org/M2> stage. Everything is fully
bypassed, so dependent instructions should only see 1 cycle latency.

This patch adds ReadAdvances to pretend that these instructions
execute in the M2 <https://reviews.llvm.org/M2> ALU and reads their operands then. This allows
the scheduler to schedule dependent instructions back to back.

I've increased branch latency to 3 since they are also executed in both
stages. Still need to fix JALR, but I want to cleanup some scheduler
classes first.

Multiply, cpop and division instructions can only start in the AG stage.

Still need to do some work for FP instructions that produce integer results.

I've added an llvm-mca test that creates a long dependency chain.
The timeline view can show that things are bypassed. I
didn't check all permutations, but we have some variety.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153666

Files:
  llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
  llvm/test/CodeGen/RISCV/short-foward-branch-opt.ll
  llvm/test/tools/llvm-mca/RISCV/SiFive7/gpr-bypass.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153666.534081.patch
Type: text/x-patch
Size: 43122 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230623/bbeda0e8/attachment.bin>


More information about the llvm-commits mailing list