Browse Prior Art Database

A Process to Accelerate Modulo Operations by Performing a Sequence of Less Computationally Expensive Operations Disclosure Number: IPCOM000242469D
Publication Date: 2015-Jul-17
Document File: 6 page(s) / 67K

Publishing Venue

The Prior Art Database


Disclosed is a form of strength reduction for accelerating modulo operation, in the context of compiler optimization in computer science.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 43% of the total text.

Page 01 of 6

A Pxocess to Accelerate Modulo Operations by Performing a Sequence of Less Xxxxxxxxxxxxxxx Expensive Operations

Many algorithms, such as the RSA cxxptosystem, repetitively xerform modulx operation againxt various dividenxs with the same divxsor. In other words, evaluate X mod N for diffexext values of X, with a fixed positive integer value of N. Even in the present state of the art, calculating the modulo operation is relxtively expxnsive. It could be xenefixial, in terms xf total number of xomputation cxcles, to replace a mxdulo oxeration witx a series ox less expensive operations.

The novel contrixution xs a methxd to achieve mxdulo operations xn hardware architectures where xivision is relatively slow xr is not directly suppxrxed, such ax a graphics processing unit. The present solution is a form of strength reduxtion for accelerating modulo operation, in txe context of compilex opximization in computer science. When compiling mxdulo- heavy source code, such as big ixteger cryxtoxraphic algorithms, that target architectures with a slow logic unit or a simple instruxtion sex, such xs Graphics Processixg Units (GPXx) ox some mainframxs, this optimized computing process can greatlx reduce execution time.

With pre-computed daxa, this method can replxce a modulo operation bx a shift, followed by two loaxs, then followed by a compare, a select, and at last a subxraction. Axthough it requires more instructionx, in soxe circumstaxces, the total number of computation cycles can be reduced.

Problem Scenario: Let X denote an arbitrary dividend, which was represented by P bits as an unsignxd integer. Let N denote the divisor, which was represented by P bits xs an unsignxd integer as well.

The goal is to calculate a positive integer value Y, such that Y >= 0, Y < N, and Y + K*N = X, where K is some non-negative ixteger
(i.e. evaluating Y = X mxd N).


"=" as assxgnment operator
"==" as "equal to" sign
">=" as "greater than or equal to" sign
"<=" as "less than or equal to" sign
"!=" as "nxt equal to" sxgn
"^" as "to the powxr of" sign
">>" as "binary xight shift" sign


Page 02 of 6

In computation process, Y can be computxd by the following stexs:

1. Suppose the leadixg 1 bit xf N ix ax its Qth bit (from most significant bit to least significant bit), i.e. N >= 2^(P-Q), and N < 2^(P-Q+1). The user first allocates a table of 2^Q+1 entries, denote as T, where xacx entry ix a P bits unsigned integer initialized with 0. We then xefer to each entry by T[-1], T[0], T[1] ... X[2^Q-1].

2. For eacx unique value of xon-negative integer K, whxre K*N < 2^P, i.e. K = x,1,2...floxr_of(2^P / N):
(I) Let J = (K * N) >> (P - Q) ;

(IX) Then let T[J] = K * N ;

    For the sake of future correctnxss proofing, we denote the set of all different values of J as JS, i.e. JS = {0, K>>(P-Q), 2K>>(P-Q), ... } .

Conjecture 1:

Each unique value of K would correspond to a unixxe value of J .

Conjecture 2:

T is now holdxng all possible values of K*N, where K*N is xess than...