-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merging vector extension code from vector-dev to the main branch #286
Conversation
I would like to review this. I am out of the country this week, and it will take a while to comb through all of this. Please do not merge this until I have reviewed it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing that perhaps should be documented somewhere in the repository:
- vstart support for non-memory vector operations: vstart != 0 supported or triggers illegal instruction
- mask and tail agnostic support: write 1s or identical to undistubed (current and spike implementation)
- configurability for the above and other parts of the specification, document what has been made non-configurable but is optional in the spec
- TODOs for the vector extension
inline comments
***@***.**** commented on this pull request.
Another thing that perhaps should be documented somewhere in the
repository:
- vstart support for non-memory vector operations: vstart != 0
supported or triggers illegal instruction
- mask and tail agnostic support: write 1s or identical to undistubed
(current and spike implementation)
Are you saying that something is missing in the pull, is not documented or
both?
e.g. Sail should be configurable as to which of those (write 1 or
undisturbed) it implements when agnostic is selected, and I dimly recall
that vstart support is implementation dependent.
(I am unclear, from a spec point of view, whether these can vary from op to
op, or even sometimes do one and sometimes another)
- configurability for the above and other parts of the specification,
document what has been made non-configurable but is optional in the spec
Yes, please - from an ACT standpoint, we need to be able to configure the
Sail model to do what is allowed by the spec
- TODOs for the vector extension
Which should include what is non-configurable, and should be configurable.
We should also have a list of all the possible configurabillity because
riscv-config YAML will need to add it to the schema.
…
------------------------------
Message ID: ***@***.***>
|
The issues I'm going to fix:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments in the code review comments.
The issues I'm going to fix now:
|
No merges for the branch being merged to master. Rebase. Otherwise history will be a mess. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git diff origin/master...origin/vector-dev | awk '/^\+\+\+/{f=$2; gsub(/^b\//, "", f); next}; /^@@ /{l=$3; gsub(/^\+/, "", l); gsub(/,.*/, "", l);} /^\+.*[ \t]$/{print f":"l":"$0} /^[ +]/{l=l+1}
says there are 103 instances of trailing whitespace added, two of which aren't in V-specific files (which I've commented on explicitly). Once you've rebased to pick up the pre-commit checks then it should also flag them all for you.
There's also a huge amount of boilerplate being copied between functions here. I don't know if there's scope to reuse more of it rather than copy/paste it 10s of times. At least the loads and stores look easy enough to merge, from what I can tell. The duplication means that fixing some of my comments may be painful, but that's what happens when they get ignored on prior PRs and the code pattern I'm commenting on get copied many times over.
This is not as thorough a review as I'd like to be able to give, but that's what happens for 10k line PRs done in one go rather than broken up... I've not checked for unused functions or variables, for example, which I would do if it were tractable.
The commit messages are also a mess thanks to blindly using GitHub's squash and merge functionality, which creates extremely ugly commit messages.
Thanks for all the reviewers' effort! I'll fix the issues later. One thing I'd like to mention is that for the similar code patterns, we've really tried our best to reduce the duplicate code, trying to make sure all the code blocks are necessary. Vector instructions do need a lot of preparation actions before starting calculations. They need to:
All the above are unique actions in vector instructions, which add a lot of complexity in the code compared with scalar instructions. They contain many lines of code, and do look similar in every execute function, but they are not the same. We have more than 10 illegal instruction checking functions, which is a proof for these complex cases. Even for C models like Spike, the solution is to define a lot of code snippets as macros and replace them in many places. I totally understand that similar code patterns do not look nice for our reviewers, but they are what we have to write. For the unit-stride and strided load/stores, unit-stride one is a special case of strided ones. The reason they're not merged together is that the vector spec defines load/stores as three categories: unit-stride, strided, and indexed. Because they're divided into different categoies, I think implementing them separately is clearer for understanding the vector spec. Also, I know that non-segment load/stores are special cases of segment load/stores, but they are still defined seperately. I think I have the same reason to implement them separately, instead of merging them into the code blocks of segment ones. Furthermore, almost all vector load/store instructions are actually special cases of the vector indexed segment load/stores, but I don't think it's necessary to merge them all together. |
In the new commits, floating-point functions are updated in Sail and the softfloat source code has been recovered to the original version. Some coding issues are fixed according to the suggested changes. For the load/store instructions, the code of non-segment instructions is merged into segment ones as their encoding is naturally included in the segment ones. |
I have used git rebase to sync with the main branch, and now there's no conflict between the two branches. |
All these fixup commits need to be folded into the commits they're fixing, otherwise history will be a mess. Every commit in PRs should be self-standing and bug-free (beyond missing features that will be added by subsequent commits). Search engines exist, and the Internet has countless articles on this, such as https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history to pick the first Google result that shows for me and looks vaguely promising. |
I have a new question about Sail syntax:
I'd like to make sure what's the expected new way of writing this variable declaration now. |
You need a constraint that |
The constraints are added now. Thanks for the help! |
I notice when reading sstatus register, it will call lower_mstatus() to get
the values, so I add the call of update_VS() in it to copy the mstatus.VS
into sstatus.VS. And when writing sstatus register, it will
call legalize_sstatus() -> legalize_mstatus() -> lift_sstatus(), so I add
the call of update_VS() in lift_sstatus() to make mstatus.VS sync with
sstatus.VS. I imitated the behavior of mstatus.FS and sstatus.FS in these
functions and I think the copying is done in this way.
…On Wed, Sep 20, 2023 at 12:52 AM Martin Berger ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
On model/riscv_sys_regs.sail
<#286 (comment)>:
@XinlaiWan <https://github.com/XinlaiWan> Another question: why are you
not copying VS into the sstatus register? The spec requires this:
[image: Screenshot 2023-09-19 at 17 52 22]
<https://user-images.githubusercontent.com/404397/269035171-f419f403-63b5-4746-b6f0-6c304c581bfa.png>
—
Reply to this email directly, view it on GitHub
<#286 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKFKAKM7B6366T67QVWAWKDX3HEV5ANCNFSM6AAAAAA2OHOROE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yes. What you did looks reasonable, because, as you say, the Vector spec says "It is defined analogously to the floating-point context status field, FS". (The spec could be more clear here) |
I have not reviewed the code again to verify everything's been addressed, but the current commit messages are an absolute mess. They will need cleaning up before this can be merged. |
The comment, "the current commit messages are an absolute mess", is not
helpful.
Please request specific improvements to the commit message.
WIth regards to your review: please provide your review posthaste. We
have been
working on this code submission for nearly a year via incremental PRs in
the vector-dev
branch. It's time to complete this effort.
Bill Mc.
…On Tue, Oct 10, 2023 at 4:38 PM Jessica Clarke ***@***.***> wrote:
I have not reviewed the code again to verify everything's been addressed,
but the current commit messages are an absolute mess. They will need
cleaning up before this can be merged.
—
Reply to this email directly, view it on GitHub
<#286 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXROLOFTGOQZM4FGYUE2XG3X6W56LAVCNFSM6AAAAAA2OHOROGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJWGMYDKOJSGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Bill McSpadden
Formal Verification Engineer
RISC-V International
mobile: 503-807-9309
|
This is the current commit message:
I don't know how else to put it. It's 56 non-empty lines, most of which is random fixup commit messages and Co-authored-by's. There is no constructive way to put it beyond "write a proper commit message". |
I have my own day job to do, which this is not a part of. It's not my fault nobody else is providing detailed review like I have and that I have had to spend a lot of my time combing these changes for all the style issues. If you want these reviews to go faster, do the same yourself or find other people to help such that if and when I get round to reviewing there is less for me to do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through the code. Overall I do not have any major issues, (although I am not a RISC-V vector expert so I cannot comment to that aspect!).
This PR adds the following: General Framework and Configurations: * Introduced the V extension's general framework and configuration setting instructions. * Updated model/riscv_insts_vext_vset.sail and effect matching functions in riscv_vlen.sail. * Addressed code formatting issues and made revisions post the Nov 22 meeting. * Co-authored by Nicolas Brunie and Jessica Clarke. Vector Load/Store Instructions: * Integrated vector load and store instructions. * Enhanced the implementation of SEW, LMUL, VLEN and removed real numbers from the code. * Updated vstart settings and removed unnecessary assert statements. * Rectified bugs in vleff instructions and overhauled coding styles. * Incorporated guards for vector encdec clauses and optimized memory access post vector load/store failures. Vector Integer/Fixed-Point Instructions: * Added vector integer/fixed-point arithmetic and mask instructions. * Improved vector EEW and EMUL checking functions and introduced illegal instruction check functions. * Fine-tuned code formatting for vector instruction checks. Vector Floating-Point Instructions: * Rolled out vector floating-point instructions and updated their conversion counterparts. * Refreshed copyright headers specific to the vector extension code. Vector Reduction and Mask Instructions: * Integrated vector mask and reduction instructions. * Addressed register overlap checks for vector mask instructions. Miscellaneous Enhancements and Fixes: * Updated vector CSR vtype.vill settings and judgements. * Systematized patterns for vector illegal instruction checks. * Rectified issues in vector load/store and reduction operations. * Purged redundant elements from the V extension code and vector floating-point functions. * Cleaned up softfloat makefiles and renamed EXTZ and EXTS within the V extension code. * Addressed a clang-format check issue and NaN boxing anomalies. Provided annotations for pending RVV configurations. * Initialized default VLEN value and set vlenb CSR. * Set constraints for vector variable initialization and added mstatus.VS settings specific to the vector extension.
e23be60
to
118ad66
Compare
Here is the pull request for merging the vector extension code to the main branch. Please comment if there are issues in the vector code, and I'll fix them soon.