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

non destructive ternary shuffling #144

Open
jnk0le opened this issue Sep 19, 2022 · 1 comment
Open

non destructive ternary shuffling #144

jnk0le opened this issue Sep 19, 2022 · 1 comment

Comments

@jnk0le
Copy link

jnk0le commented Sep 19, 2022

In addition to xperm8 and xperm4 from zbkx.

Proposal is about adding ternary shuffles, similar to PULP pv.shuffle2.{b,h} instruction. But with the "byte/reg select" bits in its own lane for easier data dependent shuffling and symmetry with xperm8. (the downside being that the mask can no longer be loaded with single addi on RV32 (loop invariant anyway))

It should also zero out the result if the index is out of bounds: i.e. any bit set above the reg select bit (similar to xperm8)

obraz

Those were proved to have an significant use in convolutions and matmul, but in some cases suffer from extra moves due to its destructive form (e.g. listing 1 in [1], table 5.9 in [2]).

Because of this I think that needs to be an R4 type ternary instr similar to cmix (aka BPICK), or funnel shifts.
Otherwise there needs to be 2 variants of that same isntruction (doesn't solve issues in [1] and [2] though):

  • destroing one of the input operand
  • destroing the mask operand

[1] - https://arxiv.org/pdf/2004.11690.pdf
[2] - https://webthesis.biblio.polito.it/18144/1/tesi.pdf

@jnk0le
Copy link
Author

jnk0le commented Sep 19, 2022

shuffles in ri5cy datasheet, have masks aligned to lanes. Fig 6 (from https://arxiv.org/pdf/1608.08376.pdf) seems to be wrong.
obraz

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

1 participant