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

Vector bit reversal #18

Closed
ben-marshall opened this issue Jul 2, 2020 · 2 comments
Closed

Vector bit reversal #18

ben-marshall opened this issue Jul 2, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request specification Improvements or additions to the specification

Comments

@ben-marshall
Copy link
Member

In the context of #17 (Vector extension: Carry-less Multiply) - How best to handle needing to reverse bits-in-bytes to get the input in the correct form?

  • In Markku's analysis for the scalar implementation of GCM, he used the Bitmanip "grev" instruction to reverse the bits in every byte of the input. I can't see an existing instruction in the V-spec which does this efficiently. Adding an instruction like

    vbrev.vv vrt    // Bit reverse, destructive.
    

    Which reverses the bits in every scalar element based on SEW, and requiring support for SEW=8 for the crypto extension seems reasonable?

  • There are other (non-obvious) ways to do bit reversal quickly which look amenable to vectorising, which we can fall back on.

@ben-marshall ben-marshall added specification Improvements or additions to the specification enhancement New feature or request labels Jul 2, 2020
@grnewell
Copy link

grnewell commented Jul 3, 2020

The best alternative method I have seen so far, adapted for RVV from one of the methods in the link in the main post (this one) , uses masking and shifting and takes 15 base vector extension instructions to reverse the order of the 8 bits in all the bytes of all the elements in a vector (not counting loading and other set-up overhead)

@ben-marshall
Copy link
Member Author

Andy's proposal for vector grev can be found here. These will be transcribed into the draft spec.

@ben-marshall ben-marshall self-assigned this Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request specification Improvements or additions to the specification
Projects
None yet
Development

No branches or pull requests

2 participants