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

Utility of vmmv.m and vmv.v.v intrinsics #74

Closed
topperc opened this issue Mar 24, 2021 · 8 comments · Fixed by #287
Closed

Utility of vmmv.m and vmv.v.v intrinsics #74

topperc opened this issue Mar 24, 2021 · 8 comments · Fixed by #287
Labels
Resolve for v1.0 Feature or problems we will close before the v1.0 release

Comments

@topperc
Copy link
Collaborator

topperc commented Mar 24, 2021

Shouldn't users be encouraged to use operator= to copy vectors like any other variable? Using a mv intrinsic guarantees an instruction is emitted by the compiler even if register allocation would allow the input and output to use the same register. Unless we teach the compiler to look for these operations and turn them into copies that register allocation can coalesce.

@HanKuanChen
Copy link
Contributor

operator= is ambiguity. Users may want to copy a vector with only vl elements, while others may want to copy a vector with vlmax elements (when tail is undisturbed).

@zakk0610
Copy link
Collaborator

I'm not sure the operator= behavior is equal to vmv.v.v and vmmv.m.
Some people think operator= is VLMAX operation and mv intrinsics operate on vl element.
If they are different. I think the mv intrinsics are still useful.

@topperc
Copy link
Collaborator Author

topperc commented Mar 25, 2021

Wouldn't the vmv.v.v intrinsic need an extra operand for the undisturbed values to be useful for tail undisturbed? Right now the register allocator will just use whatever register is convenient as the destination so you have no control.

@kito-cheng
Copy link
Collaborator

I would suggest operator= should have VLMAX semantic and then compiler could optimize to vmv.v.v if possible, user should use intrinsic if user only want to copy vl.

So I agree with @topperc, we should encourage user to use operator=.

@nick-knight
Copy link
Collaborator

What happens when using operator= on a type with fractional LMUL?

@topperc
Copy link
Collaborator Author

topperc commented Mar 25, 2021

What happens when using operator= on a type with fractional LMUL?

I think it becomes a vmv1r.v if a copy is needed.

@topperc
Copy link
Collaborator Author

topperc commented Mar 25, 2021

I forgot about VL when I started this issue, but there's been some good discussion here.

Using vmv.v.v can improve performance by limiting the number of elements copied. But forcing users to explicitly code all copies using intrinsics to get the best performance seems bad. Variables in C should be a different abstraction than hardware registers.

To handle the tail undisturbed case we need a new intrinsic that takes that undisturbed values as a second input. This would not apply to vmmv.m since I mask instructions are always tail agnostic if I'm reading the spec correctly.

@eopXD eopXD added the Resolve for v1.0 Feature or problems we will close before the v1.0 release label Aug 2, 2022
@eopXD
Copy link
Collaborator

eopXD commented Aug 2, 2022

We currently have = with semantic of a whole vector register move (which is also vmv.v.v of VL=VLMAX).

We should explicitly emphasize this in the document of v1.0 since the assumption is necessary for redundant move eliminations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolve for v1.0 Feature or problems we will close before the v1.0 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants