Skip to content

[hardware] 🐛 Fix vrgather out-of-range index hang in the mask unit#477

Open
emiliengnr wants to merge 1 commit into
pulp-platform:mainfrom
emiliengnr:fix/vrgather-oob-index-hang
Open

[hardware] 🐛 Fix vrgather out-of-range index hang in the mask unit#477
emiliengnr wants to merge 1 commit into
pulp-platform:mainfrom
emiliengnr:fix/vrgather-oob-index-hang

Conversation

@emiliengnr

Copy link
Copy Markdown

Hello, here is a pull request for a bug I found.

Problem

A vrgather/vrgatherei16 with an index past the end of the source vector must
read 0 for that element (RVV 1.0 §16.4), and the mask unit correctly never requests
vd data for it. But the mask unit's issue gate still waited on
&masku_operand_vd_valid, so the gather never issued, the mask unit spun forever,
and the cva6 host stalled on the accelerator handshake until reset.

Minimal reproducer (NrLanes=2, VLEN=512, so VLMAX = VLEN/SEW = 64 at e8):

vsetivli x0, 8, e8, m1, ta, ma
li   t1, 200            # 200 >= VLMAX (64) -> out of range
vmv.v.x v8, t1          # all gather indices = 200 (OOB)
vid.v   v16             # source = [0,1,2,...]
vrgather.vv v24, v16, v8   # hangs

Fix

Waive the vd_valid wait in the issue gate when the index is out of range
(vrgat_idx_oor_q), for VRGATHER/VRGATHEREI16. The result path already
substitutes 0 for out-of-range elements, so no vd data is needed. Other ops are
unaffected.

Changelog

Fixed

  • Fix hang when a vrgather/vrgatherei16 index is out of range

Checklist

  • Automated tests pass
  • Changelog updated
  • Code style guideline is observed

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.

1 participant