[hw] Do not track vl=0 vector instructions in running_insn - #118
Open
emiliengnr wants to merge 1 commit into
Open
[hw] Do not track vl=0 vector instructions in running_insn#118emiliengnr wants to merge 1 commit into
emiliengnr wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello, here is a pull request for a bug I found.
A vector instruction issued while
vl=0wedges the core on the next FP CSR access.vl=0is the reset value, so this fires on any vector op issued before the firstvsetvli, andalso whenever a
vsetvlicomputesvl=0fromAVL=0.The issue
The controller sets
running_insnfor every non-CON request at issue:and clears it when a unit responds. A
vl=0op never produces that response. In the VFU,vl_d >= spatz_req.vlalready holds on the first cycle, sospatz_req_readypulses and the unitdeclares itself done, but
vfu_rsp_valid_ofires only on the result-emit path, which needsresult_tag.last && &(result_valid | ~pending_results). With no element processed,result_validnever rises. The unit thinks the op is finished, the controller still thinks it is in flight, and
nothing will ever reconcile them.
issue_rsp_o.isfloatis|running_insn_q, and Snitch stalls onread_fcsr && acc_qrsp_i.isfloat,so the next
csrr fcsr,csrw frm,fssror similar never retires. One core spins silently, andwith both cores blocked Verilator reports
Resource deadlock avoided.Reproducer
Five instructions, no
vsetvli, no FP arithmetic:Step one can be any vector op routed to VFU, VLSU or VSLDU. Step two can be any read or write of
fcsr,frmorfflags. The program never reaches its halt.The fix
Do not set
running_insnfor avl=0op, since there is no response coming to clear it.Reductions keep their slot: they retire through the scalar result buffer and do send a response.
Ops with
vl>0take the original path unchanged, set on issue and cleared on response.