Skip to content
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

8332130: RISC-V: remove wrong instructions of Vector Crypto Extension #19211

Closed

Conversation

Hamlin-Li
Copy link

@Hamlin-Li Hamlin-Li commented May 13, 2024

Hi,
Can you help to reivew this simple patch to remove some wrong instrunctions on riscv?
These instrunctions are wrong in that e.g. take vror.vx as example,

  • by definition of spec, it should be vror.vx vd, vs2, *rs1*, vm
  • the implementation here, it is indeed vror_vx(VectorRegister Vd, VectorRegister Vs2, *VectorRegister* Vs1, VectorMask vm = unmasked)

Thanks


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8332130: RISC-V: remove wrong instructions of Vector Crypto Extension (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19211/head:pull/19211
$ git checkout pull/19211

Update a local copy of the PR:
$ git checkout pull/19211
$ git pull https://git.openjdk.org/jdk.git pull/19211/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19211

View PR using the GUI difftool:
$ git pr show -t 19211

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19211.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 13, 2024

👋 Welcome back mli! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 13, 2024

@Hamlin-Li This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8332130: RISC-V: remove wrong instructions of Vector Crypto Extension

Reviewed-by: luhenry, fyang

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 12 new commits pushed to the master branch:

  • ea5eb74: 8326404: Assertion error when trying to compile switch with fallthrough with pattern
  • beea530: 8331907: BigInteger and BigDecimal should use optimized division
  • 440782e: 8331466: Problemlist serviceability/dcmd/gc/RunFinalizationTest.java on generic-all
  • 5ded8da: 8332085: Remove 10 year old transition check in GenerateCurrencyData tool
  • 7c2c24f: 8261433: Better pkcs11 performance for libpkcs11:C_EncryptInit/libpkcs11:C_DecryptInit
  • ff4bf1c: 8332102: Add @since to package-info of jdk.security.jarsigner
  • abf54bb: 8332100: Add missing @since to KeyValue::EC_TYPE in java.xml.crypto
  • 1484153: 8332080: Update troff man page for javadoc
  • 391bbbc: 8330584: IGV: XML does not save all node properties
  • adaa509: 8327499: MethodHandleStatics.traceLambdaForm includes methods that cannot be generated
  • ... and 2 more: https://git.openjdk.org/jdk/compare/d517d2df451e135583083ed3684d7d3241b36f76...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title 8332130 RISC-V: remove wrong instructions of Vector Crypto Extension 8332130: RISC-V: remove wrong instructions of Vector Crypto Extension May 13, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label May 13, 2024
@openjdk
Copy link

openjdk bot commented May 13, 2024

@Hamlin-Li The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label May 13, 2024
@mlbridge
Copy link

mlbridge bot commented May 13, 2024

Webrevs

Copy link
Member

@luhenry luhenry left a comment

Choose a reason for hiding this comment

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

What do you mean by wrong? Happy to remove them but we should give some more context.

@Hamlin-Li
Copy link
Author

What do you mean by wrong? Happy to remove them but we should give some more context.

Thanks, update the pr desc to explain why they're wrong.

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

I think you mean the funct3 (OPIVV vs OPIVX) encoding is wrong?

@Hamlin-Li
Copy link
Author

I think you mean the funct3 (OPIVV vs OPIVX) encoding is wrong?

Yes

@RealFYang
Copy link
Member

RealFYang commented May 14, 2024

I think you mean the funct3 (OPIVV vs OPIVX) encoding is wrong?

Yes

From the RVV spec [1], the funct3 encoding for OPIVX is 0b100, which is also reflected on the instruction encoding.
So why would you think it's wrong? Anything I missed?

[1] https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#vector-arithmetic-instruction-formats

@luhenry
Copy link
Member

luhenry commented May 14, 2024

@RealFYang the .vx variant expect a scalar register while our vandn_vx takes a vector register. If we had a use for vandn_vx (or any of the other removed instructions), we would need to add another section with

#define INSN(NAME, op, funct3, funct6)                                                             \
  void NAME(VectorRegister Vd, VectorRegister Vs2, Register Rs1, VectorMask vm = unmasked) { \
    patch_VArith(op, Vd, funct3, Rs1->raw_encoding(), Vs2, vm, funct6);                            \
  }

But given we have no use for these instructions, I'm ok with removing them.

@RealFYang
Copy link
Member

@RealFYang the .vx variant expect a scalar register while our vandn_vx takes a vector register. If we had a use for vandn_vx (or any of the other removed instructions), we would need to add another section with

#define INSN(NAME, op, funct3, funct6)                                                             \
  void NAME(VectorRegister Vd, VectorRegister Vs2, Register Rs1, VectorMask vm = unmasked) { \
    patch_VArith(op, Vd, funct3, Rs1->raw_encoding(), Vs2, vm, funct6);                            \
  }

But given we have no use for these instructions, I'm ok with removing them.

Ah, I see. Looks good. Thanks.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 14, 2024
@Hamlin-Li
Copy link
Author

Sorry for misleading.
Thanks @luhenry @RealFYang for your reviewing.

/integrate

@openjdk
Copy link

openjdk bot commented May 14, 2024

Going to push as commit 7ce4a13.
Since your change was applied there have been 12 commits pushed to the master branch:

  • ea5eb74: 8326404: Assertion error when trying to compile switch with fallthrough with pattern
  • beea530: 8331907: BigInteger and BigDecimal should use optimized division
  • 440782e: 8331466: Problemlist serviceability/dcmd/gc/RunFinalizationTest.java on generic-all
  • 5ded8da: 8332085: Remove 10 year old transition check in GenerateCurrencyData tool
  • 7c2c24f: 8261433: Better pkcs11 performance for libpkcs11:C_EncryptInit/libpkcs11:C_DecryptInit
  • ff4bf1c: 8332102: Add @since to package-info of jdk.security.jarsigner
  • abf54bb: 8332100: Add missing @since to KeyValue::EC_TYPE in java.xml.crypto
  • 1484153: 8332080: Update troff man page for javadoc
  • 391bbbc: 8330584: IGV: XML does not save all node properties
  • adaa509: 8327499: MethodHandleStatics.traceLambdaForm includes methods that cannot be generated
  • ... and 2 more: https://git.openjdk.org/jdk/compare/d517d2df451e135583083ed3684d7d3241b36f76...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 14, 2024
@openjdk openjdk bot closed this May 14, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 14, 2024
@openjdk
Copy link

openjdk bot commented May 14, 2024

@Hamlin-Li Pushed as commit 7ce4a13.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@Hamlin-Li Hamlin-Li deleted the remove-wrong-instructions branch May 17, 2024 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
3 participants