Skip to content

fix: avoid vector loads during restore#12

Open
good-circle wants to merge 1 commit into
mainfrom
20260628-cpt
Open

fix: avoid vector loads during restore#12
good-circle wants to merge 1 commit into
mainfrom
20260628-cpt

Conversation

@good-circle

Copy link
Copy Markdown

XiangShan does not support vector loads from the flash/MMIO region used by GCPT restore. Restoring vector registers with vl1re64.v from that region can fail during checkpoint restore.

Load each saved vector register with scalar loads first, then move the data into the vector register with vector move/slide instructions. This keeps the restore path compatible with both flash and DRAM backed checkpoints.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the RVV restore path to avoid vector memory loads from the flash/MMIO-backed checkpoint region (which XiangShan can’t handle), by switching to scalar loads plus vector register construction using vector ALU instructions.

Changes:

  • Add an initial vsetvli to establish a temporary SEW=64, LMUL=1, VL=2 configuration for restore-time vector ops.
  • Replace vl1re64.v whole-register loads with ld + vmv.v.x/vslide1down.vx to populate vector registers without vector memory accesses.
  • Refactor the vector restore sequence using a new RESTORE_VECTOR_REG macro.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/csr.h Outdated
Comment thread src/csr.h
XiangShan does not support vector loads from the flash/MMIO region used by GCPT restore. Restoring vector registers with vl1re64.v from that region can fail during checkpoint restore.

Load each saved vector register with scalar loads first, then move the data into the vector register with vector move/slide instructions. This keeps the restore path compatible with both flash and DRAM backed checkpoints.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants