[23.10 FEAT] libgmp SIMD optimizations

Bug #1926752 reported by bugproxy
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu on IBM z Systems
Fix Released
High
Skipper Bug Screeners
gmp (Ubuntu)
Fix Released
Undecided
Graham Inggs

Bug Description

Optimize the GNU MP Bignum Library using vector instructions.

- Requirement for Full Homomorphic Encryption, libgmp is used as a backend for NTL
- libgmp performance is critical also for GNU Cobol on Z.
Here a customer requested using packed decimal instructions in libgmp which does not appear to fit for libgmp - however SIMD would help on distros with ALS z13

https://gmplib.org/#STATUS

bugproxy (bugproxy)
tags: added: architecture-s39064 bugnameltc-192585 severity-high targetmilestone-inin2110
Changed in ubuntu:
assignee: nobody → Skipper Bug Screeners (skipper-screen-team)
affects: ubuntu → linux (Ubuntu)
Revision history for this message
Frank Heimes (fheimes) wrote :

Please let us know the version the SIMD optimizations are going to land in.

affects: linux (Ubuntu) → gmp (Ubuntu)
Changed in ubuntu-z-systems:
importance: Undecided → High
assignee: nobody → Skipper Bug Screeners (skipper-screen-team)
status: New → Incomplete
Changed in gmp (Ubuntu):
status: New → Incomplete
Revision history for this message
Frank Heimes (fheimes) wrote :

Any updates on the version required to get this?

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2021-05-18 04:53 EDT-------
Feature will be introduced wiht libgmp > 6.2.1. Will keep you updated

tags: added: fr-1394
Frank Heimes (fheimes)
description: updated
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2021-08-05 08:58 EDT-------
An updated version of the patches has been posted on the mailing list waiting for review. The patch will go into unstable branch first but we will provide a backport for 6.2 stable branch:

https://gmplib.org/list-archives/gmp-devel/2021-August/006005.html

Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2021-09-09 04:26 EDT-------
Fix didn't make it into impish / 21.10, hence moving to 22.04
Changing IBM BZ Target Milestone:21.10->22.04

tags: added: targetmilestone-inin2204
removed: targetmilestone-inin2110
Frank Heimes (fheimes)
summary: - [21.10 FEAT] libgmp SIMD optimizations
+ [22.04 FEAT] libgmp SIMD optimizations
Revision history for this message
Frank Heimes (fheimes) wrote : Re: [22.04 FEAT] libgmp SIMD optimizations

I can see the z13 patches mentioned still here:
https://gmplib.org/list-archives/gmp-devel/2021-August/006005.html
and here:
https://gmplib.org/list-archives/gmp-devel/2021-November/006059.html
Looks like they are still not upstream accepted yet
and there is no (pre-)release of > 6.2.1 available yet.
Leave this ticket aside for now.

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2022-03-14 06:55 EDT-------
The required patches are still not upstream accepted, and with that, not in time for jammy.
Therefore, moving this item to Ubuntu 22.10
Changing target milestone: -> 22.10

Frank Heimes (fheimes)
tags: added: targetmilestone-inin2210
removed: targetmilestone-inin2204
summary: - [22.04 FEAT] libgmp SIMD optimizations
+ [22.10 FEAT] libgmp SIMD optimizations
bugproxy (bugproxy)
tags: added: targetmilestone-inin2204
removed: targetmilestone-inin2210
bugproxy (bugproxy)
tags: added: targetmilestone-inin2210
removed: targetmilestone-inin2204
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2022-08-26 06:05 EDT-------
Still not upstream accepted yet, therefore we need to move this to Ubuntu 23.04
Changing target milestone: -> 23.04

tags: added: targetmilestone-inin2304
removed: targetmilestone-inin2210
Frank Heimes (fheimes)
summary: - [22.10 FEAT] libgmp SIMD optimizations
+ [23.04 FEAT] libgmp SIMD optimizations
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2023-01-18 05:50 EDT-------
Making good progress, but will not make it in time for Lunar, therefore we need to postpone to 23.10.

Changing target milestone to: 23.10

Frank Heimes (fheimes)
summary: - [23.04 FEAT] libgmp SIMD optimizations
+ [23.10 FEAT] libgmp SIMD optimizations
bugproxy (bugproxy)
tags: added: targetmilestone-inin2310
removed: targetmilestone-inin2304
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2023-07-11 08:24 EDT-------
The patches are now committed:
"Improved s390/z13 support from IBM."
https://gmplib.org/repo/gmp/rev/3a1d9af8b317

I've also added the upstream commit as is and added it to
libgmp10/lunar,now 2:6.2.1+dfsg1-1.1ubuntu1 s390x

In order to get use of it, you have to select those optimizations.
As the current gcc ALS is z13, we can just use the z13 code-paths as default by selecting those like this:

in debian/rules:
ifneq (,$(filter $(DEB_HOST_ARCH), mips64 mips64el))
confflags += ABI=64
endif

+ifneq (,$(filter $(DEB_HOST_ARCH), s390x))
+ confflags += MPN_PATH="s390_64/z13 s390_64 generic"
+endif

confflags_ma = $(confflags) $(confflags_build) --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

Frank Heimes (fheimes)
Changed in ubuntu-z-systems:
status: Incomplete → New
Changed in gmp (Ubuntu):
status: Incomplete → New
Revision history for this message
Frank Heimes (fheimes) wrote :

Thx Stefan, looks pretty straight forward - nicely prepared!
Guess it's a bit challenging to test properly.
I've just created test builds that are available here:
https://launchpad.net/~fheimes/+archive/ubuntu/lp1926752

debdiff is attached

Changed in ubuntu-z-systems:
status: New → In Progress
Changed in gmp (Ubuntu):
status: New → In Progress
assignee: Skipper Bug Screeners (skipper-screen-team) → Frank Heimes (fheimes)
Revision history for this message
Frank Heimes (fheimes) wrote :

Uploaded to mantic with slightly modified changelog (compared to attached debdiff):
  * Add d/p/debian/patches/0014-improved_s390_z13_support_from_ibm.patch
    to incl. improved optimizations for s390x, based on z13. (LP: #1926752)
    Also requires to expand d/rules to select the s390x (z13) specific
    optimizations by expanding MPN_PATH with the z13 code-path in confflags.

Revision history for this message
Frank Heimes (fheimes) wrote :

It's (surprisingly) a package from main, hence needs sponsorship.
Subscribing 'ubuntu-sponsors'.

Revision history for this message
Frank Heimes (fheimes) wrote :

added updated debdiff

Changed in gmp (Ubuntu):
assignee: Frank Heimes (fheimes) → nobody
information type: Private → Public
Revision history for this message
bugproxy (bugproxy) wrote : debdiff_gmp_mantic_from_6.2.1+dfsg1-1.1ubuntu1_to__6.2.1+dfsg1-1.1ubuntu2.diff

Default Comment by Bridge

Graham Inggs (ginggs)
Changed in gmp (Ubuntu):
assignee: nobody → Graham Inggs (ginggs)
Graham Inggs (ginggs)
Changed in gmp (Ubuntu):
status: In Progress → Fix Committed
Frank Heimes (fheimes)
Changed in ubuntu-z-systems:
status: In Progress → Fix Committed
Revision history for this message
Graham Inggs (ginggs) wrote :

I sponsored the upload to mantic

Revision history for this message
Frank Heimes (fheimes) wrote :

Many thx for your sponsorship, Graham!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gmp - 2:6.2.1+dfsg1-1.1ubuntu2

---------------
gmp (2:6.2.1+dfsg1-1.1ubuntu2) mantic; urgency=medium

  * Add d/p/debian/patches/0014-improved_s390_z13_support_from_ibm.patch
    to incl. improved optimizations for s390x, based on z13. (LP: #1926752)
    Also requires to expand d/rules to select the s390x (z13) specific
    optimizations by expanding MPN_PATH with the z13 code-path in confflags.

 -- Frank Heimes <email address hidden> Wed, 12 Jul 2023 10:56:34 +0200

Changed in gmp (Ubuntu):
status: Fix Committed → Fix Released
Frank Heimes (fheimes)
Changed in ubuntu-z-systems:
status: Fix Committed → Fix Released
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2023-07-21 05:29 EDT-------
I've installed libgmp-dev, libgmp10 from matic in version 2:6.2.1+dfsg1-1.1ubuntu2 and GMPbench shows the expected increase due to the z13 optimizations.
Thanks

Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2023-08-03 05:17 EDT-------
The new libgmp version 6.3.0 from upstream which was included in Ubuntu 23.10 (proposed) fails with illegal instructions due to the z13 part.

Therefore, z13 optimizations had to be temporarily removed until problem is fixed.

The error has been reported by Canonical in the following separate LP entry / bugzilla:

Bug 203320 - LP#2029438 : [Reverse Mirror] gmp z13 config fails with illegal instructions

Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2023-08-04 11:56 EDT-------
In the meantime, the error described in the separate BZ / LP
(Bug 203320 - LP#2029438 : [Reverse Mirror] gmp z13 config fails with illegal instructions)
has been fixed (thanks @Stefan)

Therefore, the z13 optimizations should now be re-included.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.