Stochastic rounding logic
AssigneeAdvanced Micro Devices, Inc.
InventorGABRIEL H. LOH
Life of this patent
Estimating the term…
Abstract
Techniques and circuits are provided for stochastic rounding. In an embodiment, a circuit includes carry-save adder (CSA) logic having three or more CSA inputs, a CSA sum output, and a CSA carry output. One of the three or more CSA inputs is presented with a random number value, while other CSA inputs are presented with input values to be summed. The circuit further includes adder logic having adder inputs and a sum output. The CSA carry output of the CSA logic is coupled with one of the adder inputs of the adder logic, and the CSA sum output of the CSA logic is coupled with another input of the adder inputs of the adder logic. A particular number of most significant bits of the sum output of the adder logic represent a stochastically rounded sum of the input values.
Claims21
A stochastic rounding circuit comprising:
- carry-save adder (CSA) logic having three or more CSA inputs, a CSA sum output and a CSA carry output, wherein a random number value is presented at a particular CSA input from the three or more CSA inputs;
- adder logic having at least a plurality of adder inputs and a sum output;
- wherein the CSA carry output of the CSA logic is coupled with a first input of the plurality of adder inputs of the adder logic, and the CSA sum output of the CSA logic is coupled with a second input of the plurality of adder inputs of the adder logic;
- wherein a particular number of most significant bits of the sum output of the adder logic represent a stochastically rounded sum of at least two CSA inputs, other than the particular input, from the three or more CSA inputs of the CSA logic.
A method for stochastic rounding comprising:
- receiving, at carry-save adder logic, a plurality of input values, wherein at least one input value of the plurality of input values is a randomly generated number;
- based at least in part on the randomly generated number, generating a carry output value and a carry-less sum output value;
- receiving, at adder logic, the carry output value and the carry-less sum output value;
- based at least in part on the carry output value and the carry-less sum output value, generating a sum of the plurality of input values;
- selecting a particular number of most significant bits as a stochastically rounded sum of the plurality of input values.
A method of stochastic rounding comprising:
- generating, at first adder logic, an intermediate sum of a plurality of input values;
- based on a most significant bit of the intermediate sum, determining that the intermediate sum is negative;
- converting a randomly generated value into a negative randomly generated value;
- based on the intermediate sum and the negative randomly generated value, generating, at second adder logic, a sum of the plurality of input values;
- selecting a particular number of most significant bits of the sum of the plurality of input values as a stochastically rounded sum of the plurality of input values.
Dependencies are inferred from the claim text.