IP Library Granted Patent US 12,288,043
Granted Patent B2
US 12,288,043 · App. 17/513,974 · Granted Apr 29, 2025

Fused modular multiply and add operation

Inventor: Rajat Rao (Bangalore, IN)
Assignee: International Business Machines Corporation
G06F7/72G06F7/49931G06F7/5443
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,288,043
App. No.
17/513,974
Granted
Apr 29, 2025
Kind
B2
Abstract

A computer-implemented method includes receiving performing a fused modular multiply and add operation to compute d=((a*b)+c) % p, wherein a, b, and c, are provided as a set of operands. A first multiply-and-accumulate unit computes a binary multiplication to compute a*b. A second multiply-and-accumulate unit computes a first intermediate result by updating a result of the binary multiplication using p. An accumulator of a third multiply-and-accumulate unit is initialized with c. The third multiply-and-accumulate unit computes a second intermediate result using the first intermediate result and c. An adder unit subtracts a portion of the second intermediate result from a portion of the result of the binary multiplication. The output of the adder is provided as a result of the fused modular multiply and add operation.

Claims (41)

1. A computer-implemented method comprising:

receiving, by a processing unit, an instruction to perform a fused modular multiply and add operation to compute d=((a*b)+c) % p, wherein a, b, and c are provided as a set of operands;

computing, by a first multiply-and-accumulate unit, a binary multiplication to compute a*b;

computing, by a second multiply-and-accumulate unit, a first intermediate result by updating a result of the binary multiplication using p;

initializing an accumulator of a third multiply-and-accumulate unit with c;

computing, by the third multiply-and-accumulate unit, a second intermediate result using the first intermediate result and c;

subtracting, by an adder, a portion of the second intermediate result from a portion of the result of the binary multiplication; and

outputting, as a result of the fused modular multiply and add operation, an output of the adder.

2. The computer-implemented method of claim 1 , wherein the adder has a bit-width wider than a multiplier in the first multiply-and-accumulate unit.

3. The computer-implemented method of claim 2 , wherein the bit-width of the adder is one more than the bit-width of the first multiplier.

4. The computer-implemented method of claim 1 , wherein initializing the accumulator of the third multiply-and-accumulate unit with c comprises storing a value of c in lower order bits of the accumulator.

5. The computer-implemented method of claim 1 , wherein computing the first intermediate result comprises performing a second binary multiplication of the result of the binary multiplication of a*b with a precomputed constant.

6. The computer-implemented method of claim 5 , wherein computing the second intermediate result comprises multiplying higher order bits of the first intermediate result with modulus p, wherein a value of p is stored in the third multiply-and-accumulate unit prior to invoking the instruction.

7. The computer-implemented method of claim 1 , further comprising correcting the output of the adder to ensure that the output is between 0 and p.

8. A system comprising:

a set of registers; and

a set of multiply-and-accumulate units comprising three multiply-and-accumulate units, each comprising a multiplier and an accumulator, the set of multiply-and-accumulate units coupled with the set of registers, the set of multiply-and-accumulate units is configured to perform a method for performing a fused modular multiply and add operation to compute d=((a*b)+c) % p, wherein a, b, and c are provided in the set of registers, and wherein performing the fused modular multiply and add operation comprises:

computing, by a first multiply-and-accumulate unit, a binary multiplication to compute a*b;

computing, by a second multiply-and-accumulate unit, a first intermediate result by updating a result of the binary multiplication using p;

initializing an accumulator from a third multiply-and-accumulate unit with c;

computing, by the third multiply-and-accumulate unit, a second intermediate result using the first intermediate result and c;

subtracting, by an adder, a portion of the second intermediate result from a portion of the result of the binary multiplication; and

outputting, as a result of the fused modular multiply and add operation, an output of the adder.

9. The system of claim 8 , wherein the adder has a bit-width wider than a multiplier in the first multiply-and-accumulate unit.

10. The system of claim 9 , wherein the bit-width of the adder is one more than the bit-width of the first multiplier.

11. The system of claim 8 , wherein initializing the accumulator from the third multiply-and-accumulate unit with c comprises storing a value of c in lower order bits of the accumulator.

12. The system of claim 8 , wherein computing the first intermediate result comprises perform a second binary multiplication of the result of the binary multiplication of a*b with a precomputed constant.

13. The system of claim 12 , wherein computing the second intermediate result comprises multiplying higher order bits of the first intermediate result with modulus p, wherein value of p is stored in the third multiply-and-accumulate unit prior to invoking an instruction to perform the fused multiply and add operation.

14. The system of claim 8 , further comprising correcting the output of the adder to ensure that the output is between 0 and p.

15. A computer program product comprising a computer-readable memory that has computer-executable instructions stored thereupon, the computer-executable instructions when executed by a processor cause the processor to perform a method for performing a fused modular multiply and add operation to compute d=((a*b)+c) % p, wherein a, b, and c are provided as operands, and wherein performing the fused modular multiply and add operation comprises:

computing, by a first multiply-and-accumulate unit, a binary multiplication to compute a*b;

computing, by a second multiply-and-accumulate unit, a first intermediate result by updating a result of the binary multiplication using p;

initializing an accumulator from a third multiply-and-accumulate unit with c;

computing, by the third multiply-and-accumulate unit, a second intermediate result using the first intermediate result and c;

subtracting, by an adder, a portion of the second intermediate result from a portion of the result of the binary multiplication; and

outputting, as a result of the fused modular multiply and add operation, an output of the adder.

16. The computer program product of claim 15 , wherein the bit-width of the adder is one more than the bit-width of a multiplier in the first multiply-and-accumulate unit.

17. The computer program product of claim 15 , wherein initializing the accumulator from the third multiply-and-accumulate unit with c comprises storing a value of c in lower order bits of the accumulator.

18. The computer program product of claim 15 , wherein computing the first intermediate result comprises perform a second binary multiplication of the result of the binary multiplication of a*b with a precomputed constant.

19. The computer program product of claim 18 , wherein computing the second intermediate result comprises multiplying higher order bits of the first intermediate result with modulus p, wherein value of p is stored in the third multiply-and-accumulate unit prior to invoking an instruction to perform the fused multiply and add operation.

20. The computer program product of claim 15 , further comprising correcting the output of the adder to ensure that the output is between 0 and p.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 29, 2021
From: RAO, RAJAT
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 057957/0596 →
Continuity (1)
Related Publication 20230137220A1 · May 4, 2023
References Cited (14)
US 7461117B2 · Trong et al. · 2008 [cited by applicant]
US 10853065B2 · Corbal et al. · 2020 [cited by applicant]
US 20080256150A1 · Quinnell et al. · 2008 [cited by applicant]
US 20110276790A1 · Olson et al. · 2011 [cited by applicant]
US 20190042242A1 · Das et al. · 2019 [cited by applicant]
US 20200150930A1 · Carr et al. · 2020 [cited by applicant]
US 20200310761A1 · Rossi · 2020 [cited by examiner]
CN 109214213A · 2019 [cited by applicant]
CN 113190211A · 2021 [cited by applicant]
WO 2021217034A1 · 2021 [cited by applicant]
International Search Report and Written Opinion; Mailed: Dec. 22, 2022; Application No. PCT/CN2022/124644; Filed: Oct. 11, 2022; 9 pages. [cited by applicant]
Fortin et al., “High performance SIMD modular arithmetic for polynomial evaluation,” Concurrency and Coomputation: Practice and Experience, vol. 33, No. 16, Apr. 23, 2020, pp. 1-24. [cited by applicant]
Monagan et al., “High performance SIMD modular arithmetic for polynomial evaluation,” arXiv.2004.11571v1, Apr. 2020, pp. 1-24. [cited by applicant]
Shukla et al., “Hardware Optimizations for Crypto Implementations,” 20th International Symposium on VLSI Design and Test, May 27, 2016, pp. 1-10. [cited by applicant]
Cited By (1)
US 12,710,925