Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Consider bit operations for PrimitiveArray? #469

Closed
yjhmelody opened this issue Sep 30, 2021 · 10 comments
Closed

Consider bit operations for PrimitiveArray? #469

yjhmelody opened this issue Sep 30, 2021 · 10 comments
Labels
feature A new feature good first issue Good for newcomers no-changelog Issues whose changes are covered by a PR and thus should not be shown in the changelog

Comments

@yjhmelody
Copy link
Contributor

No description provided.

@jorgecarleitao
Copy link
Owner

You mean array1 ^ array2 type of operations?

@jorgecarleitao jorgecarleitao added the feature A new feature label Sep 30, 2021
@yjhmelody
Copy link
Contributor Author

You mean array1 ^ array2 type of operations?

Right!

@jorgecarleitao
Copy link
Owner

Yeap, definitely in scope, and imo a fun exercise because it likely can be SIMDed!

@jorgecarleitao jorgecarleitao added the good first issue Good for newcomers label Sep 30, 2021
@1aguna
Copy link
Contributor

1aguna commented Oct 2, 2021

Hello, I am new to the project and am interested in taking this on. Would the desired operations be

  • & and
  • | or
  • ^ xor

@jorgecarleitao
Copy link
Owner

Hey and welcome!

Yap, those are the main ones. Check how we use the compute::arity::binary in other arithmetics for inspiration.

Feel free to ping me if you need any help or have any questions 😊

@1aguna
Copy link
Contributor

1aguna commented Oct 2, 2021

I will check that out. Thanks!

@Dandandan
Copy link
Collaborator

I think bitwise not (! in Rust, ~ in some other languages) might be another important one.

A bit more "advanced" would be left and right shift.

@1aguna
Copy link
Contributor

1aguna commented Oct 7, 2021

@jorgecarleitao Do you have any tips for approaching SIMD ? From what I can tell, I should implement traits in compute/aggregate/simd for native(non-packed) and packed operations.

@jorgecarleitao
Copy link
Owner

You are on the right track 👍

For explicit SIMD, we have an abstraction for it (in types/simd) that allows both versions depending on the feature simd. However, like you wrote, we do need a trait to plug how each the specific operation (e.g. ^ or !) is represented in the SIMD space (e.g. i8x64).

I would first try to have a non-SIMD implementation (e.g. via compute::arity::unary and compute::arity::binary) and a benchmark, so that we have a baseline to work on top of (this could be one PR). It could be that rust auto-vectorizes and we do not need explicit SIMD.

Since this is not an aggregation, I would probably place it in a new module like compute/logic or something.

@jorgecarleitao
Copy link
Owner

Closed by #553

@jorgecarleitao jorgecarleitao added the no-changelog Issues whose changes are covered by a PR and thus should not be shown in the changelog label Nov 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature A new feature good first issue Good for newcomers no-changelog Issues whose changes are covered by a PR and thus should not be shown in the changelog
Projects
None yet
Development

No branches or pull requests

4 participants