Partial stochastic rounding that includes sticky and guard bits
AssigneeInternational Business Machines Corporation
InventorsJonathan D. Bradbury, Steven R. Carlough, Brian R. Prasky, Eric M. Schwarz
Life of this patent
Estimating the term…
Abstract
The disclosed herein related to a method for generating a partial stochastic rounding operation executed by a processor coupled to a memory. The method includes generating an intermediate result and causing a random number generator to generate a random number. The method also includes adding the random number to lower significant bits of the intermediate result to perturb any incrementing of most significant bits of the intermediate result to produce a resulting sum. The method also includes truncating the resulting sum into a final result. According to other embodiments, the above method can be implemented in a system or computer program product.
Claims16
A method for generating a partial stochastic rounding operation including managing hardware mechanisms to add a random number to an intermediate result executed by a processor coupled to a memory, the processor including wires routing outputs of a random number generator to inputs of a rounder, comprising:
- generating the intermediate result from at least two operands;
- causing the random number generator to generate the random number, the random number comprising M bits;
- inputting the random number to the rounder;
- causing the rounder to add the random number to M most significant bits of N lower significant bits of the intermediate result to perturb any incrementing of most significant bits of the intermediate result to produce a resulting sum, wherein M<N;
- and
- truncating the N lower significant bits from the resulting sum into a final result,
- wherein the intermediate result comprises guard bits followed by a sticky bit of all the remaining bits,
- wherein the intermediate result with the guard bits and the sticky bit are added to the random number and the final result is truncated.
A computer program product, the computer program product comprising a computer readable storage medium having program instructions for generating a partial stochastic rounding operation including managing hardware mechanisms to add a random number to an intermediate result embodied therewith, the program instructions executable by a processor including wires routing outputs of a random number generator to inputs of a rounder, to cause the processor to perform:
- generating the intermediate result from at least two operands;
- causing the random number generator to generate the random number, the random number comprising M bits;
- inputting the random number to the rounder;
- causing the rounder to add the random number to M most significant bits of N lower significant bits of the intermediate result to perturb any incrementing of most significant bits of the intermediate result to produce a resulting sum, wherein M<N;
- and
- truncating the N lower significant bits from the resulting sum into a final result,
- wherein the intermediate result comprises guard bits followed by a sticky bit of all the remaining bits,
- wherein the intermediate result with the guard bits and the sticky bit are added to the random number and the final result is truncated.
A system, comprising a processor and a memory storing program instructions for generating a partial stochastic rounding operation including managing hardware mechanisms to add a random number to an intermediate result thereon, the processor including wires routing outputs of a random number generator to inputs of a rounder, the program instructions executable by the processor to cause the system to perform:
- generating the intermediate result from at least two operands;
- causing the random number generator to generate the random number, the random number comprising M bits;
- inputting the random number to the rounder;
- causing the rounder to add the random number to M most significant bits of N lower significant bits of the intermediate result to perturb any incrementing of most significant bits of the intermediate result to produce a resulting sum, wherein M<N;
- and
- truncating the N lower significant bits from the resulting sum into a final result,
- wherein the intermediate result comprises guard bits followed by a sticky bit of all the remaining bits,
- wherein the intermediate result with the guard bits and the sticky bit are added to the random number and the final result is truncated.
Dependencies are inferred from the claim text.