Skip to content

[GR-64794] Vector API: Implement Vector::compress/expand #11434

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

Merged
merged 1 commit into from
Jun 18, 2025

Conversation

graalvmbot
Copy link
Collaborator

This PR adds support for intrinsification of Vector::compress and Vector::expand on AVX512.

Vector::compress extracts elements from the source vector according to a mask, then puts them into the first elements of the destination vector one-by-one. The remaining elements in the destination vector are zeroed. This operation is useful for text transcoding, for example, when converting a UTF-32 sequence to UTF-8, we can use compress to contract the fixed-sized code points of UTF-32 to the variable-sized code points of UTF-8.

Vector::expand is the opposite operation, it takes the elements from the source vector one-by-one and put them at each element in the destination vector such that the corresponding element in the mask operand is set.

AVX-512 has dedicated instruction for compress and expand. With this patch, Vector::compress(src, mask) is compiled into vpcompressd dst{mask}, src, Vector::expand(src, mask) is compiled into vpexpandd dst{mask}, src.

Please kindly review, thanks a lot.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 18, 2025
@graalvmbot graalvmbot merged commit d066dd4 into master Jun 18, 2025
13 checks passed
@graalvmbot graalvmbot deleted the qam/vectorcompress branch June 18, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants