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

Should vector crypto instructions constraint vd_num/vs1_num/vs2_num align to lmul? #1548

Open
GuoShibo-cn opened this issue Dec 22, 2023 · 11 comments

Comments

@GuoShibo-cn
Copy link

image
According to zvkned_ext_macros.h, no where constraint vd/vs1 number align to lmul. And overlap just check vs_num == vd_num.
image
however even with vlen =128, it would be possible to set lmul = 2, register groups could overlap with numbers not the same.

@scottj97
Copy link
Contributor

Can you give a specific example of a case you think is broken today?

@GuoShibo-cn
Copy link
Author

Sorry for delay.
img_v3_026f_b9d5c7e7-d3df-4289-8ff2-c45445d54acg
Our VLEN is 256 ,this is our simulation result, in the log we use lmul = 4, dst reg_num & src reg_num is not align to lmul, for vector arithmatic instruction this would cause illegal instruction trap, howerver spike just continue the calcualtion.

@aswaterman
Copy link
Collaborator

cc @egouriou-rivos (and @chihminchao)

@timhsu404
Copy link

timhsu404 commented Feb 7, 2024

Yes, the vector crypto extensions should follow the LMUL alignment requirement.
Though the spec do not describe this behavior explicity, it does not make sense that register can not be the same but the content can still possible to overlap or out of the normal register range, the case v30 with LMUL=4 above.

I will create a PR for it.

@xinyuwang-starfive
Copy link
Contributor

what status of the PR

@aswaterman
Copy link
Collaborator

cc @timhsu404

@nibrunieAtSi5
Copy link
Contributor

@timhsu404 any progress on this issue ?

@chihminchao
Copy link
Contributor

@timhsu404 is busy with another internal issue and may not have time on this issue this month.

@timhsu404
Copy link

any progress on this issue ?

@nibrunieAtSi5 Not really. I have already done the very first version, but still tracking on some bugs.
The progress is pending for now, I'll keep working on this issue after the urgent job has been done.

@DavidYu360
Copy link

Vector crypto instruction VPR alignment rules:
Possible alignment value: 1, 2, 4, 8 (1 for any VPR, 2 for V0, V2, ...)
Prerequisite: VLEN * LMUL >= EGW

  1. Single key in .vs inst: max(EGW/VLEN, 1)
  2. Others: max(LMUL, 1)

nibrunie added a commit to nibrunieAtSi5/riscv-isa-sim that referenced this issue Sep 21, 2024
nibrunie added a commit to nibrunieAtSi5/riscv-isa-sim that referenced this issue Sep 21, 2024
@nibrunie
Copy link

I have developed a test case, https://gist.github.com/nibrunie/80a00047dce935011614530d86a829e6, which seems to be passing with flying colors on spike when I would have expected almost every instruction to trap.

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

No branches or pull requests

9 participants