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

Check that read_vmask_carry is correct #555

Open
Timmmm opened this issue Sep 20, 2024 · 1 comment
Open

Check that read_vmask_carry is correct #555

Timmmm opened this issue Sep 20, 2024 · 1 comment
Labels
vector Issues related to the Vector extension

Comments

@Timmmm
Copy link
Collaborator

Timmmm commented Sep 20, 2024

One thing I noticed is the read_vmask_carry function doesn't seem to be doing anything, as it looks like it is only called with vm=0b0 where it is then the same as read_vmask.

From here.

@Timmmm Timmmm added the vector Issues related to the Vector extension label Sep 29, 2024
@KotorinMinami
Copy link
Contributor

After looking though the code, I found that the read_vmask function and the read_vmask_carry function are different.In the read_vmask function, result is initialized to vector_init(true), while in the read_vmask_carry function, it is initialized to vector_init(false).

val read_vmask : forall 'n, 'n >= 0. (int('n), bits(1), regidx) -> vector('n, bool)
function read_vmask(num_elem, vm, vrid) = {
  assert(num_elem <= sizeof(vlenmax));
  let vreg_val : vregtype = V(vrid);
  var result   : vector('n, bool) = vector_init(true);           //here
...

val read_vmask_carry : forall 'n, 'n >= 0. (int('n), bits(1), regidx) -> vector('n, bool)
function read_vmask_carry(num_elem, vm, vrid) = {
  assert(num_elem <= sizeof(vlenmax));
  let vreg_val : vregtype = V(vrid);
  var result   : vector('n, bool) = vector_init(false);        //and here

With the initialization different, we can see that the results of the read_vmask and read_vmask_carry functions have different uses. One is to record whether the element is operated(the default is all selection), and the other is to record whether the element has a carry from the previous element(and the default is none).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vector Issues related to the Vector extension
Projects
None yet
Development

No branches or pull requests

2 participants