Conversation
georgiatai
commented
Mar 4, 2026
- Vector self-checking implementation
- need more testing on all instructions (passing basic arithmatics (e.g. vadd, vsub, etc.) and mask producing (e.g. vmand, etc.)
- added _INST_PTR for new failure code
- moved std_vec into custom coverpoints
… into VectorTestFix
… into VectorTestFix
… into VectorTestFix
… into vectorcoverage
|
Received feedback in meeting, will implement and fix:
|
davidharrishmc
left a comment
There was a problem hiding this comment.
Verbal review with Georgia yesterday.
Generally looks good.
Replace unused code with nops in signature generation mode
Comment principles of operation much more closely.
|
Implemented feedback in meeting. Still testing different instructions but could start reviewing:
will add target later after more testing! |
|
Refer to PR #924 for the changes on |
|
Those changes were made because @jordancarlin said that non-vector supporting suites were failing to run coverage with hardcoded SEW support. Please fix the implementation to run with widening instructions instead of hardcoding a temporary solution and pushing it to main. |
There was a problem hiding this comment.
Pull request overview
This PR introduces vector “self-checking” support by adding signature-compare macros for vector results and updating the vector test generator to emit per-test labels/coverpoint identifiers, alongside refactoring coverage templates to include std_vec locally.
Changes:
- Add new
RVTEST_SIGUPD_V/RVTEST_SIGUPD_V_LENmacros intended to support SELFCHECK vector comparisons and richer failure reporting. - Update vector test generation to pass
_INST_PTR-style labels and coverpoint IDs (cp) through to signature update sites; add some length-suite handling. - Move
std_vecinto multiple custom vector coverage templates and adjust coverage common macros for supported SEWs.
Reviewed changes
Copilot reviewed 3 out of 43 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/env/signature.h | Adds new vector SIGUPD macros for SELFCHECK/non-SELFCHECK behavior and length-suite comparisons. |
| generators/testgen/scripts/vector_testgen_common.py | Updates vector signature update emission and test labeling (inst_ptr), plus length-suite preload logic. |
| generators/testgen/scripts/vector-testgen-unpriv.py | Threads new cp argument through test generation; changes XLEN coverage and edge sets. |
| generators/coverage/templates/vector/*.sv | Adds std_vec coverpoint to many custom coverpoint templates (and updates headers). |
| framework/src/act/fcov/coverage/RISCV_coverage_common.svh | Changes how supported SEW/ELEN/LMUL capability macros are defined for coverage compilation. |
Comments suppressed due to low confidence (1)
generators/testgen/scripts/vector_testgen_common.py:1673
- writeVecTest emits
vsetivli ... m{sig_lmul}in the priv path, but sig_lmul is now computed aslmul * size_multiplierand can be fractional (e.g., 0.5/0.25/0.125). This will generate invalid assembly likem0.5. Use getLmulFlag(sig_lmul) (or keep sig_lmul as an encoded string like f2/f4/f8) when formatting LMUL in vsetivli, and ensure callers only pass a legal LMUL encoding.
| LREG _TEMP_REG, 0(_SIG_PTR) ;\ | ||
| beq _TEMP_REG, _TEMP_REG, 1f ;\ | ||
| 1: ;\ | ||
| jal _LINK_REG, failedtest_##_LINK_REG##_##_TEMP_REG ;\ |
There was a problem hiding this comment.
The beq immediately before the jal is beq _TEMP_REG, _TEMP_REG, 1f, which forces the integer failure decoder to treat the same register as both expected and actual. failure_code.h extracts failing_reg from rs2 of this beq and then reads failing_value from the saved state of that register, so the report will misleadingly show failing_value == expected_value. Consider making this beq compare an actual scalar derived from the vector result (e.g., element 0 via vmv.x.s / vfirst result) against the expected scalar loaded from the signature, so failure reports are actionable.
There was a problem hiding this comment.
more so related to error report so skipping for this PR. will fix and is on to-do
| redgesv = [0, 1, 2, 2**xlen-1, 2**xlen-2, 2**(xlen-1), 2**(xlen-1)+1, 2**(xlen-1)-1, 2**(xlen-1)-2] | ||
| if (xlen == 32): |
There was a problem hiding this comment.
redgesv in unpriv generator was trimmed to remove the alternating-bit patterns and other stress values that were previously included (e.g., walk-odd/even masks). This reduces scalar edge coverage and can hide issues in shift/logic instructions. If the intent is to limit runtime, consider keeping the patterns behind a flag (fast vs thorough) rather than removing them unconditionally.
There was a problem hiding this comment.
the reduced ones are listed later, repetitive values cause multiple definitions and test to fail
| if (arch == "Vls"): | ||
| for effew in ["8", "16", "32", "64"]: | ||
| testplans["Vls" + effew] = tp | ||
| # for effew in ["8", "16", "32", "64"]: | ||
| # testplans["Vls" + effew] = tp | ||
| del testplans["Vls"] | ||
| if (arch == "Vf"): |
There was a problem hiding this comment.
readTestplans() now deletes the Vls testplan entry without creating per-EEW variants (Vls8/16/32/64). This effectively drops all VLS-directed test generation unless those covergroups are handled elsewhere, and is a significant behavioral change that isn’t mentioned in the PR description. If VLS should still be generated, restore the per-EEW expansion or otherwise keep Vls in the returned testplans map.
There was a problem hiding this comment.
deliberate choice for now
| /* Save architecture state of instruction under test (vl and vtype) */ \ | ||
| csrr _TEMP_REG, vl ; \ | ||
| csrr _TEMP_REG2, vtype ; \ | ||
| /* Set vl = VLMAX for full-register comparison*/ \ | ||
| vsetvli _LINK_REG, x0, e ## _SEW ##, m ## _LMUL ##, ta, ma ; \ | ||
| /* Load reference from signature and compute mismatch mask */ \ |
There was a problem hiding this comment.
RVTEST_SIGUPD_V_LEN saves the original vl and vtype (csrr into _TEMP_REG/_TEMP_REG2) and then overwrites vtype/vl with vsetvli ... vlmax, but never restores the saved state before exiting the macro. That will leak a modified vl/vtype into subsequent test code and can cause widespread false failures. Add a restore step near the PASS/FAIL join (e.g., vsetvl using the saved vl and vtype) before incrementing _SIG_PTR / returning.
There was a problem hiding this comment.
don't think it needs to be restored since each test sets its own
Implemented all copilot comments other than the ones I don't agree with (explanation provided), and all tests should pass now for Vx32... I didn't get to test the other extensions. The only change I made in makefile is to make
One thing that I would be slightly concerned is regarding the changes on |