Skip to content

Support v2m opcode on Power - #7737

Merged
dsouzai merged 1 commit into
eclipse-omr:masterfrom
gita-omr:mask_box
May 6, 2025
Merged

Support v2m opcode on Power#7737
dsouzai merged 1 commit into
eclipse-omr:masterfrom
gita-omr:mask_box

Conversation

@gita-omr

@gita-omr gita-omr commented Apr 28, 2025

Copy link
Copy Markdown
Contributor
  • TR::v2m opcode converts boolean vector into mask
  • least-significant bit of each byte element should be left-extended
  • mload/mloadi opcodes don't have to extend the bit since they load correct
    mask representation stored by mstore/mstorei

@dsouzai

dsouzai commented Apr 28, 2025

Copy link
Copy Markdown
Contributor

jenkins build plinux,aix

@dsouzai dsouzai self-assigned this Apr 28, 2025
Comment thread compiler/p/codegen/OMRTreeEvaluator.cpp Outdated
OMR::Power::TreeEvaluator::v2mEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
return TR::TreeEvaluator::passThroughEvaluator(node, cg);

@BradleyWood BradleyWood Apr 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on Power, vectors and masks reside in the same register it can be a passThrough evaluator

That doesn't sound right to me. This opcode is is meant for converting a mask, in the form a boolean array (when 16+ lanes are present) into a mask. The mask (as a vector) cannot be in the form of a boolean array. Each lane should be all 1's or all 0's. Furthermore, the number of boolean[] elements at 8-bit in a 128-bit vector is 16. What if the elements in your mask operations are 16-bit? For instance, vmaddVector256Int16, it would have 16 elements, therefore, the vector you load is Vector128Int8 -- half the size, and incorrect lane type.

@gita-omr gita-omr changed the title Support v2m opcode on Power WIP: Support v2m opcode on Power Apr 28, 2025
@gita-omr

Copy link
Copy Markdown
Contributor Author

Made WIP to clarify the definition of v2m opcode.

@gita-omr

gita-omr commented Apr 29, 2025

Copy link
Copy Markdown
Contributor Author

I agree with some points in #7737 (comment) but I think some don't apply to Power.

v2m is indeed meant for loading a mask from a boolean array. It is only needed when the size of the array is bigger than 8 bytes. In these cases, we use a vector load of the right size to load the whole array. Since vector element cannot be smaller than boolean there is always a vector load available on a given platform to load a full boolean array representing a mask.

For example, since vector length on Power is 128-bit, the biggest mask will contain 16 elements (if vector elements are bytes). So we will use vloadiVector128Int8 for a byte mask and we'll use other opcodes for smaller masks (iloadi, lloadi, etc). So I think there is no size issue on Power.

Then, vloadiVector128Int8 becomes a child of v2m to convert the vector containing a boolean array into a mask. I agree that the least significant bit needs to be left-extended by v2m since boolean array might contain value 1 for true, but we need all bits in the lane to be set. We already have such code for mload on Power. But I think it's not necessary there and needs to be moved to v2m.

mload/mloadi does not need the bit to be extended since it assumes that proper mask was stored by mstore/mstorei.

@gita-omr

Copy link
Copy Markdown
Contributor Author

Changed code and commit comment according to the comment above.

@gita-omr

Copy link
Copy Markdown
Contributor Author

Removed the extension code in vloadEvaluator.

- TR::v2m opcode converts boolean vector into mask
- least-significant bit of each byte element should be left-extended
- mload/mloadi opcodes don't have to extend the bit since they load correct
  mask representation stored by mstore/mstorei
@gita-omr

Copy link
Copy Markdown
Contributor Author

Improved commit message.

@gita-omr gita-omr changed the title WIP: Support v2m opcode on Power Support v2m opcode on Power May 1, 2025
@gita-omr

gita-omr commented May 1, 2025

Copy link
Copy Markdown
Contributor Author

Ready for another review. @BradleyWood @dsouzai

@dsouzai

dsouzai commented May 5, 2025

Copy link
Copy Markdown
Contributor

Looks OK to me; will wait for @BradleyWood's OK.

@dsouzai

dsouzai commented May 5, 2025

Copy link
Copy Markdown
Contributor

OMR Jenkins instance is still down; could you run an internal build (or run the OMR tests on a P machine manually) to make sure there's no issues?

@dsouzai

dsouzai commented May 6, 2025

Copy link
Copy Markdown
Contributor

jenkins build plinux,aix

@dsouzai
dsouzai merged commit 2df1caf into eclipse-omr:master May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants