Skip to content

Handle new vector opcodes - #17112

Merged
knn-k merged 5 commits into
eclipse-openj9:masterfrom
gita-omr:new_opcodes_java20
Jun 2, 2023
Merged

Handle new vector opcodes#17112
knn-k merged 5 commits into
eclipse-openj9:masterfrom
gita-omr:new_opcodes_java20

Conversation

@gita-omr

@gita-omr gita-omr commented Apr 5, 2023

Copy link
Copy Markdown
Contributor

@gita-omr gita-omr changed the title Handle new vector opcodes WIP: Handle new vector opcodes Apr 5, 2023
@gita-omr
gita-omr force-pushed the new_opcodes_java20 branch from 0e81d1b to 4a9d4b1 Compare April 9, 2023 01:34
@gita-omr

gita-omr commented Apr 9, 2023

Copy link
Copy Markdown
Contributor Author

Added commit to handle compressExpandOp() intrinsic.

@Akira1Saitoh

Copy link
Copy Markdown
Contributor

It seems that we need to recognize VectorSupport.broadcastInt to vectorize lanewise shift operations with immediate shift amount.
https://github.com/ibmruntimes/openj9-openjdk-jdk19/blob/e336ea0f0702e0a790ad0f52658b093fc1a86b8a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java#L1008-L1020

@gita-omr

Copy link
Copy Markdown
Contributor Author

It seems that we need to recognize VectorSupport.broadcastInt to vectorize lanewise shift operations with immediate shift amount. https://github.com/ibmruntimes/openj9-openjdk-jdk19/blob/e336ea0f0702e0a790ad0f52658b093fc1a86b8a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java#L1008-L1020

Thanks! Trying to figure out how it's different from fromBitsCoerced intrinsic for which we generate vsplats.

@gita-omr

Copy link
Copy Markdown
Contributor Author

fromBitsCoerced takes long for all types and that long is a bit pattern that needs to be converted to each type. broadcastInt is for non-FP types only and takes int as a parameter. We will generate vsplats for it as well, just without conversion.

@gita-omr

Copy link
Copy Markdown
Contributor Author

Actually, broadcastInt seems to be doing a shift by the same constant of each vector element (unary operation). @BradleyWood @Akira1Saitoh do you think it's better to have a new opcode (something like vshrConst) or convert it into vsplats of the constant and then vshr (for example) ?

@Akira1Saitoh

Copy link
Copy Markdown
Contributor

@gita-omr Either way works for AArch64. I have already drafted vector shift evaluators with the assumption that vsplats of the constant comes as the second child of vector shift node for broadcastInt case.
Akira1Saitoh/omr@c0a7e2f
AArch64 has dedicated instructions for vector shifts with immediate value as well as vector shifts with the value in the register.
https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/SHL--Shift-Left--immediate--
https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/SSHL--Signed-Shift-Left--register--

@gita-omr

Copy link
Copy Markdown
Contributor Author

@gita-omr Either way works for AArch64. I have already drafted vector shift evaluators with the assumption that vsplats of the constant comes as the second child of vector shift node for broadcastInt case.

Thanks @Akira1Saitoh ! What if vsplats is put in a register, for example by PRE. Then, we will not be able to use vector shift with immediate instruction.

@Akira1Saitoh

Copy link
Copy Markdown
Contributor

@gita-omr Agree. If we have dedicated opcodes, the evaluator will be able to use appropriate instructions without getting affected by other optimizations.

@gita-omr
gita-omr force-pushed the new_opcodes_java20 branch 4 times, most recently from 3f2e506 to 56232f9 Compare April 14, 2023 03:41
@Akira1Saitoh

Copy link
Copy Markdown
Contributor

@gita-omr Looks like the same applies to rotate operations.

It seems that we need to recognize VectorSupport.broadcastInt to vectorize lanewise shift operations with immediate shift amount. https://github.com/ibmruntimes/openj9-openjdk-jdk19/blob/e336ea0f0702e0a790ad0f52658b093fc1a86b8a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java#L1008-L1020

@gita-omr

Copy link
Copy Markdown
Contributor Author

@gita-omr Looks like the same applies to rotate operations

Thanks @Akira1Saitoh . I will add those too.

@gita-omr
gita-omr force-pushed the new_opcodes_java20 branch from 56232f9 to 6f22398 Compare April 24, 2023 15:40
@gita-omr
gita-omr force-pushed the new_opcodes_java20 branch from 72a9f6a to 447cb2c Compare May 5, 2023 21:33
@gita-omr gita-omr changed the title WIP: Handle new vector opcodes Handle new vector opcodes May 10, 2023
@0xdaryl

0xdaryl commented May 15, 2023

Copy link
Copy Markdown
Contributor

Is this a breaking dependence on the OMR PR, or does the OMR one simply have to merge first?

Comment thread runtime/compiler/optimizer/VectorAPIExpansion.hpp Outdated
Comment thread runtime/compiler/optimizer/VectorAPIExpansion.cpp Outdated
@gita-omr

Copy link
Copy Markdown
Contributor Author

Is this a breaking dependence on the OMR PR, or does the OMR one simply have to merge first?

OMR just needs to be merged first.

@gita-omr
gita-omr force-pushed the new_opcodes_java20 branch from 2921a37 to 3321ede Compare May 23, 2023 19:45
@gita-omr

Copy link
Copy Markdown
Contributor Author

Addressed comments above.

@knn-k

knn-k commented May 23, 2023

Copy link
Copy Markdown
Contributor

Jenkins test sanity all jdk17 depends eclipse-omr/omr#6942

@knn-k knn-k added the comp:jit label May 24, 2023

@knn-k knn-k 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.

Waiting for eclipse-omr/omr#6942 to be merged.

@knn-k knn-k self-assigned this May 26, 2023
@0xdaryl

0xdaryl commented May 26, 2023

Copy link
Copy Markdown
Contributor

Waiting for eclipse-omr/omr#6942 to be merged.

Because 6942 is needed for an OpenJ9 feature, I am holding off merging it until the OMR Acceptance build is successful. Even though the risk is low, I don't want to inject any unnecessary instability into that build because it has been nearly 2 weeks since the last promotion.

@knn-k

knn-k commented Jun 1, 2023

Copy link
Copy Markdown
Contributor

Jenkins compile amac jdk17

@knn-k
knn-k merged commit bedafef into eclipse-openj9:master Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants