Skip to content

[RISCV] Update matchSplatAsGather to convert vectors if they have different sizes #117878

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 10 commits into from
Dec 5, 2024

Conversation

mikhailramalho
Copy link
Member

@mikhailramalho mikhailramalho commented Nov 27, 2024

This patch updates the matchSplatAsGather function so we can handle vectors of different sizes. The goal is to improve the code gen for @llvm.experimental.vector.match on RISCV.

Currently, we use a scalar extract and splat instead of vrgather, and the patch changes that.

Copy link

github-actions bot commented Nov 27, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@lukel97
Copy link
Contributor

lukel97 commented Nov 27, 2024

I think the title needs updated, this is just modifying the matchSplatAsGather combine right?

@mikhailramalho mikhailramalho changed the title [RISCV] Use vrgather in llvm.experimental.vector.match [RISCV] Update matchSplatAsGather to convert vectors if they have different sizes Nov 27, 2024
This patch changes matchSplatAsGather to use vrgather no only when we
see an EXTRACT_VECTOR_ELT but also for RISCVISD::VMV_X_S.
Signed-off-by: Mikhail R. Gadelha <[email protected]>
Signed-off-by: Mikhail R. Gadelha <[email protected]>
Signed-off-by: Mikhail R. Gadelha <[email protected]>
Signed-off-by: Mikhail R. Gadelha <[email protected]>
Signed-off-by: Mikhail R. Gadelha <[email protected]>
Signed-off-by: Mikhail R. Gadelha <[email protected]>
Signed-off-by: Mikhail R. Gadelha <[email protected]>
Copy link
Contributor

@lukel97 lukel97 left a comment

Choose a reason for hiding this comment

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

LGTM

@mikhailramalho mikhailramalho marked this pull request as ready for review December 3, 2024 01:54
@mikhailramalho
Copy link
Member Author

ping @topperc I think I addressed your comments, could you take another look?

Copy link
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

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

LGTM

@mikhailramalho mikhailramalho merged commit 59a9e4d into llvm:main Dec 5, 2024
10 checks passed
@mikhailramalho mikhailramalho deleted the riscv-match branch December 5, 2024 14:47
mikhailramalho added a commit to mikhailramalho/llvm-project that referenced this pull request Dec 5, 2024
…it is in-bounds

This a follow up to llvm#117878 and allows the usage of vrgather if the
index we are accessing in VT is a constant and within bounds.

This patch replaces the previous behavior of bailing out if the length
of the search vector was greater than the vector of elements we are
searching for. Since matchSplatAsGather works on EXTRACT_VECTOR_ELT, and
we know the index where the element is being extracted from, we can use
safely use vrgather.
mikhailramalho added a commit to mikhailramalho/llvm-project that referenced this pull request Jan 16, 2025
…it is in-bounds

This a follow up to llvm#117878 and allows the usage of vrgather if the
index we are accessing in VT is a constant and within bounds.

This patch replaces the previous behavior of bailing out if the length
of the search vector was greater than the vector of elements we are
searching for. Since matchSplatAsGather works on EXTRACT_VECTOR_ELT, and
we know the index where the element is being extracted from, we can use
safely use vrgather.
preames pushed a commit that referenced this pull request Jan 21, 2025
…in-bounds (#118873)

This is a follow-up to #117878 and allows the usage of vrgather if the index
we are accessing in VT is constant and within bounds.

This patch replaces the previous behavior of bailing out if the length of the
search vector is greater than the vector of elements we are searching for.
Since matchSplatAsGather works on EXTRACT_VECTOR_ELT, and we know the index
from which the element is extracted, we only need to check if we are doing an
insert from a larger vector into a smaller one, in which we do an extract
instead.

Co-authored-by: Luke Lau [email protected]
Co-authored-by: Philip Reames [email protected]
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

Successfully merging this pull request may close these issues.

3 participants