Skip to content

x86: Fixes for vector masking helpers - #7727

Merged
hzongaro merged 3 commits into
eclipse-omr:masterfrom
BradleyWood:vmaskfixes
May 6, 2025
Merged

x86: Fixes for vector masking helpers#7727
hzongaro merged 3 commits into
eclipse-omr:masterfrom
BradleyWood:vmaskfixes

Conversation

@BradleyWood

Copy link
Copy Markdown
Contributor

No description provided.

@BradleyWood

Copy link
Copy Markdown
Contributor Author

jenkins build all

@0xdaryl 0xdaryl left a comment

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.

While the changes seem reasonable on their own, I don't know what problems they are addressing. Can you add more detail to your commit messages please? Thanks.

@BradleyWood

Copy link
Copy Markdown
Contributor Author

I have updated the commit messages. @hzongaro Would you mind taking a look?

@hzongaro hzongaro left a comment

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.

I think the changes look good. There are a couple of typos in the commit message for the "x86: Fixes for vector masking helpers" commit:

"left-land side" -> "left-hand side"
"a. Perfrom" -> "a. Perform"
"I have rewritten this logic to fix logical issues simplify into 3 cases" -> "I have simpified the logic into three cases", perhaps?

This is outside the scope of this change, but may I ask you to consider adding comments to OMR::X86::TreeEvaluator::arrayToVectorMaskHelper in a follow up pull request? It will certainly help anyone who is not regularly immersed in vector operations to understand what it's doing.

Finally, is it possible to add TRIL tests for b2m, s2m, i2m and l2m? I have no idea what's supported there in terms of vector operations.

Bradley Wood added 2 commits May 6, 2025 10:56
This commit fixes issues with merging vectors
in masked binary operations. The left-hand side
of the binary operation should be moved into
the result register whether native masking is
supported or not. I have simplified this logic
into three cases.

1. Native masking is supported but lane-size is mismatched.
 a. Perform binary operation as if it is unmasked.
 b. Call merge helper.
2. Masking is supported.
 a. Generate binary instruction under write mask.
3. Masking is not supported.
 a. Copy mask into tmp register and perform binary op.
 b. Call merge helper.

Signed-off-by: Bradley Wood <bradley.wood@ibm.com>
When converting a boolean array to vector mask,
we support boolean arrays up to 64 elements. In
many cases, the number of elements is less than
16 and therefore fits into a general-purpose
register. When copying the array into a vector
register, we need to check if the array is stored
in general-purpose register and move it into a
vector register, not whether its node is an integer.

Signed-off-by: Bradley Wood <bradley.wood@ibm.com>
@BradleyWood

Copy link
Copy Markdown
Contributor Author

Updated commit messages.

may I ask you to consider adding comments

May as well do it now. I added doxygen-style comment and add comments to explain the instruction sequence for each of relevant execution paths (AVX-512 native masking vs non-native masking).

Finally, is it possible to add TRIL tests for b2m, s2m, i2m and l2m? I have no idea what's supported there in terms of vector operations.

I have tested these opcodes through openjdk tests. I am working on TRIL infrastructure for mask operations on another branch. Those tests require support of the complementing opcodes, such as m2v, m2b, m2s, m2i, m2l.

@BradleyWood

Copy link
Copy Markdown
Contributor Author

jenkins build all

Comment thread compiler/x/codegen/OMRTreeEvaluator.cpp Outdated
Signed-off-by: Bradley Wood <bradley.wood@ibm.com>
@hzongaro

hzongaro commented May 6, 2025

Copy link
Copy Markdown
Contributor

Jenkins build all

@hzongaro hzongaro left a comment

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.

Looks good. Thanks!

@hzongaro

hzongaro commented May 6, 2025

Copy link
Copy Markdown
Contributor

x86 testing has passed. No need to wait for the linux_riscv64 testing to complete. Merging.

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