Skip to content

Xs vector 2605021#879

Open
jueshiwenli wants to merge 3 commits into
xs-devfrom
xs-vector-2605021
Open

Xs vector 2605021#879
jueshiwenli wants to merge 3 commits into
xs-devfrom
xs-vector-2605021

Conversation

@jueshiwenli

@jueshiwenli jueshiwenli commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Added a dedicated vector-memory issuance path with delayed-release scheduling so vector memory ops become available after a short, controlled delay.
    • Enforced per-port and per-type issuance limits and stricter readiness checks to ensure sources and bypass/scoreboard availability before issuing.
  • Bug Fixes
    • Improved handling of commits/squashes and skipped/invalid entries so in-flight vector work is reliably cleaned up.
  • Behavior
    • Queues for vector work now mark the unit as busy while non-empty; load issue is blocked during certain cache-refill activity.

- Add VectorSplitQ to prepare for the secondary splitting of vector memory access instructions.

Change-Id: I17cb39915e8198de27144ed2ea1078eb6c559b0d
Change-Id: Ifb05c47c012236d68b073d3b9fcaaf7c518d6b3e
Copilot AI review requested due to automatic review settings May 30, 2026 01:40
@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a vector-ready instruction path to IssueQue: new queues and seq tracking, constructor event wiring to schedule releases, routing of ready vector memory ops into the vector queue, timed transfer into a delayed-ready queue, pre-issuance with gating/limits, and commit/squash cleanup.

Changes

Vector-Ready Instruction Queue

Layer / File(s) Summary
Data structures and public API
src/cpu/o3/issue_queue.hh
Declare vectorReadyQ, vectorReadyQReleaseTicks, vectorDelayedReadyQ, vectorReadyQSeqs, vectorReadyQEvent, and add hasReadyVectorInst() / popReadyVectorInst() APIs.
Constructor: event registration
src/cpu/o3/issue_queue.cc
Constructor registers vectorReadyQEvent to call processVectorReadyQ() for scheduled processing.
Process vectorReadyQ -> delayed queue
src/cpu/o3/issue_queue.cc
processVectorReadyQ() moves matured entries from vectorReadyQ into vectorDelayedReadyQ, skips/erases invalid entries, and reschedules the event.
Routing new ready vector instructions
src/cpu/o3/issue_queue.cc
addIfReady() diverts eligible vector memory instructions into vectorReadyQ, records seq numbers and schedules release ticks instead of pushing to the normal READYQ.
Pre-issuance from vectorDelayedReadyQ
src/cpu/o3/issue_queue.cc
issueToFu() pre-issues vector memory ops from vectorDelayedReadyQ before the normal toFu stream: cleans invalid entries, requires bypass-scoreboard readiness across sources, blocks loads on dcache refill tag-write, enforces per-port/per-type limits, erases seqs when popping, and updates issuance bookkeeping; normal toFu stop uses running issued.
Idle accounting and lifecycle cleanup
src/cpu/o3/issue_queue.cc
idle() treats vector queues as busy; popReadyVectorInst() pops valid delayed entries; doCommit() and doSquash() erase vectorReadyQSeqs for affected instructions.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • huxuan0307
  • Anzooooo
  • weidingliu

Poem

🐰 I hop through queues with glee and vim,
Timed releases line-up limb by limb,
I nudge the vectors, one, two, three,
Gate checks and limits set them free,
A tiny rabbit cheer for queued unity!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Xs vector 2605021' is vague and non-descriptive, using what appears to be a code reference or issue number rather than a meaningful summary of the changes. Revise the title to clearly describe the main change, such as 'Add vector-ready instruction pipeline to issue queue' or similar descriptive phrase that explains the primary functionality added.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch xs-vector-2605021
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch xs-vector-2605021

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
src/cpu/o3/issue_queue.cc

src/cpu/o3/issue_queue.cc:1:10: fatal error: 'cpu/o3/issue_queue.hh' file not found
1 | #include "cpu/o3/issue_queue.hh"
| ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/2abaf821ee864eede73eb66b302bad0010f0be21-3bf01c94667e1ed6/tmp/clang_command_.tmp.849e5e.txt
++Contents of '/tmp/coderabbit-infer/2abaf821ee864eede73eb66b302bad0010f0be21-3bf01c94667e1ed6/tmp/clang_command_.tmp.849e5e.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mre

... [truncated 1089 characters] ...

g/install/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/3bf01c94667e1ed6/file.o" "-x" "c++"
"src/cpu/o3/issue_queue.cc" "-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

🚀 RVV Performance test triggered: spec06int-rvv-0.8c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds a separate ready queue for vector memory instructions in the O3 issue queue so they can be prioritized after replay traffic and before the normal FU issue stream.

Changes:

  • Adds vectorReadyQ tracking and duplicate suppression by sequence number.
  • Routes ready vector memory instructions into the new queue.
  • Issues vector memory instructions from the new queue before normal toFu instructions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/cpu/o3/issue_queue.hh Adds vector-ready queue state and accessors.
src/cpu/o3/issue_queue.cc Adds vector memory ready-queue insertion, issue handling, and cleanup on commit/squash.

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

Comment thread src/cpu/o3/issue_queue.cc
Comment on lines +420 to +433
bool bypassReady = true;
for (int i = 0; i < inst->numSrcRegs(); i++) {
auto src = inst->renamedSrcIdx(i);
if (src->isFixedMapping()) {
continue;
}
if (!scheduler->bypassScoreboard[src->flatIndex()]) {
bypassReady = false;
break;
}
}
if (!bypassReady) {
// Keep FIFO order in vectorReadyQ and retry in later cycles.
break;
Comment thread src/cpu/o3/issue_queue.cc
Comment on lines +455 to +456
addToFu(inst);
cpu->perfCCT->updateInstPos(inst->seqNum, PerfRecord::AtIssueReadReg);

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/cpu/o3/issue_queue.cc (2)

618-618: 💤 Low value

Minor formatting: missing space before brace.

The else{ should have a space before the opening brace to follow standard C++ formatting conventions.

🔧 Suggested fix
-            else{
+            else {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cpu/o3/issue_queue.cc` at line 618, Replace the malformed "else{" with
the properly spaced "else {" in the affected branch (update the `else` statement
that currently reads "else{" to "else {") to conform to the project's C++
formatting conventions; locate the `else{` token in src/cpu/o3/issue_queue.cc
and adjust the spacing only.

528-539: 💤 Low value

Consider including vectorReadyQ in the idle() check.

The idle() method checks readyQs and replayQ but not the new vectorReadyQ. If there are instructions pending in vectorReadyQ while the other queues are empty, the IQ may incorrectly report as not-idle.

🔧 Suggested fix
 bool
 IssueQue::idle()
 {
     bool idle = false;
     for (auto it : readyQs) {
         if (it->size()) {
             idle = true;
         }
     }
     idle |= replayQ.size() > 0;
+    idle |= vectorReadyQ.size() > 0;
     return idle;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cpu/o3/issue_queue.cc` around lines 528 - 539, IssueQue::idle currently
only checks readyQs and replayQ and misses vectorReadyQ, so IQ can report idle
when vectorReadyQ has entries; update IssueQue::idle to include a check for
vectorReadyQ (e.g., test vectorReadyQ.size() > 0 or !vectorReadyQ.empty()) and
OR that result into the existing idle/replayQ logic so any pending entries in
vectorReadyQ mark the queue as non-idle; refer to the IssueQue::idle method and
the readyQs, replayQ and vectorReadyQ members when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cpu/o3/issue_queue.cc`:
- Around line 835-856: popReadyVectorInst can return canceled instructions
because it only checks for null and isSquashed; add a canceled check like
issueToFu does. In the IssueQue::popReadyVectorInst function, after confirming
inst is non-null and before erasing vectorReadyQSeqs/returning, call
inst->canceled() and continue the loop if true so canceled instructions are
skipped (mirroring the filtering in issueToFu and keeping vectorReadyQSeqs
handling consistent).

---

Nitpick comments:
In `@src/cpu/o3/issue_queue.cc`:
- Line 618: Replace the malformed "else{" with the properly spaced "else {" in
the affected branch (update the `else` statement that currently reads "else{" to
"else {") to conform to the project's C++ formatting conventions; locate the
`else{` token in src/cpu/o3/issue_queue.cc and adjust the spacing only.
- Around line 528-539: IssueQue::idle currently only checks readyQs and replayQ
and misses vectorReadyQ, so IQ can report idle when vectorReadyQ has entries;
update IssueQue::idle to include a check for vectorReadyQ (e.g., test
vectorReadyQ.size() > 0 or !vectorReadyQ.empty()) and OR that result into the
existing idle/replayQ logic so any pending entries in vectorReadyQ mark the
queue as non-idle; refer to the IssueQue::idle method and the readyQs, replayQ
and vectorReadyQ members when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e5465c34-d870-491f-9bec-f596041d29cf

📥 Commits

Reviewing files that changed from the base of the PR and between 716a2c2 and 5b27977.

📒 Files selected for processing (2)
  • src/cpu/o3/issue_queue.cc
  • src/cpu/o3/issue_queue.hh

Comment thread src/cpu/o3/issue_queue.cc
@jueshiwenli jueshiwenli added rvv and removed rvv labels Jun 3, 2026
Temporarily delay the splitting of all vector memory access instructions by three cycles, and let them compete with replayed instructions and normally issued instructions for the load/store pipeline.

This part of the logic will be further refined based on the instruction type, followed by detailed calibration with the RTL.

Change-Id: I51ee33bae840cd3eebf2e761bfc3ebdf2f6309a4

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
src/cpu/o3/issue_queue.cc (1)

474-479: 💤 Low value

Instruction lost if checkScoreboard fails after pop.

The instruction is already erased from vectorReadyQSeqs (line 474) and popped from vectorDelayedReadyQ (line 475) before checkScoreboard is called. If checkScoreboard returns false, the instruction is simply skipped via continue and never re-queued—effectively lost.

However, since the bypassReady loop (lines 448-462) already verifies all source registers against bypassScoreboard, and checkScoreboard also checks bypassScoreboard, the latter should never fail if the former passed. Consider either:

  1. Removing the redundant checkScoreboard call, or
  2. Moving the checkScoreboard call before the pop and breaking (similar to bypassReady) so the instruction remains in the queue for retry.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cpu/o3/issue_queue.cc` around lines 474 - 479, The current code erases
inst->seqNum from vectorReadyQSeqs and pops vectorDelayedReadyQ before calling
checkScoreboard, which can drop an instruction if checkScoreboard returns false;
fix by either removing the redundant checkScoreboard call in this bypassReady
handling (since bypassReady already validated bypassScoreboard) or move the
checkScoreboard invocation to before modifying
vectorReadyQSeqs/vectorDelayedReadyQ and, if it fails, break/leave the
instruction in the queue (mirror the bypassReady behavior) so the instruction is
retried; update the logic around vectorReadyQSeqs, vectorDelayedReadyQ, and
checkScoreboard accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/cpu/o3/issue_queue.cc`:
- Around line 474-479: The current code erases inst->seqNum from
vectorReadyQSeqs and pops vectorDelayedReadyQ before calling checkScoreboard,
which can drop an instruction if checkScoreboard returns false; fix by either
removing the redundant checkScoreboard call in this bypassReady handling (since
bypassReady already validated bypassScoreboard) or move the checkScoreboard
invocation to before modifying vectorReadyQSeqs/vectorDelayedReadyQ and, if it
fails, break/leave the instruction in the queue (mirror the bypassReady
behavior) so the instruction is retried; update the logic around
vectorReadyQSeqs, vectorDelayedReadyQ, and checkScoreboard accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d418bc27-4644-4d76-8ce0-bfb4d47296dd

📥 Commits

Reviewing files that changed from the base of the PR and between 5b27977 and 2abaf82.

📒 Files selected for processing (2)
  • src/cpu/o3/issue_queue.cc
  • src/cpu/o3/issue_queue.hh

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants