Skip to content
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

Fix the encoding and assembly of vsetvl instruction #359

Merged
merged 3 commits into from
May 16, 2024

Conversation

XinlaiWan
Copy link
Collaborator

The implementation of vsetvl and vsetvli are rearranged, and some helper functions are added.

This PR fixed #337 .

Copy link

github-actions bot commented Nov 22, 2023

Unit Test Results

712 tests  ±0   712 ✔️ ±0   0s ⏱️ ±0s
    6 suites ±0       0 💤 ±0 
    1 files   ±0       0 ±0 

Results for commit 9692f84. ± Comparison against base commit 9f4cad6.

♻️ This comment has been updated with latest results.

@jrtc27
Copy link
Collaborator

jrtc27 commented Nov 22, 2023

Fixing encodings should not be a 178-line diff. If you want to refactor because you think it’s cleaner, fine, but please separate that from the function change that is fixing the encoding.

@XinlaiWan
Copy link
Collaborator Author

Fixing encodings should not be a 178-line diff. If you want to refactor because you think it’s cleaner, fine, but please separate that from the function change that is fixing the encoding.

The issue is because the encoding and assembly definitions of vsetvl and vsetvli are incorrectly mixed together, but they actually have a lot of difference so that they cannot have a unified definition in the old way and keep their correctness at the same time. So in order to fix the encoding issue, I have to split the definitions and executions of vsetvl and vsetvli, which makes a lot of difference in the code. And although their encoding and assembly are very different, the logic in their execution function to calculate AVL and VLMAX and set vl are very similar. That's why I further extract some code to be helper functions.

I don't think the change of refactoring can be separated from fixing the encoding, because the purpose of this refactoring is to fix the encoding issue, and the issue is fixed by refactoring the code of vsetvl and vsetvli.

@XinlaiWan
Copy link
Collaborator Author

If the commit message of "fix the encoding" causes misunderstanding, maybe I can modify that description to be more reasonable.

@jrtc27
Copy link
Collaborator

jrtc27 commented Nov 23, 2023

So you're not just changing the encoding and assembly. You're also rewriting their implementations to be functionally different to before, regardless of how the instructions were encoded.

@Alasdair
Copy link
Collaborator

I would adjust the commit message to explain what you wrote in your comment above, as it provides the reasoning for the change. Maybe also add a pointer to #337?

In general I think we should be proactive in getting vector issues resolved as they are discovered. I actually think the new version with four simpler instructions w/ helper functions is clearer than the original with the branching logic in each function, so this change looks good to me.

@jrtc27 jrtc27 mentioned this pull request Nov 27, 2023
13 tasks
…iscv#337

The issue shows that the encoding and assembly definitions of vsetvl and vsetvli are incorrectly mixed together,
but they actually differ a lot and therefore cannot have a unified definition as the old implementation did,
so this section has been rewritten to split their definitions and executions.
And because these instructions have similar functional behavior after the decoding stage,
some common code is further extracted to be helper functions in this commit.
@jjscheel
Copy link

@vmoya-smd, can you review this proposed patch for us?

@vmoya-smd
Copy link
Collaborator

vmoya-smd commented Mar 25, 2024

Other than some personal nitpicking on some comparison, where I would prefer to use parenthesis for clarity even if not required, I think the changes are good.

The new code is more clear and avoids code replication between the opcodes compared with just a simple fix of the previous implementation. That justifies the refactoring.

@billmcspadden-riscv billmcspadden-riscv added the tgmm-agenda Tagged for the next Golden Model meeting agenda. label Mar 25, 2024
@allenjbaum
Copy link
Collaborator

allenjbaum commented Mar 25, 2024 via email

@jjscheel
Copy link

@billmcspadden-riscv, what is our plan to complete this work?

Signed-off-by: Xinlai Wan <xinlai.w@rioslab.org>
@XinlaiWan
Copy link
Collaborator Author

I have resolved the conflicts with the base branch and hope this will make code review easier.

Copy link

github-actions bot commented Apr 17, 2024

Test Results

712 tests  ±0   712 ✅ ±0   0s ⏱️ ±0s
  6 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 8ab3ca8. ± Comparison against base commit be1e04c.

♻️ This comment has been updated with latest results.

@Alasdair Alasdair self-requested a review April 22, 2024 14:51
Copy link
Collaborator

@Alasdair Alasdair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the commit message has been fixed I think this should be good to go.

@billmcspadden-riscv billmcspadden-riscv merged commit 3688e5b into riscv:master May 16, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tgmm-agenda Tagged for the next Golden Model meeting agenda.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Encoding and assembly of vsetvl are incorrect
7 participants