mh_sha1: add an mh_sha1 assembly implementation with vector extension for riscv64 #168

Open
HeliC829 wants to merge 1 commit from HeliC829/risc-v-mh-sha1 into master
HeliC829 commented 2025-12-21 02:36:00 -06:00 (Migrated from github.com)

This PR added an mh_sha1 assembly implementation with vector extension for riscv64.

Origin C implementation:

mh_sha1_update_base_warm: runtime =     247264 usecs, bandwidth 31 MB in 0.2473 sec = 132.52 MB/s
isal_mh_sha1_update_warm: runtime =    2464763 usecs, bandwidth 312 MB in 2.4648 sec = 132.95 MB/s

Assembly implementation with vector extension :

mh_sha1_update_base_warm: runtime =     213991 usecs, bandwidth 31 MB in 0.2140 sec = 153.13 MB/s
isal_mh_sha1_update_warm: runtime =     863086 usecs, bandwidth 312 MB in 0.8631 sec = 379.66 MB/s
This PR added an mh_sha1 assembly implementation with vector extension for riscv64. Origin C implementation: ``` mh_sha1_update_base_warm: runtime = 247264 usecs, bandwidth 31 MB in 0.2473 sec = 132.52 MB/s isal_mh_sha1_update_warm: runtime = 2464763 usecs, bandwidth 312 MB in 2.4648 sec = 132.95 MB/s ``` Assembly implementation with vector extension : ``` mh_sha1_update_base_warm: runtime = 213991 usecs, bandwidth 31 MB in 0.2140 sec = 153.13 MB/s isal_mh_sha1_update_warm: runtime = 863086 usecs, bandwidth 312 MB in 0.8631 sec = 379.66 MB/s ```
pablodelara commented 2025-12-30 03:20:38 -06:00 (Migrated from github.com)

This will be merged after the new release is out next month, thanks

This will be merged after the new release is out next month, thanks
HeliC829 commented 2026-08-31 03:15:15 -05:00 (Migrated from github.com)

kindly ping for merge.

kindly ping for merge.
pablodelara commented 2026-08-31 04:22:15 -05:00 (Migrated from github.com)

Sorry @HeliC829 for keeping you waiting. @sunyuechi could you review this PR? Thanks!

Sorry @HeliC829 for keeping you waiting. @sunyuechi could you review this PR? Thanks!
sunyuechi (Migrated from github.com) reviewed 2026-08-31 05:00:21 -05:00
@ -0,0 +1,416 @@
/**********************************************************************
sunyuechi (Migrated from github.com) commented 2026-08-31 05:00:21 -05:00

TMP2 unused

TMP2 unused
sunyuechi (Migrated from github.com) reviewed 2026-08-31 05:00:46 -05:00
@ -0,0 +1,416 @@
/**********************************************************************
sunyuechi (Migrated from github.com) commented 2026-08-31 05:00:47 -05:00

vadd.vx

vadd.vx
sunyuechi (Migrated from github.com) reviewed 2026-08-31 05:20:49 -05:00
HeliC829 (Migrated from github.com) reviewed 2026-09-02 07:32:17 -05:00
@ -0,0 +1,416 @@
/**********************************************************************
HeliC829 (Migrated from github.com) commented 2026-09-02 07:32:17 -05:00

removed.

removed.
HeliC829 (Migrated from github.com) reviewed 2026-09-02 07:32:26 -05:00
@ -0,0 +1,416 @@
/**********************************************************************
HeliC829 (Migrated from github.com) commented 2026-09-02 07:32:26 -05:00

done.

done.
HeliC829 (Migrated from github.com) reviewed 2026-09-02 07:33:52 -05:00
HeliC829 (Migrated from github.com) reviewed 2026-09-02 07:33:59 -05:00
sunyuechi commented 2026-09-02 10:50:23 -05:00 (Migrated from github.com)

0001-mh_sha1-process-all-16-segments-per-pass-in-the-risc.patch

The loop runs many times but vl=4 instead of something big, looks like
fixed-width SIMD usage.

You could use vl=16 and pick m1/m2/m4 based on vlen to cut the iteration
count. I tried it and got another 2-3x.

Maybe amend on top of this patch and see if anything else is worth changing,
If vl=4 is really needed, a comment would help.

[0001-mh_sha1-process-all-16-segments-per-pass-in-the-risc.patch](https://github.com/user-attachments/files/31745435/0001-mh_sha1-process-all-16-segments-per-pass-in-the-risc.patch) The loop runs many times but vl=4 instead of something big, looks like fixed-width SIMD usage. You could use vl=16 and pick m1/m2/m4 based on vlen to cut the iteration count. I tried it and got another 2-3x. Maybe amend on top of this patch and see if anything else is worth changing, If vl=4 is really needed, a comment would help.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'HeliC829/risc-v-mh-sha1:HeliC829/risc-v-mh-sha1'
git switch 'HeliC829/risc-v-mh-sha1'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'HeliC829/risc-v-mh-sha1'
git switch 'HeliC829/risc-v-mh-sha1'
git rebase 'master'
git switch 'master'
git merge --ff-only 'HeliC829/risc-v-mh-sha1'
git switch 'HeliC829/risc-v-mh-sha1'
git rebase 'master'
git switch 'master'
git merge --no-ff 'HeliC829/risc-v-mh-sha1'
git switch 'master'
git merge --squash 'HeliC829/risc-v-mh-sha1'
git switch 'master'
git merge --ff-only 'HeliC829/risc-v-mh-sha1'
git switch 'master'
git merge 'HeliC829/risc-v-mh-sha1'
git push origin 'master'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-intel/isa-l_crypto!168
No description provided.