[hardware] 🐛 Fix NP2 slide hang on chunk-aligned stride#474
Open
emiliengnr wants to merge 1 commit into
Open
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.
Problem
vslidedown/vslideupwith an offset that is a whole-chunk multiplehangs the slide unit permanently. Examples at VLEN 4096, NrLanes 2:
offset 48 or 96, or a
.vislide with a sign-extended immediate of 16or more.
The dispatcher computes
is_stride_np2from the popcount of the fullslide offset (
ara_req.stride[idx_width(VLENB << 3)-1:0]), but theSLDU's
p2_stride_genonly resolves the within-chunk part of the offset(
idx_width(8*NrLanes)bits). A pure chunk-shift has all-zerowithin-chunk bits, so the generator reports popcount 0. When the full
popcount is greater than one the instruction is sent to the NP2 path,
and
SLIDE_NP2_RUNwaits forp2_stride_gen_popc_q == 1, which neverhappens. The slide unit stalls forever with no architectural error, so
unprivileged code can wedge the accelerator.
Fix
Compute
is_stride_np2on the within-chunk offset thatp2_stride_genactually processes (the element stride shifted down by
vsewandtruncated to the generator width). Chunk-level slides then take the
regular power-of-two path.
The same variable underlies issue #340: its offset 514 = 32*16 + 2 has a
nonzero within-chunk part, so the generator still terminates but on the
wrong decomposition, giving a wrong result instead of a hang. Both cases
share this one fix.
Fixes #340
Changelog
Fixed
Checklist