Skip to content

[RISCV] Add +unaligned-scalar-mem to spacemit-x60 #115125

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 1 commit into from
Nov 6, 2024

Conversation

lukel97
Copy link
Contributor

@lukel97 lukel97 commented Nov 6, 2024

I can't find any official documentation on this, but from other discussions1 and my own testing the spacemit-x60 seems to support unaligned scalar loads and stores.

They seem to be performant, and just from a quick test we get a 2.45% speedup on 500.perlbench_r on the Banana Pi F32.

This would allow it to take advantage of #107548.

Footnotes

  1. https://github.com/llvm/llvm-project/issues/110454#issuecomment-2382199460

  2. https://lnt.lukelau.me/db_default/v4/nts/32

I can't find any official documentation on this, but from earlier discussions[^1] and my own testing the spacemit-x60 seems to support unaligned scalar loads and stores.

They seem to be performant, and just from a quick test we get a 2.45% speedup on 500.perlbench_r[^2].

[1]: llvm#110454 (comment)
[2]: https://lnt.lukelau.me/db_default/v4/nts/32
@llvmbot
Copy link
Member

llvmbot commented Nov 6, 2024

@llvm/pr-subscribers-backend-risc-v

Author: Luke Lau (lukel97)

Changes

I can't find any official documentation on this, but from other discussions1 and my own testing the spacemit-x60 seems to support unaligned scalar loads and stores.

They seem to be performant, and just from a quick test we get a 2.45% speedup on 500.perlbench_r on the Banana Pi F32.

This would allow it to take advantage of #107548.


Full diff: https://github.com/llvm/llvm-project/pull/115125.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVProcessors.td (+2-1)
diff --git a/llvm/lib/Target/RISCV/RISCVProcessors.td b/llvm/lib/Target/RISCV/RISCVProcessors.td
index 5277752a38ad9e..e52a856183678a 100644
--- a/llvm/lib/Target/RISCV/RISCVProcessors.td
+++ b/llvm/lib/Target/RISCV/RISCVProcessors.td
@@ -476,7 +476,8 @@ def SPACEMIT_X60 : RISCVProcessorModel<"spacemit-x60",
                                         FeatureStdExtZicond,
                                         FeatureStdExtZvfh,
                                         FeatureStdExtZvkt,
-                                        FeatureStdExtZvl256b]),
+                                        FeatureStdExtZvl256b,
+                                        FeatureUnalignedScalarMem]),
                                        [TuneDLenFactor2,
                                         TuneOptimizedNF2SegmentLoadStore,
                                         TuneOptimizedNF3SegmentLoadStore,

Footnotes

  1. https://github.com/llvm/llvm-project/issues/110454#issuecomment-2382199460

  2. https://lnt.lukelau.me/db_default/v4/nts/32

Copy link
Contributor

@wangpc-pp wangpc-pp left a comment

Choose a reason for hiding this comment

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

LGTM.
(I confirmed this before, unaligned scalar access is supported but vector is not)

Copy link
Contributor

@zqb-all zqb-all left a comment

Choose a reason for hiding this comment

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

LGTM

@lukel97 lukel97 merged commit 5a16ed9 into llvm:main Nov 6, 2024
8 of 10 checks passed
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.

4 participants