Encoding Special Values in Anchor Data Elements
HPA numbers address the non-associative issues in floating point arithmetic by defining a pair (i, a) to ensure consistent and reproducible addition, facilitating parallel processing and enhancing computational efficiency.
Patent Information
- Application Number
- JP2021544755
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2019-02-06
- Filing Date
- 2019-12-02
- Publication Date
- 2024-08-28
- Estimated Expiration
- 2039-12-02
AI Technical Summary
Floating point arithmetic in data processing systems is non-associative, leading to inconsistent results when adding numbers in different orders, which complicates parallelization and debugging, especially in high-performance computing.
The introduction of High Precision Anchor (HPA) numbers, defined by a pair (i, a), where i is a long two's complement integer and a is the anchor integer, allows for associative and reproducible addition by specifying the significance of bits, enabling efficient parallel processing.
HPA numbers provide faster and reproducible summation, allowing parallelization of computations with results that are consistent regardless of the order of addition, improving performance in high-performance computing and other applications.
Smart Images

Figure 0007541524000013 
Figure 0007541524000021 
Figure 0007541524000010
Abstract
Description
[Technical field]
[0001] The present technology relates to the field of data processing. [Background technology]
[0002] It is common for data processing systems to use floating-point (FP) representation. Floating-point numbers contain a mantissa and an exponent that indicates the significance of the bits in the mantissa. This allows a wide range of numbers to be represented using a finite number of bits. However, a problem with floating-point arithmetic is that addition is problematic, since the calculations are generally non-associative. In particular, programmers must be careful to get different results even when adding fractional values.
[0003] To solve this associativity problem, a new data type called High Precision Anchor (HPA) numbers has been proposed. High Precision Anchor (HPA) numbers can be constructed from a pair (i,a) containing a long two's complement (e.g. 200 bits) integer i, usually by specifying the significance of the least significant bit of i, and a small anchor integer a, which represents the weight of i's bits. Floating-point values can be converted to the HPA format and then addition can be performed associatively. Summary of the Invention [Problem to be solved by the invention]
[0004] At least some examples provide an apparatus comprising: a processing circuit for performing data processing; and an instruction decoder for controlling the processing circuit to perform an anchor data processing operation to generate an anchor data element, the anchor data element having an encoding including type information indicating whether the anchor data element represents a portion of two's complement bits corresponding to a given range of significance representable using the anchor data element, or represents a special value other than the portion of two's complement bits.
[0005] At least some examples provide a computer program for controlling a host data processing apparatus to provide an instruction execution environment for executing instructions, the computer program including instruction decode program logic for decoding program instructions of a target code that controls the host data processing apparatus to perform data processing, the instruction decode program logic including anchor data processing program logic for controlling the host data processing apparatus to perform an anchor data processing operation to generate an anchor data element, the anchor data element having an encoding including type information indicating whether the anchor data element represents a portion of bits of a two's complement number corresponding to a given range of significance representable using the anchor data element, or represents a special value other than the portion of bits of the two's complement number.
[0006] The computer program may be stored in a storage medium. The storage medium may be a non-transitory storage medium.
[0007] At least some examples provide a data processing method comprising: decoding one or more instructions; and controlling a processing circuit, in response to the decoded instructions, to perform an anchor data processing operation to generate an anchor data element, the anchor data element having an encoding including type information indicating whether the anchor data element represents a portion of a two's complement number of bits corresponding to a given range of significance representable using the anchor data element, or represents a special value other than the portion of the two's complement number of bits.
[0008] Further aspects, features and advantages of the present technology will become apparent from the following description of examples which should be read in conjunction with the accompanying drawings. [Brief description of the drawings]
[0009] [Figure 1] FIG. 1 is a schematic diagram of a data processing device. [Diagram 2]FIG. 2 is a diagram showing a schematic diagram of different expressions of numerical values. [Diagram 3] FIG. 3 is a diagram illustrating an example of a relationship between a double-precision floating-point value and a high precision anchor (HPA) value. [Figure 4] FIG. 4 is a diagram showing an example of a redundant HPA value that expresses a numerical value using a redundant expression including multiple N-bit parts with overlapping significance. [Diagram 5] FIG. 5 is a schematic diagram illustrating how HPA integers may be stored in selected lanes across multiple vector registers in one example. [Figure 6] FIG. 6 is a block diagram illustrating a schematic of how floating-point numbers may be converted to HPA format and processed according to one exemplary configuration. [Figure 7] FIG. 7 is a schematic diagram illustrating the form of metadata that may be used in one example. [Figure 8] FIG. 8 illustrates in greater detail the conversion and processing circuitry that may be provided in association with each lane in one example. [Figure 9] FIG. 9 is a diagram illustrating the encoding of an anchor data element that includes type information indicating whether the anchor data element represents a portion of the bits of a two's complement number or represents a special value. [Figure 10] FIG. 10 is a diagram illustrating the encoding of type information. [Figure 11] FIG. 11 is a diagram illustrating different results in setting type information of a result anchor data element based on type information of a first operand and a second operand. [Figure 12] FIG. 12 illustrates an example of circuit logic for implementing addition of two anchor data elements that include type information. [Figure 13] FIG. 13 is a diagram illustrating an example of a duplicate propagation instruction. [Figure 14] FIG. 14 is a diagram illustrating an example of a duplicate clear command. [Figure 15] FIG. 15 shows an example of a simulator that may be used. Examples for carrying out the invention
[0010] As mentioned above, the problem with floating-point arithmetic is that the calculations are generally associative, which is a problem for addition. For example, when adding multiple floating-point values, each time another value is added to the result of the previous addition, the result is rounded and normalized, which means that the overall result will differ depending on the order in which the values are added. This makes parallelization of floating-point arithmetic difficult, since the sum will not be reproducible unless the values are added in exactly the same order. To get a reproducible result, a series of additions or subtractions must usually be performed in succession, which makes floating-point arithmetic relatively slow.
[0011] So programmers use more precision than necessary to avoid these different results, and so programmers cannot easily parallelize their code because the sums are not reproducible unless they are calculated in the same order.
[0012] This problem is especially prevalent in high performance computing (HPC), where a program may need to add millions of values together. Programmers would like to parallelize these problems, but doing so makes them hard to debug because they are not reproducible: even different machine configurations will give different answers, even if they are perfectly reprogrammed for that machine.
[0013] As mentioned above, a new data type called HPA (High Precision Anchor) numbers is proposed to solve the associativity problem. HPA numbers can contain a pair (i,a) consisting of a long two's complement integer i (e.g., 200 bits) and a smaller anchor integer a that typically represents the weight of i's bits by specifying the significance of the least significant bit. This pair is somewhat similar to the mantissa and exponent values of FP numbers, except that the long integer i is not normalized and is typically much larger than the FP mantissa, and the anchor value a is fixed for all operands of an HPA operation. Adding FP numbers can change the exponent, but adding HPA numbers does not change the anchor.
[0014] As a trivial example, consider an HPA representation consisting of 10 bits of i and an anchor value a = -4. Some values for this format are shown in Table 1.
[0015] [Table 1]
[0016] Adding two numbers, such as 0.5 and 1.5, does not change the anchor (-4), so the sum is conveniently obtained by adding only the i values. Because HPA summation is just two's complement addition, over sufficient range, HPA summation is associative, exact, and repeatable.
[0017] FP numbers have a wide range. Double precision numbers (FP64) are 2 -1000 Smaller, 2 1000 Although it can be larger, most integrations do not span this entire range. In fact, it is hard to imagine a problem where all values in this range can be meaningfully added, and even in HPC most integrations are limited to this range. For most applications that require a range larger than double precision arithmetic, 200 bits or so seems sufficient. If a programmer wants to convert all the data in a sum to double precision, 100 It is smaller in size than 2 -50 Let us assume that bits of the following magnitude do not significantly affect the sum: if we add data with 200 bits i in HPA format (i,-50), the accumulation is associative and will be at least 2 49 You can add numbers together in any order without worrying about overflow.
[0018] Most modern architectures have Single Instruction Multiple Data (SIMD) units that can be used to represent long integers. With some additional logic to facilitate carries between 64-bit lanes, a 256-bit SIMD unit can be used to add 256-bit integers. Alternatively, most additions can avoid carries between lanes by using a redundant representation, as described in more detail below. One approach to represent an HPA (anchor data) value (or a long integer) in a SIMD register is to assign several HPA (anchor data) elements of an HPA value to each vector lane in a single SIMD register. Alternatively, as described below, each anchor data element of an HPA value can be assigned to a corresponding vector lane in several different SIMD registers, with each part of the total anchor data value in a corresponding location in a different vector register, and a single vector register can contain several anchor data elements, each part of a different anchor data value (HPA value).
[0019] In the technique described below, the apparatus may have a processing circuit for performing data processing and an instruction decoder for controlling the processing circuit to perform an anchor data processing operation to generate an anchor data element, the anchor data element having an encoding including type information. The type information indicates whether the anchor data element represents a portion of two's complement bits (where the portion of the bits corresponds to a given range of significance representable using the anchor data element) or represents a special value other than the portion of two's complement bits within the given range of significance. Providing an encoding that can represent special values other than the portion of two's complement bits is useful for enabling the anchor data format to represent special values of floating point numbers such as Not a Number (NaN) or infinity. Special values may also be useful for representing cases where the given range of significance assumed for the anchor data element is not appropriate for representing a number resulting from a processing operation performed by the processing circuit.
[0020] One alternative approach to handling special values is to encode the fact that the anchor data element represents a special value separate from the anchor data element itself in a separate register, or in a register that defines anchor information or metadata that identifies a given range of significance that can be expressed using the anchor data element or other information about how to encode the anchor data element. However, a problem with this approach is that when performing the anchor data processing operation, the processing circuitry may need to update two separate destination registers. This may be undesirable for some microarchitectural implementations, as it may require providing two separate register write ports for the processing circuitry. In an instruction set architecture, there are relatively few instructions that require updating more than one destination register, so many microarchitectural implementations may only provide one register write port. Thus, avoiding the need to provide a second register write port to support the encoding of special values helps reduce circuit area and power consumption. Alternatively, even if the device has more than one register write port, when processing the anchor data processing operation, the second write port may be used to perform different register writes in response to different instructions, rather than being used for the same instructions as the first register write port. Thus, special values of the anchor data value can be represented without using a second register write port, which can save circuit area and / or improve performance by allowing an available register write port to be used to process additional instructions.
[0021] The processing circuitry may store the type information in the same register as the anchor data element.
[0022] In one example, the anchor data processing operation may include a floating-point to anchor data conversion operation to convert a floating-point value to an anchor data element. Special value encodings may be particularly useful for floating-point to anchor data conversion operations, as they may help accommodate special values of floating-point numbers. For example, if the floating-point value to be converted represents a special number, such as positive or negative infinity, or NaN, the processing circuitry may generate an anchor data element with type information indicating that the anchor data element represents a special value. The type information may distinguish whether the special number represented by the floating-point value is positive infinity, negative infinity, or NaN. Thus, the type information may have different encodings assigned to represent each case of positive infinity, negative infinity, and NaN.
[0023] In a floating-point to anchor data conversion operation, the processing circuitry can generate the anchor data element based on anchor metadata that indicates a given significance range of the anchor data element. For example, the anchor data element can specify the significance of the least significant bit of the anchor data element (the significance indicating the power of 2 represented by that least significant bit) and can also provide a parameter that indicates the width (number of bits) of the portion of the two's complement number represented by the anchor data element. The floating-point to anchor data conversion operation can use this metadata to determine how to set the values of the bits in the anchor data element based on the provided floating-point number. The anchor metadata can also indicate other characteristics such as the number of overlapping bits, as described below, and / or lane information that indicates the relative position of the anchor data element with respect to other elements for an anchor value composed of one or more anchor data elements, e.g., whether the anchor data element represents the most significant element, the least significant element, or a middle element of the anchor data value. This allows the anchor data value to represent long two's complement numbers using a large number of vector elements.
[0024] While the above examples discuss the generation of individual data elements, it will be appreciated that operations on anchor data elements can be implemented with vector instructions that execute multiple lanes of processing in response to one instruction, with each lane of processing generating a respective anchor data element based on a corresponding operand provided as input. In a floating-point to anchor data conversion operation, a respective floating-point value can be provided to each lane and converted to a respective anchor data element based on a vector of anchor metadata. In the case of an addition operation described below, multiple independent respective pairs of anchor data elements can be added in a vector operation. As described below, it can be useful to stripe each anchor data element of a given anchor data value across corresponding data elements in corresponding positions in multiple different vector registers. However, it is also possible to represent each element of a single anchor data value in each vector lane of a single vector register.
[0025] In some examples, the type information may specify whether an anchor data element is a saturation type anchor data element. A saturation type anchor data element may be dependent on a previous anchor data processing operation that overflowed the corresponding anchor data element, or a previous floating-point to anchor data conversion operation in which the converted floating-point value is outside the allowed numerical range of the anchor data value that contains one or more anchor data elements. In addition to the special values representing positive infinity, negative infinity, or NaN described above, a saturation type may be supported, but unlike these, a saturation type does not have an analogous special value in the floating-point representation. A saturation type may be used to indicate when a significance range defined for an anchor data value is inadequate to accommodate the input required for an anchor data processing operation. For example, if the metadata associated with an anchor data value defines a particular numerical range, but a floating-point value is provided as an input outside that range, the correct numerical result of processing that floating-point value cannot be adequately represented using the significance range defined by the anchor metadata, and an anchor data element of saturation type may be used to indicate this.
[0026] Thus, in one example, when a floating-point to anchor data conversion operation is performed to convert a floating-point value to an anchor data element, the processing circuitry can set the type information of the anchor data element to indicate a saturated type if either the anchor data element represents a most significant element of an anchor data value that includes one or more anchor data values and representing the floating-point value as a two's complement number requires at least one bit of significance higher than a given range of significance representable using the anchor data element, or the anchor data element represents a least significant element of an anchor data value that includes one or more anchor data values and representing the floating-point value as a two's complement number requires at least one bit of significance lower than a given range of significance representable using the anchor data element.
[0027] Thus, if the floating-point value to be converted represents a special number, the anchor data value may be encoded as a special value representing either positive infinity, negative infinity or NaN, as described above, whereas if the fact that the floating-point value does not map to a two's complement number within the range representable using the anchor data element is due to an improper setting of the range definition information for that anchor data element, then the saturation type may be used instead. Distinguishing the saturation type from special values of other types may be used to enable software code to identify the cause of a failure of a sequence of operations involving the processing of the anchor data value.
[0028] The encoding of the type information may be indistinguishable for anchor data elements designated as saturating types, whether the anchor data element represents a positive or negative value. In contrast, for infinity, a different type encoding may be provided for positive infinity and negative infinity, respectively. This recognizes that if the anchor metadata defining the allowable range of anchor data values is set improperly, causing saturation, it is not important to know whether the value is positive or negative, because in these cases the code is likely to be re-executed at a later time using different metadata. Providing an encoding that is indistinguishable between positive and negative values marked as saturating types can save encoding space, allowing for more efficient encoding of anchor data elements, and allowing more bits to be retained to represent the two's complement bits represented.
[0029] The processing circuitry may have an adder circuit for performing an addition of two anchor data elements to generate a result anchor data element. As noted above, in some cases this may be implemented as a vector operation, such that a vector of first anchor data elements and a vector of second anchor data elements may be added, and multiple independent additions of elements in corresponding positions within each vector may be performed in response to the vector instruction to generate a result vector including multiple result anchor data elements. However, it is also possible to implement a scalar add instruction that performs a single addition of two anchor data elements to generate a result anchor data element.
[0030] When performing an addition of two such anchor data elements, an overflow may occur. For example, an overflow may occur in an addition that produces a result anchor data element representing a most significant element of an anchor data value if the sum of the two anchor data elements being added requires at least one bit that is more significant than the most significant bit representable by the anchor data value within a range of allowed significance defined by the anchor metadata. If an overflow occurs when producing a result anchor data element in an addition in which the result anchor data element is the most significant element of the anchor data value, the addition circuitry may produce a result anchor data element having type information specifying that the result anchor data element is of a saturating type.
[0031] The type information of the anchor data element can be encoded in a number of ways. However, in one example, the anchor data element may have an encoding such that if a predetermined bit of the anchor data element has a first value, the anchor data element represents a portion of a bit of a two's complement number, and if the predetermined bit of the anchor data element has a second value, the anchor bit element represents a special value. For example, the predetermined bit may be the most significant bit of the anchor data element. This may be efficient to decode, since the decoder can therefore check from a single bit whether it needs to examine further bits of the anchor data element to identify the particular form of the special value represented, or whether the element simply represents a portion of a two's complement number that is not a special value. For example, if the predetermined bit has a second value, then at least one further bit may represent a special value of the particular type represented. On the other hand, if the predetermined bit has a first value, then at least one further bit may be reused to represent a portion of a portion of the two's complement number itself, or at least one duplicate bit to accommodate a carry from a portion of the anchor data element that represents a portion of a two's complement number. In the more general case where the elements do not represent special values, this provides a particularly efficient encoding, since the bits used to encode special values of a particular type can be reused for other purposes.
[0032] In general, in a given anchor data processing operation, if an input anchor data element has a predetermined bit equal to a second value, the processing circuitry may generate a corresponding result anchor data element having the predetermined bit equal to the second value. Thus, once a given bit is set in a given sequence of processing operations, a corresponding anchor data element generated in a subsequent operation may be sticky in the sense that it continues to hold the predetermined bit equal to the second value to flag that somewhere in the sequence of operations a floating point value was encountered that was a special number, or that the result of the anchor data processing operation cannot be exactly represented within a given range of significance defined by the anchor metadata for the given anchor data element.
[0033] More generally, in a given anchor data processing operation where an input anchor data element is indicated by type information to be a special number, the corresponding result anchor data element may also be indicated with type information specifying that the result anchor data element represents a special value. Note that the particular form of the special value indicated for the result is not always the same as the form of the special value indicated for the input anchor data element. For example, in the addition of two anchor data elements, if the type information of the two anchor data elements indicates that one represents positive infinity and the other represents negative infinity, it may produce a result anchor data element having type information specifying that the result represents NaN.
[0034] In some examples, the anchor data element may be represented using a redundant representation in which some duplicate bits are allocated within the element to accommodate carries resulting from additions performed on less significant parts of the data element. This may reduce the chance of an overflow of the anchor data element due to a series of anchor data processing operations. The representation may be redundant in the sense that there may be many different patterns of bits in the anchor data value formed by multiple anchor data elements that are different combinations of duplicate and non-duplicate bits and all can represent the same numeric value in two's complement. More details are provided below.
[0035] Thus, in general, an anchor data element may include an N-bit value that includes V overlapping bits and W non-overlapping bits. The particular number of overlapping and non-overlapping bits may be fixed or may be variable, for example, as specified by information in the anchor metadata described above.
[0036] In a floating-point to anchor data conversion operation for converting a floating-point value to an anchor data element, if the floating-point value represents a number other than a special number and the number is within the permissible numerical range of the anchor data value of which the anchor data element is a part, the processing circuitry may set the W non-overlapping bits of the anchor data element to represent a portion of the bits of the two's complement number corresponding to the floating-point value. Meanwhile, the V duplicated bits of the anchor data element may be set to a sign extension of the W non-overlapping bits. Thus, initially, the duplicated bits may be set to a sign extension, e.g., all zeros or all ones. However, when the anchor data element produced by the floating-point to anchor data conversion operation is subjected to a series of addition operations, some carries may occur in the duplicated bits. In order to compute the two's complement number represented by the entire anchor data value in a non-redundant representation, a duplicate propagation operation may be performed in which the carry represented by the duplicated bits of one anchor data element is propagated to the non-duplicated bits of the anchor data element next higher in the anchor data value.
[0037] In some cases, the NVW may be greater than 0, i.e., both duplicate and non-duplicate bits do not occupy all of the N bits of the anchor data element, since at least one other bit may be used to represent type information indicating whether the element represents a special value.
[0038] As described above, overlap propagation operations may be periodically performed to propagate the carry represented by the overlap bit to the next most significant data element. An overlap propagation instruction may be provided to control the processing circuitry to perform the overlap propagation operation. In response to the overlap propagation instruction, the processing circuitry may align the V overlap bits of the first anchor data element with the W non-overlapping bits of the second anchor data element and add the aligned overlap and non-overlapping bits to generate an updated value of the second anchor data element. Again, this may be performed as a vector operation, with multiple lanes of overlap propagation being performed for each pair of first and second anchor data elements in response to a single instruction.
[0039] The overlap propagation operation may take into account type information specified in the first and second anchor data elements to determine how to generate an updated value for the second anchor data element. If one of the first anchor data element and the second anchor data element has type information specifying that it represents one of the types of special values described above, the processing circuitry may retain the previous value of the second anchor data element. For example, the update of the second anchor data element may be suppressed without adding the aligned overlap bit from the first anchor data element. This ensures that if a special value was generated by a previously performed sequence of anchor data processing operations, the execution of the overlap propagation operation does not overwrite that type information, and the fact that a special value was detected can be identified from the final result despite performing an overlap propagation operation. This simplifies the writing or compiling of code to perform the anchor data processing operations, as it means that there is no need to frequently check for special values. Alternatively, if the first anchor data element is a special value, the type information of the second anchor data element may be updated to match the type information of the first anchor data element. This allows type information to be propagated towards higher elements of the HPA value, and may simplify checking of type information after performing a series of anchor data processing operations.
[0040] On the other hand, if the addition of the aligned overlap and non-overlapping bits causes an overflow of the second anchor data element, the processing circuitry may set the type information of the second anchor data element to indicate a saturation type value. Here, an overflow is considered to occur if an overflow occurs from the most significant overlap bit, not if an overflow occurs from a non-overlapping bit into an overlap bit. If the addition of the overlap propagation operation causes an overflow from the most significant overlap bit, this means that the correct result can no longer be correctly represented in the second anchor data element, and therefore a saturation type may be specified to allow subsequent instructions to detect that something has gone wrong. For example, this may indicate a code that the software code needs to trigger the overlap propagation operation more frequently.
[0041] When used within program code, one example use of the duplicate propagation instruction may be to designate a pair of adjacent anchor data elements of the same anchor data value as a first and second anchor data element, respectively (the second anchor data element being an element that represents a higher portion of the anchor data value than the first anchor data element), where the instruction may be used to propagate a carry from a lower element to the next highest element of the same anchor data value.
[0042] However, in another use case, the first anchor data element may comprise the most significant anchor data element of a given anchor data value, and the second anchor data element may comprise an "empty" anchor data element that is not part of the same anchor data value as the first anchor data element. This may be useful to effectively extend the range of anchor data values to include additional elements to accommodate a carry bit from a most significant element of a previously represented anchor data element, which may be useful if an anchor data value that includes the first anchor data element is later added to another anchor data value that includes bits of greater significance than the bits of the first anchor data element.
[0043] It will be appreciated that these are just two examples of how the overlap propagation instructions can be used, and that a programmer or compiler may find other uses.
[0044] The processing circuitry may also be responsive to a clear duplicate instruction to clear the duplicate bit of the target anchor data element to zero. This instruction may be used to clear the duplicate bit after the duplicate propagate instruction has already added it to the non-duplicate bit of the next most significant anchor data element. Separating the duplicate propagate and clear operations into two separate instructions eliminates the need for one instruction to update two destination registers, providing the above advantages. Other alternative architectures may choose to combine these instructions into a single instruction to clear the duplicate bit of the first anchor data element in response to the duplicate propagate instruction itself. Such a combined duplicate propagate instruction that also clears the duplicate bit of the first anchor data element may also be considered an example of a clear duplicate instruction.
[0045] In response to a clear duplicates instruction, if the target anchor data element has type information specifying that it represents a special value, the processing circuitry may retain the previous value of the target anchor data element, i.e., the duplicate bit is not cleared, and this may allow the type information to be retained.
[0046] In some examples of the clear duplicates instruction, as well as the target anchor data element (which may be expected in the program to correspond to the least significant element of the pair of first and second elements acted upon by the duplicates propagation instruction), the clear duplicates instruction may also specify a second anchor data element (which is expected to correspond to the most significant element of the pair), and the processing circuitry may also retain the previous value of the target anchor data element if the type information of the second anchor data element indicates that it is a special value. Thus, even though the clearing of the duplicates bit itself does not depend on the second anchor data element, given the type information of the second anchor data element, the clear duplicates instruction may proceed in a manner similar to the propagate duplicates instruction, such that there is no change to a given pair of lower and upper anchor data elements of the same anchor data value if either of these elements specifies that the element represents a special value.
[0047] As noted above, a given anchor data element, if it does not represent a special value, represents a portion of the bits that correspond to a given significance range representable using the anchor data element, where the term significance refers to the particular power of 2 represented by 2 at a given bit position. For example, 2 4 The bits of the two's complement number representing 3 The most significant bit of a two's complement number is considered to have greater significance than the bits of a two's complement number representing 0. That is, the most significant bit of a two's complement number has the highest significance, and the least significant bit has the lowest significance.
[0048] A specific example will now be described with reference to the drawings.
[0049] The following describes the HPA (High Precision Anchor) format. Details regarding the HPA format can be found in U.S. Patent Application Nos. 62 / 074,149, 14 / 582,974, 14 / 582,875, 14 / 582,812, 14 / 582,836, 14 / 582,978, 14 / 606,510, and 14 / 582,968, the contents of which are incorporated herein by reference in their entirety.
[0050] Floating-point numbers Floating-point (FP) is a useful way to approximate real numbers using a small number of bits. The IEEE 754-2008 FP standard proposes several different formats for FP numbers, some of which are binary 64 (also called double precision (DP)), binary 32 (also called single precision (SP)), and binary 16 (also called half precision (HP)). The numbers 64, 32, and 16 refer to the number of bits required for each format.
[0051] expression FP numbers are very similar to the "exponential notation" we learned in science class. Instead of negative 2 million, we have -2.0 x 10 6 The parts that make up this number are the sign (negative in this case), the mantissa (2.0), the exponent base (10), and the exponent (6). All of these parts are similar to FP numbers, with the most important differences being that the components are stored in binary, and the exponent is always base 2.
[0052] More precisely, an FP number includes a sign bit, a number of biased exponent bits, and a number of fraction bits. Specifically, the DP, SP, and HP formats include the following bits:
[0053] [Table 2]
[0054] The sign is 1 for negative numbers and 0 for positive numbers. Every number has a sign, including zero.
[0055] Exponents are biased, that is, the true exponent is different from the one stored in the number. For example, biased SP exponents are 8 bits long and range from 0 to 255. Exponents 0 and 255 are special cases, but all other exponents have a bias of 127, meaning that the true exponent is 127 less than the biased exponent. The minimum biased exponent is 1, which corresponds to the true exponent -126. The maximum biased exponent is 254, which corresponds to the true exponent 127. HP and DP exponents behave in a similar way, and have the biases shown in the table above.
[0056] SP exponent 255 (or DP exponent 2047, HP exponent 31) is reserved for infinity and a special symbol called NaN (not a number). Infinity (which can be positive or negative) has a fraction of zero. Any number with exponent 255 that has a nonzero fraction is NaN. Infinity provides a saturation value, so it actually means something like "this calculation resulted in a number larger than can be represented in this format". NaN is returned for operations that are mathematically undefined on real numbers, such as division by zero or taking the square root of a negative number.
[0057] Exponent zero is reserved for subnormal numbers and zero in any format. Normal numbers represent the following values:
[0058] -1 符号 x1. Fraction x2 e where e is the true exponent calculated from the biased exponent. The word 1.fraction is called the mantissa, and the 1 is not stored as part of the FP number, but is instead inferred from the exponent. All exponents except zero and the maximum exponent indicate a mantissa of the form 1.fraction. Exponent zero indicates a mantissa of the form 0.fraction and a true exponent equal to 1 bias for the given format. Such numbers are called subnormal (historically such numbers were called denormal, but in modern times the term subnormal is preferred).
[0059] A number with both exponent and fraction equal to 0 is zero.
[0060] The following table is an example of a number in HP format. The entries are in binary, with "_" added for readability. Note that the deregular entry (fourth row of the table, with exponent 0) produces a different mantissa than the regular entry on the previous row.
[0061] [Table 3]
[0062] Most of the complexity in FP implementations comes from contra-normals, which are often handled in microcode or software. Some processors handle contra-normals in hardware, making these operations 10 to 100 times faster than software or microcode implementations.
[0063] Integer, fixed point, floating point FP's sign handling is called "sign-magnitude" and differs from the way integers are normally stored in computers (2's complement). In sign-magnitude representation, positive and negative versions of the same number differ only in their sign bit. A 4-bit sign-magnitude integer, containing a sign bit and three mantissa bits, represents plus one and minus one as follows: +1=0001 -1=1001
[0064] In two's complement representation, a (n+1)-bit binary integer is the number iS * 2 nwhere i is an n-bit integer, represented by the lowest n bits of an n+1-bit value, and S is the bit value (0 or 1) of the most significant bit of the (n+1)-bit value. Thus, unlike with signed magnitude numbers, where the sign bit modifies the sign of all other bits in the value, for two's complement values the most significant bit is weighted negatively and all other bits are weighted positively. Thus, a 4-bit two's complement integer represents plus 1 and minus 1 as follows: +1=0001 -1=1111
[0065] Two's complement format is the virtually universal format for signed integers because it simplifies computer arithmetic.
[0066] Fixed-point numbers, on the other hand, represent values that look the same as integers, but actually have a specific number of bits. Sensor data is often in fixed-point format, and there is a lot of fixed-point software written before FP was widespread. Fixed-point is very tedious to work with, because the programmer must always keep track of the "binary" system, i.e., where the integer and fractional parts of a number are separated, and they must constantly shift numbers to keep the bits in the correct place. FP numbers do not have these difficulties, so it is desirable to be able to convert between fixed-point and FP numbers. Being able to convert also means that you can continue to use fixed-point software and data, and you are not tied to fixed point when writing new software.
[0067] Rounding FP numbers The IEEE-754 standard requires that most FP operations are computed as if the operation were unrestricted in range and precision, and then rounded to fit into a FP number. If the result of a calculation is an exact FP number, that value is always returned, but usually the result will be between two consecutive floating-point numbers. Rounding is the process of choosing which of two consecutive numbers should be returned.
[0068] There are several ways to round, called rounding modes, of which there are six:
[0069] [Table 4]
[0070] This definition makes it unclear how the rounding actually occurs. One common implementation is to perform the operation, look at the truncated value (i.e., the value that fits into the FP format) as well as all the remaining bits, and adjust the truncated value if certain conditions hold. All of these calculations are based on the following: L - (minimum) the least significant bit of the truncated value G - (Guard) The next most significant bit (i.e., the first bit not included in the truncation) S - (Sticky) The logical OR of all remaining bits that were not part of the truncation
[0071] Given these three values and the truncated value, we can always calculate the correctly rounded value, as shown in the following table.
[0072] [Table 5]
[0073] For example, consider multiplying two 4-bit mantissas and rounding to a 4-bit mantissa. sig1=1011 (decimal 11) sig2=0111 (decimal 7) Multiplying gives us sig1 × sig2 = 1001_101 (decimal 77) L Gss It becomes.
[0074] The least significant bit of the truncated 4-bit result is labeled L, the next bit is labeled G, and S is the logical OR of the remaining bits labeled s (i.e., S=0|1=1). To round, the 4-bit result (1001) is adjusted according to the rounding mode and the calculations in the table above. For example, with RNA rounding, since G is set, it would return 1001+1=1010. With RX rounding, since G|S is true, it sets L to 1 (no change in this case since it was already 1) and returns 1001.
[0075] Rounding of integers and fixed-point numbers Rounding is also used when converting FP numbers to integers or fixed-point numbers. The idea is basically the same as FP rounding. If the FP number happens to be an integer, it will always be rounded to that integer. Any other FP number lies between two consecutive integers, and rounding will determine which integer is returned. Unfortunately, the logic for rounding integers is made a bit trickier by the differences between two's complement and sign-magnitude formats. When a sign-magnitude number is incremented, it always gets larger in magnitude, so the incremented number gets further away from zero. The same is true for positive two's complement numbers, but negative two's complement numbers get closer to zero when incremented. This means that the logic for rounding must be different depending on whether the integer is positive or negative. It also means that care must be taken with the choice of base value (the value to increment or not). For positive integers, the value is the FP mantissa truncated, so 1.37 has a base value of 1 and the result is either 1 or 2. For negative integers, we again truncate the mantissa and take the one's complement of that result (the one's complement is the original number with all the bits flipped). -1.37 gets truncated to 1 and then inverted, giving us the base value -2. All is well since we want the result to be either -2 or (when incremented) -1.
[0076] To further complicate things, this conversion method requires several calculations to determine L, G, and S for negative integers. Correct rounding requires completing two's complement processing (inverting and adding 1) before calculating L, G, and S, which is slower than just inverting. Ideally, we would like to calculate the actual L, G, and S from the shifted original input (i.e., the input before any sign manipulation) (the floating-point numbers 1.37 or -1.37 are both right-shifted to the integer 1).
[0077] Let L0, G0 and S0 be the least significant bit (lsb), guard and sticky before inversion, Li, Gi and Si be the lsb, guard and sticky after inversion, and finally L, G and S be the lsb, guard and sticky after inversion and adding 1.
[0078] If S0 is zero, then all the bits contributing to Si are 1, and therefore S (obtained by adding 1 to those Si bits) is also zero. If S0 is not 0, then Si is not all 1, and therefore S is not 0. Thus, in all cases, S0=S.
[0079] If G0 is zero, then Gi is 1 and G is 1, except if there is a carry-in from the S bit, which can only occur if S0 is zero. If G0 is 1, then Gi is zero and G is 1, except if there is a carry-in from the S bit, which can only occur if S0 is zero. That is, G=G0^S0.
[0080] By similar logic, L = L0^(G0|S0).
[0081] Now that we know L, G, and S for negative and positive integers, we can consider the rounding rules.
[0082] [Table 6]
[0083] Fixed-point numbers are rounded in exactly the same way as integers. The rules for unsigned conversion (to integer or fixed-point) are the same as the rules for positive conversion.
[0084] Injection rounding A way to make rounding faster is to inject a rounding constant into the mantissa addition that is part of almost every FP operation. To see how this works, consider adding numbers in dollars and cents and rounding to dollars. For example, add: $1.27 +$2.35 $3.62
[0085] The sum, $3.62, is closer to $4 than to $3, so we know that any of the round-to-nearest modes will return $4. If we express the numbers in binary, the L, G, and S rounding methods from the previous section would give us the same result. But what if we added 50 cents and then rounded the result down? 1.27 +2.35 +0.50 (injection rounding) 4.12
[0086] If we are just returning the dollar amount ($4) from the sum ($4.12), we would round correctly using RNA rounding mode. If we are adding $0.99 instead of $0.50, we would round correctly using RP rounding. RNE is a bit more complicated. We add $0.50, truncate, and look at the cents remaining. If the cents remaining are not 0, then the truncated result is correct. If the cents remaining are 0, then we were exactly halfway between two dollars before the injection, so we choose the even dollar amount. In binary FP, we would zero out the least significant bit of the dollar amount.
[0087] Adding three numbers is only slightly slower than adding two numbers, so injection rounding allows us to get a rounded result much faster than adding the two mantissas, checking L, G, and S, and incrementing the result depending on the rounding mode.
[0088] Implementing Injection Rounding In FP, injection rounding can be one of three different values, depending on the rounding mode and (sometimes) the sign of the result.
[0089] In both RNA and RNE, you need to inject a 1 into the G position (like adding $0.50 in the dollars and cents example).
[0090] RP and RM rounding depends on the sign as well as the mode. RP rounds up positive results (increasing the mantissa size towards positive infinity) but truncate negative results (selecting the mantissa closer to positive infinity). Similarly, RM rounds up negative results (increasing the mantissa size towards negative infinity) but truncate positive results (selecting the mantissa closer to negative infinity). We therefore separate RM and RP into two cases: round when the sign matches the round direction (RU) and truncate when the sign differs from the injection round (RZ). In the RU case, we inject 1s into the G bit position and all positions that logically contribute to S (like adding $0.99 in our dollars and cents example).
[0091] 0 is injected into RZ mode and RX mode, and into RP mode and RM mode which are reduced to RZ mode.
[0092] For most rounding modes, adding injection rounding and then truncating will give the correct rounded result. The two exceptions are RNE and RX, which require checking G and S after the addition. For RNE, if G and S are both zero, set L to 0. For RX, if G or S is not zero, set L to 1.
[0093] FP numbers are not real numbers Although FP numbers are often thought of as being similar to real numbers, even their most basic properties are fundamentally different.
[0094] The two are not related. For example, in SP you can add three numbers and get back either 1 million or 0, but this is probably not what you would typically think of as a rounding error. (245 + -2 45 )+2 20 =2 20 2 45 +(-2 45 +2 20 )=0
[0095] Neither of these obeys the distributive law. Again in SP: 3,000,001 * (4.00001+5.00001)=0x4bcdfe83 (3,000,001 * 4.00001)+(3,000,001 * 5.00001)=0x4bcdfe82 If an overflow occurs, the situation becomes even worse. 2 50* (2 78 -2 77 )=2 127 (2 50* 2 78 )-(2 50* 2 77 ) = infinity
[0096] In some implementations, they are not even commutative, unless in the default NaN mode (which converts all NaNs to a single NaN), since in general nanA+nanB != nanB+nanA. Numeric addition and numeric multiplication are commutative.
[0097] Due to the IEEE NaN rule, there are no multiplication or addition identities: 1 and 0 serve as numeric identities.
[0098] One useful way to think of FP numbers is as very long fixed-point numbers with at most a few consecutive bits (53 bits for DP) that are nonzero. For example, a non-infinite DP number has the first bit of the mantissa in one of 2046 locations, followed by 52 other mantissa bits, plus a sign bit, so any finite DP number can be represented as a 2046+52+1=2099-bit fixed-point number. Thinking about it this way makes it clear that adding two FP numbers does not, in general, result in a different FP number, and the result of the addition must be rounded to be a FP number.
[0099] A known problem with floating-point (FP) arithmetic is that it is non-associative, which means that sums are a problem. Programmers need to be aware that even when adding three numbers, the results can be very different. · Programmers use formats that are wider than necessary to avoid wildly different results. · The programmer cannot easily parallelize the code because the sum can only be reproduced in the exact same order.
[0100] For example, in single precision: 2 20 +(-2 44 +2 44 )=2 20 However, (2 20 +-2 44 )+2 44 =0
[0101] Depending on the order in which the operations are performed, you will either get a result of 1 million or 0. This is an extreme example where the exponents differ by 24, but you can get different answers if the exponents differ by 1, or even if you are adding more than three with all the exponents the same. The C programming language deals with the reproducibility problem by evaluating the sums in order from left to right, but this does nothing to improve correctness and cannot be parallelized.
[0102] This problem is especially prevalent in high performance computing (HPC), where millions of operations are executed. Programmers want to parallelize these problems, but they are harder to debug than usual because they are not reproducible. Also, different machine configurations will produce different answers, even if the machine is perfectly reprogrammed.
[0103] HPA Representation (Anchor Data Value) A new data type has been proposed that allows fast and accurate accumulation of floating-point (FP) numbers in a programmer-selectable range. In a reasonable range that covers most problems, the accumulation is faster than FP addition and is associative. Associative addition allows problems to be parallelized with reproducible and correct results, resulting in speedups of, for example, 100x or more compared to existing hardware. These advantages make it attractive for many applications outside of high performance computing (HPC) as well as in the field of high performance computing (HPC).
[0104] FIG. 1 illustrates diagrammatically a data processing apparatus 2 for performing data processing operations under the control of program instructions. The data processing apparatus 2 includes a memory 4 for storing program instructions 6 and data 8 to be processed. A processing core 10 is coupled to the memory 4 and includes a register bank 12, processing circuitry 14, an instruction fetch unit 16, an instruction pipeline unit 18, and an instruction decoder 20. It will be appreciated that in practice the data processing system 2 may include many additional elements and the representation of FIG. 1 has been simplified to aid understanding. In operation, program instructions 6 are fetched from the memory 4 by the instruction fetch unit 16 and fed to the instruction pipeline 18. Once the program instructions reach the appropriate stage in the instruction pipeline 18, they are decoded by the instruction decoder 20 which generates control signals useful for controlling the operation of the register bank 12 and the processing circuitry 14 to perform the processing operation(s) specified by the decoded program instruction. A number of input operands may be read from the register bank 12 and fed to the processing circuitry 14 where they are operated upon before a result value is written back to the register bank 12.
[0105] Register bank 12 can have a variety of different forms. The operands operated on may include, for example, floating point operands, fixed point operands, integer operands, and HPA or RHPA number operands (described below). Register bank 12 may be responsible for storing a mixture of these types of operands, depending on the configuration of register bank 12. The operands can have different levels of precision, either predefined by their format or programmably specified using metadata associated with the registers, as described below in connection with HPA number operands.
[0106] 1, register bank 12 may include metadata registers 22 for specifying metadata associated with HPA or RHPA values stored in corresponding data registers of register bank 12 (examples of metadata content are provided below). In some cases, each data register may have a corresponding metadata register 22, and in other cases, two or more data registers may share metadata specified by a single metadata register 22.
[0107] Figure 2 shows a schematic of a floating-point operand. A floating-point operand is formed by a sign, an exponent, and a mantissa. Floating-point operands can represent values of various magnitudes, indicated by the exponent value. The precision with which numbers can be represented is limited by the size of the mantissa. Floating-point operations are generally more complex and slower than integer arithmetic.
[0108] Figure 2 also shows 64-bit integer operands. Such integer operands range from 0 to (2 64 -1), -2 for signed integers 63 ~2 63 It can represent numbers in the range of -1. Integer arithmetic is characterized by its fast processing speed and relatively low energy consumption for execution (compared to floating-point arithmetic), but it has the disadvantage that it specifies numbers in a relatively limited range compared to the range of numbers that can be expressed by floating-point values.
[0109] FIG. 2 also shows an HPA (High Precision Anchor) number consisting of a vector of components (three in this example) each containing a 64-bit integer. The HPA number has associated metadata. The metadata includes an anchor value indicating the bit significance of each component that is part of the HPA number. The anchor value(s) directly or indirectly specify a lower bit significance limit and an upper bit significance limit. Hereinafter, the term metadata can be considered to correspond to data including anchor value(s) that specify the bit significance of the HPA number. By combining different components, bit values that successively cover a range of bit significance are specified. Depending on the location of the lower bit significance limit and the upper bit significance limit, the range of bit significance can include the location of the binary point. It is also possible that the location of the binary point is outside the range of bit significance specified for a particular HPA value.
[0110] An anchor value or values may be provided that can represent a range of bit significance from the minimum significance representable in a floating-point value (e.g., a double-precision FP value) to the maximum bit significance representable in that floating-point value.
[0111] The number of components that form the HPA number may vary between different implementations. The size of the components is fixed in some implementations, but may vary in others. In some embodiments, the overall width of the bit significance of the range may be constrained to vary in units of a fixed component size (e.g., for a 64-bit component, the bit significance range may have widths of, for example, 64, 128, 192, 256, ...). It is also possible for the width of the bit significance range to vary continuously in 1-bit-wide steps.
[0112] The anchor value(s) (in the metadata) may be programmable to allow the programmer to set the significance of the corresponding HPA value. The anchor value may specify the bit significance in a variety of different ways. One example is to specify the lower bound bit significance of each vector component. Thus, each vector component may contain an integer value representing the portion of the value's significant bits within the overall range of bit significance, and metadata representing (anchoring) the least significant bit significance within that component. Alternatively, the anchor value(s) may specify the lower bound of the bit significance of the entire HPA number, along with the overall width of the bit significance range. Additionally, the anchor value(s) may contain data specifying the lower and upper bounds of the range representing the bit significance. Additionally, if the components are known to be of fixed width, the anchor value(s) may include variations such as the lower bound of the bit significance range and the number of components.
[0113] Figure 3 shows the relationship between the range of values that can be expressed in double-precision floating-point and the range of significance of HPA numbers. In the case of double-precision floating-point numbers, the range of specifiable bit values is approximately 2 -1074 ~2 +1023 (Non-regular employees are not counted.)
[0114] As shown, the HPA number has a programmable bit significance range that can be thought of as a window of bit significance within the range of bit significance representable using floating-point values. This programmable bit significance is specified by lower and upper boundaries and can be thought of as sliding along the range of bit significance provided by the floating-point value depending on the values of the lower and upper bounds. The width of the window, as well as the start and end points, can be specified by appropriate values of programmable metadata (including anchor values) that specify the bit significance. Thus, the HPA number has a format that can be selected by the programmer to suit the computation being performed.
[0115] The HPA format allows the addition of two or more values to be performed quickly, accurately, and associatively, while still allowing values with a wide range of significance to be represented. Also, because HPA values are simply two's complement numbers, they can be added using integer adders, without the need for rounding or normalization as in floating-point arithmetic, which means that the result is the same regardless of the order in which the values are added, allowing a series of additions to be parallelized. However, by defining metadata that specifies the programmable significance of HPA values, the full range of significance of equivalent floating-point values can be represented, but without the need to have a very wide adder (e.g., adding two two's complement numbers across the full range representable in double-precision floating-point values would require a 2098-bit adder), and instead the programmable significance allows a smaller adder to be focused on a specific window of programmable bit significance within the wide range. In practice, most calculations do not require the full range of significance available in double-precision floating-point. For example, very small values can add up in atomic problems, and very large values in astronomical problems, but adding up the widths of protons to get the distance between galaxies is not typically useful. Even in high-performance computing, most accumulations happen over a limited range.
[0116] Usually, the programmer writing the program knows the range of values (depending on the application) over which useful results are expected to fall. The programmer knows that all the data for a particular sum is 2 60 has a size less than 2 -50 It may be determined that values with a magnitude less than do not significantly affect the sum, in which case the application can add numbers associatively in any order by adding the data using the HPA format with a data width of 128 bits and an anchor value of -50 which specifies the significance of the least significant bit.
[0117] Thus, by using the anchor values to restrict the valid range over which the result is calculated, a relatively small amount of hardware can be used to calculate the result within a programmably defined window. If the addition results in an overflow beyond the upper significance limit of the defined range, or an underflow below the lower significance limit, an exception may be raised, indicating that the programmer has defined the significance bounds incorrectly, and that the process should be repeated using different metadata (e.g., a different anchor value or the overall size of the HPA value) to define a different window of significance for the result.
[0118] When adding or subtracting two HPA values, the anchor value is the same for both HPA values, and the result will have the same anchor value. This differs from floating-point operations where adding or subtracting two values results in a result with a different exponent than either input due to the result being normalized. If inputs are provided with different anchor metadata, they are shifted to match the target significance range required for the result. If the inputs are provided in representations other than HPA (e.g., integer or floating point), they are converted to HPA values with the same anchor value and added to produce a result with the same anchor value. Thus, the metadata for an HPA register can be thought of as defining a target range of significance for result values produced in that register, and bits outside the significance target range are not calculated by the hardware, regardless of the actual significance of the input values.
[0119] RHPA expression Although the HPA format allows for much faster additions than floating-point, adding two HPA values using integer arithmetic can be relatively slow when the size of the HPA values becomes relatively large. For example, the HPA format can require the addition of operands across multiple lanes, which is undesirable for large vector implementations. For example, adding two 256-bit or 512-bit values can be slow because each lane of 64 bits must be added sequentially to accommodate carries coming in from one lane to the next.
[0120] Therefore, by using the redundant high-precision anchor (RHPA) format shown in FIG. 4, addition can be performed more quickly. Similar to the HPA format, the RHPA number includes variable components having metadata that defines an anchor value that enables the processing circuit 14 to identify the significance of the bits of each component. Here too, the anchor value may be programmable. In the case of RHPA, the metadata may identify the significance of each component in any of the ways described above for HPA. However, in the RHPA format, since the numerical value is represented using a redundant representation in which adjacent lanes of the vector contain bits having overlapping significance, addition for a fixed time is possible regardless of the number of lanes being calculated. Due to this redundancy, it is possible to shorten the length of the adder and perform operations such as addition, accumulation, and multiplication without propagating carry information between adders. As a result, the processing of data values is significantly accelerated.
[0121] As shown in (1) of FIG. 4, an M-bit data value using the RHPA representation is divided into respective vector lanes (also referred to as components, elements, or parts) each consisting of N bits where N < M. In this example, N is 64 bits, but this is just an example and other lane sizes (such as 32 bits or 128 bits) are also possible. Each N-bit portion is divided into a specific number V of overlapping bits and N - V non-overlapping bits. In this example, the number V of overlapping bits is the same for each N-bit portion, but it is also possible to have N-bit portions with different numbers of overlapping bits.
[0122] When an integer or floating-point number is converted to the RHPA format, some of the non-overlapping bits are filled with unsigned information mapped from the original integer or floating-point number, and the overlapping bits are populated with the sign bit. For lane-based addition and subtraction, each lane behaves like an N-bit signed two's complement number (with carries propagating from the non-overlapping portion to the overlapping portion as necessary), but from a multi-lane perspective, the lanes form a redundant mixed-signed representation of the larger P-bit number. In the example of Figure 4, there are four lanes, so M=256, but the number of lanes can vary depending on the hardware implementation and / or metadata defined for a given RHPA number.
[0123] Part (2) of Figure 4 shows the relative significance of each bit of the RHPA number shown in part (1). The overlapped bit V[0] in the lowest lane has the same significance as the V least significant bits of the non-overlapping bit NV[1] in the next lane. Similarly, overlapped bits V[1] and V[2] have the same significance as the V least significant bits of non-overlapping bits NV[2] and NV[3]. The overlap in significance between lanes means that the entire RHPA number represents a P-bit value that is smaller than the total number of bits stored, M. If V is the same for each N-bit portion (excluding the tip portion), then
[0124]
number
[0125] For each overlapped portion of a P-bit value, the actual bit value of that P-bit value is the sum of the overlapped bits V in the lower lane and the non-overlapping bits NV in the upper lane (taking into account any carries that may occur when adding the non-overlapping bits NV and the overlapped bits in the lower lane). Therefore, one way to convert an RHPA value to an equivalent integer value is to sign-extend the overlapped bits in each lane and add them to the non-overlapping bits in the upper lane (from lower to higher, adjusting the overlapped bits after each lane addition), as shown in part (3) of Figure 4.
[0126] RHPA numbers are redundant in the sense that there is more than one way to represent a given P-bit number using the M-bit RHPA value. For example, considering overlap of the lowest two lanes, in the example of overlap bit number V=4, if the corresponding bits of the P-bit value are 1111, one way of representing it would be to place the overlap bit V[0]=0b0000 in the lower lane and the non-overlapping bit NV[1]=0b1111 in the next higher lane. However, other ways of representing the same value would be V[0]=0b0101 and NV[1]=0b1010, or V[0]=0b1111, NV[1]=0b0000, etc.
[0127] Note that the duplicate bit V[3] in the top lane is not actually a duplicate bit because there are no duplicate upper lanes. Therefore, it may be useful to think of the upper lanes as having all non-overlapping bits. Thus, in some cases, the top lane can be thought of as being made up of all non-overlapping bits (such that the most significant bit of the P-bit value as a whole corresponds to the most significant bit of the top lane's M-bit value).
[0128] However, in other embodiments, it may be preferable to treat the top lane as having overlapping bits as well, with the most significant bit of the P-bit number represented by the RHPA corresponding to the most significant bit of the non-overlapping portion of the top lane (excluding the overlapping portion). This may facilitate easier circuit implementation if it allows the lanes to be treated more symmetrically (requiring fewer changes in how the top lane is treated compared to the other lanes).
[0129] By representing P-bit numbers redundantly, as in Figure 4, multiple RHPA numbers can be added without carries between lanes because the carry from an addition of the non-overlapping parts in a given lane can be stored in the overlapping parts of the same lane without the need to propagate the carry to the next lane. The additions performed in each lane are added by simply looking at two or more N-bit signed integers and performing a traditional N-bit two's complement addition, and are completely independent of the corresponding N-bit additions in the other lanes. This means that an entire M-bit value can be added in the time it takes to perform an N-bit addition, regardless of the number of lanes, because each N-bit addition can be performed in parallel.
[0130] In reality, at least (2 V-1 −1) such RHPA numbers can be added without carries between lanes, and the carries from adding the non-overlapping parts are collected into the overlapping parts. (If there are lanes with different numbers of overlapping bits, then V in this representation is the minimum number of overlapping bits in any lane that has overlapping bits.) V-1 ) addition is the first one that can potentially generate a carry between lanes. (Because the top duplicate bit is the sign bit, a lane overflow occurs when there is a positive or negative overflow from the second most significant duplicate bit, which can happen at least twice as fast if you start with an RHPA number with all bits 0.) V-1(This can occur after 8 further additions have been performed). For example, for V=14, at least 8191 RHPA numbers can be added to the accumulator (i.e., 8192 values can be added in total) before there is a risk of overflow from a single lane. This is particularly useful in the field of high performance computing, where adding a large number of input values is common. In practice, not all additions result in a carry into the overflow portion, so that 2 additions can be performed without overflowing the top bit of the N-bit portion. V-1 In some cases, super-accumulation is possible.
[0131] Sometimes, if enough additions are performed from the top bits of an N-bit lane to cause a risk of overflow (or actual overflow), a duplicate reduction operation can be performed to convert the given RHPA value to a second RHPA value whose duplicate bits represent a smaller magnitude than the duplicate bits of the given RHPA value, effectively freeing up the bit space in the duplicated portion to accommodate more carries. Such duplicate reduction may also be performed when converting the RHPA number back to other formats such as integer or floating point. However, in practice, such duplicate reduction operations are rarely necessary, and RHPA can significantly reduce processing time because multiple input M-bit additions can be performed in the time of an N-bit addition. Note that "duplicate reduction" does not necessarily mean that duplicate bits in all lanes must be reduced. It is sufficient to reduce the duplicate bits in at least one lane, and depending on the form of duplicate reduction, the duplicate bits in a given lane may be large.
[0132] Efficient storage and operation of HPA numbers In the following description, it is assumed that the HPA format used is the RHPA format described above in which each portion contains a number of overlapping bits, although the techniques described herein are equally applicable to other HPA formats, e.g., HPA formats in which different portions do not contain overlapping bits. Hereinafter, the term HPA is used to refer to the HPA value being manipulated, regardless of whether the HPA value being manipulated is in redundant form or not.
[0133] As is evident from FIG. 4 above, different HPA parts (anchor data elements) of an HPA number (anchor data value) may be placed in different lanes of a single vector register. However, this has some problems. For example, when creating an HPA format from a floating-point operand, the fraction of the floating-point operand along with the desired anchor value must be propagated to all lanes in the associated vector register. Each lane has a different lane anchor based on the anchor value. Furthermore, if the vector register is significantly larger than the long integer value of the HPA number, e.g., a 1024-bit register holds a 200-bit long integer for the HPA number, this may result in a waste of vector register resources. Also, if the number of bits in the vector register is insufficient to represent all parts of the long integer for the HPA number, e.g., if the width of the vector register is 128 bits and it needs to represent a 200-bit long integer for the HPA number, problems may occur.
[0134] In the example to be described, a different storage arrangement is provided for the various parts of the HPA number. In particular, as shown diagrammatically in FIG. 5, the long integers of the HPA number are arranged to be stored in a common lane across multiple vector registers. In particular, a set of vector registers 100 are arranged, where each vector register may be considered to include multiple sections for storing data values. Further, multiple lanes may be considered to extend (vertically in the orientation shown in FIG. 5) through the vector registers, the first four lanes being indicated in FIG. 5 by reference numerals 102, 104, 106, 108. The long integers of the HPA number may then be stored in a common lane by storing different parts of the HPA integer value in different vector registers. This is shown diagrammatically for an example HPA integer 110, which may be considered to include four parts, one part stored in each of the vector registers Z0, Z1, Z2 and Z3. Furthermore, all parts are stored in the common lane 102. By storing the integers of the HPA number in this manner, this gives rise to a number of important advantages. For example, the size of the integers is not constrained by the width of the individual vector registers. Furthermore, multiple HPA integers can be stored in different lanes of various vector registers, and the integer values can be processed in parallel in a SIMD manner, thus avoiding inefficient use of vector registers. For example, referring to FIG. 5, if each vector register shown in FIG. 5 provides 16 lanes, 16 HPA numbers are stored in four vector registers Z0 to Z3, with each HPA number occupying a different lane. Thus, it can be seen that this technique provides a technique that significantly improves scalability and is independent of the length of the vector. This allows this technique to be adopted in various systems that use vector registers of different sizes. There are many applications that can gain significant performance benefits from adopting such a method of storing HPA values, and one example is a system that adopts the Scalable Vector Extension (SVE) proposed by ARM.
[0135] ARM has announced the Scalable Vector Extension (SVE) of its 64-bit ISA targeted at scientific HPC applications. Currently, SVE does not include HPA support, but SVE continues to evolve and can achieve very high HPA performance with a few modest additions to its instruction set. SVE's "scalable" nature means that it does not require the same vector length on all implementations. SVE vectors can be implemented in hardware with pairs of 64-bit lanes in any multiple between 128 and 2048 bits. A small chip might only be able to implement 128-bit vectors, while a supercomputer might implement 1024- or 2048-bit vectors. While keeping a 200-bit integer in a single SVE register would be impossible in a 128-bit implementation and wasteful in a 2048-bit implementation, keeping a 200-bit integer spread across four registers takes full advantage of SVE's scalability and works well on all hardware implementations, from small to large. Also, programmers can use short or long integers as needed: a 100-bit integer fits into two vector register lanes, a 500-bit integer fits into ten vector register lanes.
[0136] From a performance and area perspective, SVE performs operations in 64-bit lanes. We propose to perform HPA addition by splitting a large HPA number, i, into smaller redundant parts. Each 64-bit lane stores a specified part of i (e.g., p=50 bits, which is programmable), and the remaining 64-p bits are used to hold the carry within the lane. These remaining bits are called "redundant" bits because they have the same numerical weight as the lsb of the next most significant lane. The addition within a lane is a normal 64-bit integer addition. 2 64-p Every cycle (i.e., about every 16,000 cycles for p=50), a redundancy elimination step may be required to prevent lane overflow, and at the end of every computation, lane-by-lane processing is required to obtain a redundancy-free answer.
[0137] To convert the FP input f to the HPA number format (i,a), each 64-bit lane examines the exponent of f, compares it with the anchor <a, and determines whether to add a portion of the significand of f to the portion of i under consideration. This comparison can be done in parallel across all relevant lanes. The significand of f may span two parts (or three parts depending on the value of p in the case of FP64 products), but each part can be created and operate independently.
[0138] An example of converting an FP32 number to a two-part HPA by selecting a = 0 and p = 50 is shown below. In this example, the FP32 number is assumed to occupy the least significant 32 bits on the "right side" of the vector register lane, and the HPA number is assumed to occupy a 64-bit register lane (including a 50-bit value and 14 duplicate bits). For the case of an FP number, f = +1.0110 1011 1010 0010 1111 011×2 60 FP32 significand, f[23:0] = 1 0110 1011 1010 0010 1111 011
[0139] The first part of the HPA number has an adjustment part anchor = 50 and is calculated as follows. i[1] = f[23:0] shifted left by (exponent - 23) - part anchor = 37 - 50 = -13 bits (-ve left shift is +ve right shift -> i[1] = {{14 0’s},{39 0’s},f [23:13] = 1 0110 1011 10}) (The adjustment of the exponent by 23 takes into account the fact that the exponent of the floating-point value represents the significance of the implicit decimal point to the left of the most significant bit of the 23-bit fraction, while the anchor represents the significance of the least significant bit of the fraction.)
[0140] The second part of the HPA number is adjusted to part anchor = 0 and is calculated as follows. i[0] = f[23:0] shifted left by (exponent - 23) - partial anchor = 37 - 0 = 37th place. ->i[1]={{14 0's},f[12:0]=10 0010 1111 011,{37 0's}}
[0141] This results in the HPA form looking like this:
[0142] [Table 7]
[0143] In general, correctly rounding the HPA results into a single FP result requires propagating carry and rounding information from lane to lane, which requires sequential processing. This takes a few cycles, but only needs to be done once per accumulation. Alternatively, if p≦53, we can convert non-redundant HPA numbers occupying multiple 64-bit lanes into a vector of FP64 numbers in parallel. The resulting vector is then "renormalized" so that the most significant element represents a complete HPA number to 0.5 ulp accuracy.
[0144] Having described the basics of HPA processing at high orders, we next provide a more detailed explanation of how to implement an HPA accumulator in SVE.
[0145] SVE supports vector register lengths of k × 128 bits (i.e., 1≦k≦16) up to a current maximum of 2048 bits, and is based on "vector-length-independent" (VLA) processing, which allows different CPUs with different SVE vector register lengths to all execute the same SVE program. SVE programs read the available vector lengths from system registers and "self-adjust" to make use of the available vector register lengths. As a result, SVE programs, along with CPU processing, execute in 128-bit granules as many parallel granules as the available vector hardware length can support.
[0146] As previously discussed with reference to Figure 5, to achieve vector length independence, the HPA number may be distributed across multiple SVE registers, each of which may hold bits of the same significance for a different HPA number, i.e. each register is associated with a significance that gives the value of the anchor of the number adjusted for the position of each part in the HPA number.
[0147] Returning to our 200-bit HPA number example, if each part holds p=50 bits, then if the HPA number's anchor is -80, then the significance information for the four parts will be (+70, +20, -30, -80) with 14 overlapping bits per 64-bit part. Note that the individual parts of the HPA number do not need to be stored in consecutive registers as in the example in Figure 5.
[0148] The primary benefit of arranging the HPA numbers in this way is that the HPA numbers (or long integers) can be processed in a SIMD fashion even if they span SIMD implementations that are shorter than the long HPA numbers (such as 128-bit vectors). A secondary benefit is that longer SIMD implementations (such as 1024-bit vectors) are not wasted by storing much shorter HPA numbers within each vector. With a sufficient number of integers or HPA numbers, the vectors are fully utilized regardless of the length of the SVE implementation.
[0149] Placing the HPA numbers in multiple registers also allows a vector of FP numbers to be added to each 64-bit lane, making the HPA operation highly parallel. Furthermore, loading large numbers of FP numbers from memory results in a simple and efficient contiguous vector load. Furthermore, this arrangement of HPA numbers allows multiple HPA integers to be processed all in parallel, from low to high bits, so existing SVE instructions can be used to perform important HPA calculations (such as removing redundancies or adding HPA numbers). This scheme also speeds up the conversion or renormalization of HPA numbers to FP, since multiple HPA numbers can be processed all at the same time, from high to low lanes, or from low to high lanes.
[0150] Figure 6 shows how HPA numbers arranged in the manner described in Figure 5 can be processed in a SIMD manner. In this example, it is assumed that a series of floating point numbers have been loaded into a source vector register 165. In this example, it is assumed that each floating point number is a double precision floating point number, and therefore each floating point number occupies a 64-bit section within the source register 165.
[0151] A number of 64-bit lanes 152, 154, 156 may be considered to extend through the set of vector registers, with a separate conversion and processing circuit 170, 172, 174 associated with each lane. The circuits 170, 172, 174 are arranged to operate on a single portion of the HPA number at a time to generate a corresponding result portion to be stored in a destination register 180. It will be appreciated from the above discussion of Figure 5 that each result portion of the HPA result number occupies a different destination register and accordingly, as the circuit processes different portions of the HPA number, corresponding result portions are written to different destination registers.
[0152] As will be described in more detail below, metadata is provided for reference by the conversion and processing circuits 170, 172, 174 as they perform their conversion and processing steps. In particular, in this example, metadata is stored in further source registers 160 for each lane. Within the lane metadata, a metadata portion is provided for each portion of the HPA number processed in that lane. The metadata identifies the significance (adjusted anchor) associated with the corresponding portion and may identify other information such as the number of overlapping bits. When the circuits 170, 172, 174 are processing a particular portion of the HPA number, they retrieve the relevant metadata portion from the lane metadata held in source registers 160.
[0153] In the example shown in Figure 6, each conversion processing circuit receives an input floating-point operand and an associated metadata portion for a portion of the HPA number to be processed, and then generates the associated HPA portion from the input floating-point operand, e.g., using the techniques described above with reference to the example shown in Table 7. The generated HPA portion may then be stored directly in result register 180, or may undergo some processing function to generate the associated result portion. For example, in one embodiment, an accumulation operation may be performed in which a current HPA result portion is obtained from a destination register and then accumulated with the HPA portion generated from the input floating-point operand to generate an updated result portion that is written back to the associated section of destination register 180.
[0154] It can be seen that such an approach allows multiple accumulation operations to be performed in parallel within each lane to generate result portions that represent accumulated results over the execution of multiple iterations, and this process can be repeated for each portion of the HPA number to generate a series of result portions within each lane, which collectively represent a result HPA value.
[0155] In one exemplary configuration, HPA processing requires information ("metadata") about a wide range of anchors, lane overlaps, and lane types or upper, lower, or middle positions. Because the width of HPA numbers is typically 200 bits or less and the range of anchors is similar to IEEE FP32, it is expected that HPA accumulators will typically consist of four or fewer parts. Thus, the HPA metadata for a 200-bit accumulator across four 64-bit parts can be organized as four 16-bit fields, as shown in FIG. 7.
[0156] In particular, a source register 160 may be specified in which, within each lane (e.g., 64 bits), four metadata portions are provided, as indicated by reference numerals 162, 164, 166, 168. Each metadata portion may provide metadata for an associated portion of the accumulator result. As shown in the expanded view of FIG. 7, significance (adjusted anchor) information may be included in a first subpart 192, for example, using 9 bits, while overlap information may be captured in a second subpart 194, including, for example, 5 bits. Optionally, lane type information may also be captured in a third subpart 196 to identify whether the associated portion is the top portion (representing the most significant bits), the bottom portion (representing the least significant bits), or the middle portion.
[0157] Within any particular lane, the HPA values that are aggregated are arranged to all have the same anchor, and accordingly, the metadata for a lane applies equally to all HPA values processed within that lane.
[0158] Essentially, by specifying different metadata for each lane, it is not necessary that a value processed in one lane have the same anchor as a value processed in another lane. However, it is often the case that values processed in all lanes are arranged to all have the same anchor value, in which case the 64-bit metadata can be stored and replicated across vector registers 160. This allows the various HPA results generated in each lane to of course easily be accumulated together to produce a single scalar HPA result.
[0159] In such an arrangement, an SVE instruction for the HPA that needs to reference metadata can specify a metadata register along with a 2-bit pointer to the specific 16-bit metadata for the portion of the HPA being processed.
[0160] Note that while Figure 7 illustrates one mechanism for providing metadata, other schemes can be devised to store the metadata more compactly, for example storing 8 lanes of metadata in 64 bits. In particular, the "lane type" field may not be required, and the sizes of the ovlp and significance fields may be reduced to reflect a limited number of available configurations.
[0161] An important operation of the HPA is to convert FP numbers to HPA format and add them. This operation may be performed for every FP number being added, but other HPA operations (converting to FP, removing redundancies in the HPA, etc.) may be performed less frequently than once in a few thousand. Therefore, hardware support for efficiently converting and adding FP numbers is desirable.
[0162] FIG. 8 illustrates a possible 64-bit data path for this operation repeated across the vector unit, and therefore illustrates in more detail an exemplary configuration for each of the conversion and processing circuits 170, 172, 174 shown in FIG. 6.
[0163] The input floating-point data 210 is comprised of a sign portion 212, an exponent portion 214, and a fraction portion 216. The relevant metadata portion is then extracted from the metadata maintained for the lane as metadata portion 200, including lane type field 202, overlap field 204, and significance field 206. An OR function 220 performs an OR operation on the bits of the exponent to generate the most significant bit of the mantissa, which is then prepended to the fraction bit 216 to form the mantissa. In particular, if the exponent is not zero, this indicates that the floating-point number is a normal floating-point number, and accordingly, the most significant bit of the mantissa will have a logic one value. However, if all the bits of the exponent are zero, this indicates a denormal value, and accordingly, the most significant bit of the mantissa should be set to zero.
[0164] Subtraction block 222 is arranged to subtract significand 206 from exponent 214 (adjusted as necessary for the exponent bias and fraction word length), for example using the techniques described above with reference to Table 7, and generate a shift amount (performing either a right shift or left shift, as appropriate) that is used to control shift circuit 224 to shift the floating-point mantissa by the appropriate amount.
[0165] Next, AND circuit 226 receives overlap information 204 and masks the output from the shift circuit with a specified number of overlap bits (equal to 64-p). XOR circuit 228 then performs a two's complement function on the output from AND circuit 226 if the floating point number was negative, as indicated by sign value 212. At this point, the bits of the input floating point number associated with a particular HPA portion having a given significance and amount of overlap are available as two's complement and can be provided as one input to adder circuit 230 (the adder also takes a carry-in value of one if the floating point operand is negative). As a result, it can be seen that the associated HPA portion can be generated "on the fly" from the input floating point value and then subjected to the appropriate processing operations to generate the corresponding result portion.
[0166] In the illustrated example, it is assumed that the processing operation is a selective add operation. In particular, AND circuit 240 can be selectively used to propagate the current value held in register 235 back as a second input to adder 230, where the previous result portion can be added with the input operand portion output from the transform circuit to generate an updated result portion stored in register 235. Incorporating a 64-bit adder and registers in the illustrated manner supports pipelined execution of back-to-back HPA transform-and-accumulate instructions.
[0167] Although there are a number of ways in which the circuitry depicted in Figure 8 can be triggered to perform the operations described above, in one embodiment, a single instruction is used to initiate the above-described functionality of Figure 8. Such an instruction may be referred to as an FP-to-HPA convert-and-add instruction.
[0168] The opcode for the FP-HPA convert-and-add instruction (mnemonic "FCVTH{A}", where {A} indicates optional accumulation) contains, in one example, an FP source register, a metadata register, a destination accumulator register, and an index to select a subfield of the metadata register. This is consistent with the SVE ISA design principle that an opcode may reference no more than three vector registers.
[0169] Short sequences of existing SVE instructions can also be created to implement other important HPA operations.
[0170] To avoid partial overflow, it is important to periodically remove the redundancy in the HPA number. This can be achieved by simply adding the carry bit accumulated in the overlap area of the lower HPA part to the LSB of the next higher HPA part. In SVE, this can be achieved in three instruction steps. (i) The lower part is arithmetically shifted to the right by p positions. (ii) Add the shifted overlap bit to the next most significant HPA portion. (iii) and AND-immediate the duplicated bits with a mask derived from p in the lower HPA portion to force them to zero.
[0171] This procedure can be applied to all pairs of adjacent HPA moieties, starting from the bottom lane.
[0172] Also, dedicated instructions for duplicate propagation and duplicate elimination may be provided, as described below with reference to FIGS.
[0173] After a large block of FP numbers is accumulated, the result may be stored in multiple accumulators located in multiple SVE lanes. These accumulators may then be added together to return a scalar result for each vector in the HPA lane with the same index. In the SVE, this can be easily achieved by performing vector reduction on the accumulators held in multiple HPA lanes to form a scalar HPA result. Because the resulting scalar HPA number may contain carry bits in the overlapping regions of each part, a redundancy elimination routine may be performed on the scalar HPA number before converting it to FP format.
[0174] Finally, we convert the reproducible HPA sum result into floating-point format. The algorithm for converting the HPA part exactly to a normalized FP64 number (i.e., assuming p >= 53) is as follows: (i) Execute CLZ (count leading zeroes) to identify the position of the first "1". (ii) Calculate the index as significance + (63-CLZ) + FP64 index bias. (iii) For all but the highest-order HPA portion, set bit
[63] of the FP64 result to 0. Set bits[62:52] of the FP64 result to the computed exponent. If the biased exponent > 0, logically left-shift the HPA portion by CLZ-11 places, else set the FP64 result to 0. (iv) For highest-order HPA part only: If the part is negative, set bit
[63] of the FP64 result to 1 and negate the part to get the positive two's complement number. Set bits[62:52] of the FP64 result to the computed exponent. If the biased exponent > 0, logically left-shift the HPA part by CLZ-11 places, else set the FP64 result to 0.
[0175] This transformation algorithm can be implemented with typically 15 SVE instructions per HPA lane.
[0176] If necessary, the above steps (iii) and (iv) can be combined as follows to cover cases where parts other than the most significant part are negative: (iii) If the part is negative, set bit
[63] of the FP64 result to 1 and negate the part to get the positive two's complement. Set bits[62:52] of the FP64 result to the computed exponent. If the biased exponent > 0, logically left-shift the HPA part by CLZ-11 places, else set the FP64 result to 0.
[0177] If desired, a single FP64 result can be created that represents the final integrated value as accurately as possible. This can be achieved, for example, by applying the algorithm proposed by Y. Hida, XS Li and D.H. Bailey, "Algorithms for Quad-Double Precision Floating Point Arithmetic," Proc. 15th IEEE Symposium on Computer Arithmetic, Vail CO, June 2001, pp. 155-162.
[0178] Starting with the bottom pair of lanes, the Fast2Sum operation is applied to the next top lane in succession to produce the top sum obtained by Fast2Sum. Then, working down the most significant pair of values just obtained, the process is repeated to successively apply it to the next bottom value and the bottom sum obtained by Fast2Sum. The most significant element of the resulting vector of FP64 numbers is guaranteed to be within 0.5 ulps of the HPA number.
[0179] The HPA accumulator consisting of l parts has a word length of <l×p bits and occupies l SVE vector registers. The FCVTH{A} instruction executed on a k×128-bit SVE vector unit can convert 2k FP64 or 4k FP32 numbers and accumulate them into a part of 2<k HPA accumulators. Since the FCVTH{A} instruction is fully pipelined, a block of n FP64 additions can be added to a 2k p×l-bit HPA accumulator in n×(l / 2k)+1 cycles. Since typical values of l and k are 2 to 4 (where k can be up to 16), if l = k, n FP64 numbers (or 2n FP32 numbers) can be added to k parallel accumulators in n / 2 cycles. On the other hand, in the case of Arm's Cortex-A72, the sums must be done in order, and for dependent FMA (Fused Multiply-Add), an additional 3 cycles are required during addition, so 3n cycles are required for the same reproducible accumulation. Thus, HPA achieves a speedup of approximately 12 times compared to conventional FP processing in FP32 accumulation processing.
[0180] As described above, the redundancy of HPA needs to be eliminated or resolved periodically. The above method requires 3×(l - 1) instructions and needs to be executed once for every 2 64-p integrations. However, for a typical value of p = 50, this results in a negligible processing overhead of less than 0.1%. Similarly, when reducing the vector of the HPA accumulator to scalar format, eliminating the redundancy of scalar HPA, and converting scalar HPA back to FP64 format, compared to ≒n / 4 cycles for n HPA integrations of n≒10 3 and above, for a typical value of l, l + 3×(l - 1)+15×l≒19×l - 3 = 35 - 73 instructions are required.
[0181] Figure 9 shows another example of an anchor data element encoding that includes type information specifying whether the anchor data element represents a portion of a two's complement number or a special value. Note that the anchor data element type information is different from the metadata lane type information 196, as shown in Figure 7. This encoding uses the most significant bit (bit 63 in this example) to indicate whether the element represents a standard HPA digit representing a portion of a two's complement number or a special value. If the most significant bit is 0, the HPA element represents a standard HPA digit representing a two's complement number, and the overlap bit has the same significance as the least significant bit of the next most significant digit in the HPA value, as in the example above.
[0182] However, when the most significant bit of an element is 1, the element represents an HPA special value selected from among positive infinity, negative infinity, Not a Number (NaN), and the saturation value. When the most significant bit is 1, the next two most significant bits (e.g., bits 61 and 62, as shown in Figure 9) represent the particular type of special value represented. Figure 10 shows the standard HPA digit and the encoding of bits 63 through 61 for each type of special value.
[0183] Thus, if the most significant bit is 0, the next two bits may represent some of the duplicated bits of the HPA digit, or they may represent the non-duplicated bits of the HPA digit if using a non-redundant HPA variant that does not have duplicated bits. This allows bits that would traditionally be used to indicate which particular type of special value is encoded to be reused to represent the bits of a two's complement number, allowing for efficient encoding.
[0184] If the most significant bit is 1 and the three most significant bits are 0, the HPA element represents infinity. The second most significant bit represents the sign of infinity. Thus, bits 63-61 of the element might encode 110 to represent negative infinity, and 100 to represent positive infinity. It is also possible for the encodings of positive and negative infinity to be swapped. When an HPA element is indicated as representing positive or negative infinity, it means that it was produced by a sequence of operations in which at least one operation included converting a floating-point value to HPA format, and that floating-point value was positive or negative infinity.
[0185] An element represents a Not-a-Number (NaN) if the three most significant bits of the element represent 101. This can arise in two ways: either the element may be produced by a series of operations involving the conversion of a floating-point value that was a NaN, or the element may depend on the addition of two HPA values, one of which was positive infinity and the other negative infinity.
[0186] On the other hand, if the three most significant bits of the HPA element are coded as 111, it represents a saturated HPA value. Saturated HPA values have no analogue in the floating-point domain. While positive or negative infinity indicates that the HPA value is the result of converting a positive or negative infinity floating-point value, which is derived from a calculation that results in a number of a size larger than can be represented in floating-point format, a saturated HPA type may indicate that the input floating-point numbers to a series of HPA operations were non-special numbers that were not NaN or infinity, but that saturation was caused by the HPA operations themselves, e.g., when anchor metadata sets a range of significance to be represented by HPA values, and the input floating-point values and / or their processing results produce numbers outside the range defined by the metadata.
[0187] For example, a saturation type may occur if an HPA operation acting on the most significant HPA element of an HPA value (as shown by lane information 196 in FIG. 7 ) results in an overflow from the most significant duplicated bit. Alternatively, a saturation type may occur if the most significant element of an HPA value overflows from the most significant non-duplicate bit to the least significant duplicated bit, if the most significant HPA element and the duplicated bit of the HPA value are not considered part of the two's complement number represented by the HPA value. By definition, encoding the saturation type as 111 in bits 63 through 61 is particularly useful if the duplicated bit of the top element of an HPA value is considered part of the entire two's complement number represented by the HPA value, since by definition, if overflowing from the top duplicated bit, the top two duplicated bits are already both equal to 1, and the overflow itself may cause the corresponding element to have its type information in the top three bits equal to 111, since the most significant bit of the element would switch from 0 to 1 due to the overflow. This can simplify the logic for setting the type information, as it may not require specific circuitry to detect overflow and set the type information accordingly. On the other hand, if the overlap bits are not considered part of the two's complement number represented by the HPA value, then some additional logic can detect overflow from the non-overlapping high-order bits into the overlap region and set the top 3 bits of the type information accordingly.
[0188] Also, a saturating type may be used if an underflow occurs during an HPA operation. For example, if a floating-point value being converted to HPA format requires more low-order bits to be represented exactly in the HPA format than the least significant bits that can be represented using the HPA format defined in the anchor metadata, this may be detected as an underflow and a saturated data type may be indicated. Also, a type encoding that distinguishes between overflow and underflow may be used. However, in practice, an overflow may be more important to signal than an underflow, since an underflow simply leads to a loss of precision, whereas an overflow may result in an incorrect processing result. Therefore, in some cases, one may choose not to signal an underflow using the data type indicated in the type information.
[0189] In general, providing type information that supports the representation of saturation types for HPA values allows program code, after a sequence of HPA operations, to determine whether any special values resulting from the operations are due to the input floating-point numbers being special, or due to an overflow caused by the HPA processing. This is useful in the second scenario because it allows the program code to adjust the anchor metadata and repeat the sequence of operations to maintain valid results, whereas if the special value occurred because of a special number in the original floating-point value, repeating the HPA processing with different anchor metadata will not produce a non-special result.
[0190] Although FIG. 10 illustrates one particular encoding of type information that is useful for providing an efficient encoding scheme, other encoding schemes may be used.
[0191] Figure 9 shows the encoding for a single HPA element. If an HPA value is composed of two or more HPA elements, the HPA value is considered to be a special value if any of those HPA elements has its top bit set to 1. In practice, as shown in Figure 5, because the HPA value is striped across several different vector registers, each HPA processing instruction can only see one element at a time, and when processing one of the HPA elements, it may not be obvious that one of the other HPA elements of the same vector value detects a special value or overflow. Also, if the input floating-point value is an infinity or a not-a-number, it is possible that all elements of the HPA value to which that floating-point value is converted are set to indicate a special value, but if saturation occurs due to the HPA processing, for example, only the most significant HPA element of the HPA value may indicate the saturation type.
[0192] Also, when adding two HPA elements, the type information of the result element can be set according to the type information of the two elements being added. Figure 11 is a table showing the possible data type differences depending on the data types of the first and second operands. The left column of the table shows the different data type choices for the first operand, and the top row of the table shows the different data type choices for the second operand. The abbreviation Num represents standard two's complement, i.e. the data type when the most significant bit of the element is 0.
[0193] As shown in Figure 11, if both input operands are standard two's complement numbers, the result can be either another standard two's complement number, or a saturated value if the most significant element of the HPA value overflows. If at least one of the two operands being added is a special value, the result will also be special. Thus, when an HPA element has its most significant bit set to 1, all subsequent HPA elements that depend on it are sticky in the sense that they are all generated with their most significant bit at 1, making it possible to detect the occurrence of special values at the end of a sequence of operations.
[0194] As shown in Figure 11, if either operand being added is NaN, the result will be NaN. It can also be NaN if one operand being added is positive infinity and the other is negative infinity. If one operand being added is positive infinity and the other is negative infinity or anything other than NaN, the result will be positive infinity. Similarly, if one operand is negative infinity and the other is positive infinity or anything other than NaN, the result will be negative infinity. Finally, if at least one of the operands is a saturation value, the result will also be saturated if the other operand is either standard two's complement or a saturation value.
[0195] In some cases, an exception may be triggered in response to an HPA addition that causes a particular result. An overflow exception may be signaled if an overflow occurs and the result saturates, even though the two operands being added were standard two's complement numbers. For HPA elements other than the most significant element of an HPA value, this exception should not occur after a certain number of HPA additions have been performed, because that number is chosen such that an HPA addition of that number will not cause an overflow beyond the top overlap bit, and the program code should trigger the overlap propagation behavior. However, for the most significant element, an overflow may occur if the anchor metadata is not set correctly.
[0196] If you add a non-signed floating-point infinity and the result is NaN, an invalid operand exception may occur.
[0197] In addition, other kinds of exceptions can occur when converting from floating-point to the HPA or from the HPA to floating-point, depending on the kinds of special values represented.
[0198] Figure 12 shows an example of circuit logic 300 for performing HPA addition when considering special values encoded as in the examples of Figures 9 to 11. The circuit logic 300 includes a 63-bit adder 302 and a special value detection circuit 304. The adder 302 receives the lower 63 bits of each of the two HPA elements to be added, excluding the most significant bit indicating whether the value is a special value, adds the two sets of 63 bits to generate a 63-bit sum, and generates a 64-bit result that is encoded as a non-special value by preceding the sum with a single bit value of 0, which is provided to a multiplexer 308.
[0199] In parallel with the addition by the adder, the special value detection circuit 304 receives type information (top 3 bits) of each HPA element to be added. The special value detection circuit 304 checks the type information to determine which special value, if any, is represented, and based on the combination shown in the table of FIG. 11, the logic 304 determines whether the result should represent a special value, and if so, what type of special value should be encoded. If the result is a special value, the special value detection circuit generates a 64-bit result 306 with the top 3 bits encoded according to the type of special value shown in the table of FIG. 11, selected based on the types of the two operands. When a special value occurs, the HPA value cannot represent a valid two's complement number in the range, so if the result is special, the bit value of the bottom 61 bits can take any value, and therefore it is not important which information is specified in the bottom 61 bits.
[0200] A multiplexer 308 selects between the 64-bit value provided by the special value detection circuit 304 and the 64 bits provided by the adder with the most significant bit equal to 0 to indicate a non-special number. The multiplexer makes this selection based on a value 310 provided by the special value detection circuit, which indicates whether the result should be special. In practice, this signal 310 may simply be the most significant bits of the 64-bit value 306, as shown by the dotted line in FIG.
[0201] Thus, because the special value detection circuit 304 operates in parallel with the adder itself, the logic has the same logic depth as a standard saturated integer adder and is therefore fast.
[0202] If the result is a special value, the special value detection circuit 304 can also set various floating-point status flags depending on the result, which can indicate characteristics of the floating-point operation. This allows the HPA processing to reflect the processing that would be expected if the processing were performed entirely using floating-point arithmetic. For example, these floating-point flags can indicate whether an underflow or overflow exception needs to be signaled, or whether there was an invalid operation.
[0203] Although FIG. 12 shows a single lane addition, it will be understood that this circuit logic may be provided for each vector lane where a separate addition is performed for each pair of HPA elements in a corresponding lane of a pair of vector registers, similar to the vectorization of the transform operations shown in FIG.
[0204] Special HPA values can also be taken into account when performing overlap propagation operations. Figure 13 shows an overlap propagation instruction, which is a vector instruction that specifies three vector registers as input. Vector register Zdu provides the HPA element that is expected to represent the upper HPA element of a pair of adjacent HPA elements of the same HPA value, and also serves as a destination register that stores the updated value of that upper HPA element of the pair. Source vector register Zl is a vector, each lane of which provides the lower element of a pair of elements that corresponds to the upper element in the corresponding vector lane of Zdu. Vector register Zm provides anchor metadata for each lane of the vector processing. In general, the anchor metadata in register Zm should be the anchor metadata associated with the lower HPA element of each pair specified in input register Zl, but it is also possible to use a register that provides anchor metadata for the upper element of each pair if the number of overlap bits is the same for the upper and lower HPA elements of each pair. Thus, each vector lane of the three registers is associated with a different HPA value and specifies for that HPA value a pair of adjacent elements Li, Ui and corresponding metadata Mi (in this example there are four vector lanes, so i=0...3, but in other examples the number of lanes could be different).
[0205] Thus, within each lane of vector processing, a duplicate propagation operation 350 is performed based on the upper element Li and lower element Ui of a corresponding pair of adjacent elements of a given HPA value and the metadata Mi associated with that pair to generate an update value Ui' and store it in the corresponding element location in the destination register Zdu.
[0206] The operations performed within each lane of the overlap propagation function 350 are shown in the bottom portion of FIG. 13. As shown, the operations include right-shifting the lower element Li of the corresponding pair of elements by an alignment shift amount that depends on the metadata in the corresponding lane Mi of the metadata register Zm. The size of the alignment shift within the vector may correspond to the number of non-overlapping bits W in the lower element Li of each pair. Different vector lanes may have different size alignment shifts if the metadata for those different lanes specify different numbers of overlapping bits because they correspond to completely different HPA values. The alignment shift amount may be determined in different ways depending on how the number of overlapping bits is encoded. If the number of non-overlapping bits is specified directly by the metadata, then this may simply be used directly as the alignment shift. However, if the metadata specifies the number of overlapping bits V, then it may be derived from the total number of bits N in the data element and the number of overlapping bits V, such that the alignment shift size SH is equal to NV-1 if one bit is used as an indicator of whether the value is special.
[0207] Thus, the lower element of the pair is right-shifted by W bits and then the shifted value is added to the corresponding upper element Ui of the pair to generate an update value Ui', which is stored in the corresponding lane of the destination register. Thus, if neither the upper nor lower element is a special number, the update value of the upper element Ui' is set such that its non-overlapping bits are equal to the sum of the overlapping bits of the lower element and the non-overlapping bits of the upper element in the pair.
[0208] Thus, if the most significant bit of the lower element Li is 1 or the most significant bit of the upper element Ui is 1, indicating that either of these elements is a special HPA value, the upper element can be left unchanged rather than undergoing a shift and addition of duplicate and non-duplicate bits. This can reduce the amount of logic required. Thus, the special value and elements adjacent to the special value can be left unchanged during the carry erase, so that the fact that a special value has occurred can be detected at the end of the sequence of HPA operations. If any one or more elements of the HPA number are special values, the entire HPA number may be considered numerically invalid.
[0209] Alternatively, another approach to handle the occurrence of special values may be to copy the type information from the lower element Li to the type information of the updated upper element Ui' if the lower element Li of the pair is special and write it to the destination register Zdu. In this approach, as a series of carry eliminations are performed by executing carry propagation instructions on successive pairs of adjacent elements of the HPA value, the signaling of the special value may be gradually propagated to the top lane, which makes it easier to detect whether a special value has been generated when the end of the series of HPA operations is reached, since the presence of a special value can be detected by simply checking the type information of the top lane, without the need to check the type information of all elements of the HPA value.
[0210] On the other hand, if both the low and high elements of a pair are not special, but an overflow occurs due to the addition of the non-duplicate bit of the high element and the duplicated bit of the low element, bits 63-61 of the updated high element Ui' can be set to 111 to indicate a saturation value similar to that in the addition case described above.
[0211] The operations shown in the lower part of Figure 13 can be performed independently for each lane of vector processing, so that it is possible for overlap propagation in one lane to produce a special value but not in another lane.
[0212] As shown in FIG. 13, by providing a dedicated overlap propagation instruction, the code size required to perform overlap propagation can be significantly reduced compared to requiring separate instructions to perform the alignment shift, addition, and setting of type information.
[0213] Figure 14 shows the corresponding clear duplicate instruction to remove the duplicate bit after a duplicate propagate operation as shown in Figure 13. That is, when the duplicate bit of the low-order element of a pair is added to the high-order element, the duplicate bit of the low-order element can be cleared to 0.
[0214] As for the duplicate propagation instruction, the duplicate clear instruction specifies three vector registers, where the destination register Zdl provides the lower HPA element of the pair of adjacent HPA elements in the HPA number, which is updated as a result of the duplicate clear instruction. The other two source registers Zm, Zu represent the metadata and the upper element of the pair, respectively. Similarly, these are vector registers, and thus multiple independent lanes of processing are performed for each set of vector elements located in the respective registers. The operation performed for each set of corresponding elements is then a duplicate clear operation 360, which takes as input the value of the pair of HPA elements Li and Ui and the corresponding metadata Mi, and generates an updated value Li' to write back to the corresponding lane of the destination register Zdl.
[0215] The operations performed by each of the clear duplicates functions 360 are shown at the bottom of Figure 14. As shown in Figure 14, the clear duplicates operation simply clears the duplicate bits of the sub-elements Li to 0, with the number of bits set to 0 depending on the number of duplicate bits 194 specified in the corresponding element Mi of the metadata Zm. The non-duplicate bits of the sub-elements remain unchanged. If neither the sub-elements nor the super-elements represent special values, the clearing of duplicate bits in the sub-elements is independent of the super-element Zu.
[0216] If the most significant bit of a low-order element Li is set to 1 to indicate a special value, the low-order element may be left unchanged so that the update value Li' is equal to the input value Li. Optionally, if the high-order element Ui is special, the low-order element may also be left unchanged, but this is not required. In certain embodiments, if the overlap clear is performed regardless of whether the high-order element is indicated as a special value, the instruction need not specify the register Zu corresponding to the high-order element Ui at all. However, it may be useful for the operation to depend on whether the high-order element is special to avoid performing unnecessary writes to the destination register. Unlike the overlap propagation instruction of FIG. 13, with the overlap clear instruction of FIG. 14, it is unlikely that it would be desirable to propagate a special value from the low-order element to the high-order element of a given pair of adjacent elements in the HPA value, because this would require a second destination register for the instruction, and many microarchitectures may not have sufficient write ports to do this.
[0217] It is therefore anticipated that, in use, the overlap clear instruction of Figure 14 may follow an overlap propagate instruction as shown in Figure 13, where the overlap clear instruction operates on the same pair of registers designated as the low and high registers. Splitting this operation into two separate instructions is useful to ensure that each instruction only needs to specify one destination register, and as noted above, this is easier to implement in the microarchitecture.
[0218] However, in architectures that permit instructions to specify two different destination registers that are updated in response to the same instruction, it is possible for a combined instruction to perform the functions of both Figures 13 and 14. That is, for a non-special input, an instruction can trigger both the addition of the duplicate bits of the low-order element to the non-duplicate bits of the high-order element, and the clearing of the duplicate bits of the low-order element to 0. Such an instruction can handle special values in the same manner as described above with respect to Figures 13 and 14, where if either value is special in the input register, the output value is either left unchanged or the type information of the low-order element is propagated to the high-order element.
[0219] 13 and 14 show an example where the first and second anchor data elements acted upon by the duplicate propagation and duplicate clear instructions are a pair of adjacent elements Li, Ui of the same HPA value, but this is not required. Another use case is where the first anchor data element (Li) specified by the duplicate propagation / clear instruction is the most significant element of a given HPA value, and the second anchor data element (Ui) is an "empty" HPA element with only the sign bit populated. This is useful when adding an HPA value containing the first anchor data value to another HPA value containing more significant bits, in which case the carry bit from the first anchor data value needs to be added to a lane of higher significance in the second HPA value, which can be made simpler by first removing the duplicate bits from the most significant element of the first HPA value, and then adding them to the non-duplicate bits of the other "empty" HPA element that can be given a lane significance corresponding to the lane significance of the associated HPA element of the second HPA value. It will be appreciated that other uses are possible for the instructions shown in FIGS.
[0220] FIG. 15 illustrates a simulator implementation that may be used. While the previously described embodiments implement the invention in terms of apparatus and methods for operating specific processing hardware supporting the technology, it is also possible to provide an instruction execution environment according to the embodiments described herein that is implemented using a computer program. Such computer programs are often referred to as simulators insofar as they provide a software-based implementation of a hardware architecture. Types of simulator computer programs include emulators, virtual machines, models, and binary translators, including dynamic binary translators. Typically, a simulator implementation may run on a host processor 430 that supports a simulator program 410 and optionally runs a host operating system 420. In some configurations, there may be multiple simulation layers between the hardware and the instruction execution environment provided, and / or there may be multiple different instruction execution environments provided on the same host processor. Historically, powerful processors have been required to provide simulator implementations that run at reasonable speeds, but in certain situations, such an approach may be justified, such as when one wants to run code native to another processor for compatibility or reuse reasons. For example, a simulator implementation may provide an instruction execution environment with additional features not supported by the host processor hardware, or that are typically associated with a different hardware architecture. An overview of simulation is given in "Some Efficient Architecture Simulation Techniques", Robert Bedichek, Winter 1990 USENIX Conference, pp. 53-63.
[0221] While embodiments have been described above with reference to particular hardware configurations or functions, in the simulated embodiments, equivalent functionality may be provided by appropriate software configurations or functions. For example, particular circuits may be implemented as computer program logic in the simulated embodiments. Similarly, memory hardware such as registers or caches may be implemented in the simulated embodiments as software data structures. In configurations in which one or more of the hardware elements referenced in the previously described embodiments reside on host hardware (e.g., host processor 430), some simulated embodiments may utilize the host hardware where appropriate.
[0222] The simulator program 410 may be stored in a computer readable storage medium (which may be a non-transitory medium) and provides a program interface (instruction execution environment) to the target code 400 (which may include an application, an operating system, a hypervisor) that is the same as the application program interface of the hardware architecture being modeled by the simulator program 410. Thus, the program instructions of the target code 400, including instructions supporting the processing of HPA values as described above, may be executed from within the instruction execution environment using the simulator program 410, allowing a host computer 430 that does not actually have the hardware functions of the device 2 described above to emulate these functions. The simulator program 410 may include instruction decode program logic 412 for decoding the instructions of the target code 400 and mapping them to native instructions supported by the host hardware 430. The instruction decode program logic 412 includes anchor data processing program logic 414 that maps HPA processing instructions to a set of native instructions for performing HPA (anchor data processing) operations, such as FP conversion, add or overlap propagate / clear operations as described above.
[0223] In this application, the term "configured to" is used to mean that an element of an apparatus has a configuration that can perform a defined operation. In this context, "configuration" refers to an arrangement or method of interconnection of hardware or software. For example, an apparatus may have dedicated hardware that provides the defined operation, or a processor or other processing device may be programmed to perform the function. "Configured to" does not imply that an apparatus element must be modified in any way to provide the defined operation.
[0224] Although exemplary embodiments of the present invention have been described in detail herein with reference to the accompanying drawings, it should be understood that the invention is not limited to those precise embodiments, and various changes and modifications can be made by those skilled in the art without departing from the scope and spirit of the present invention as defined by the appended claims.
Claims
1. 1. An apparatus comprising: processing circuitry for performing data processing; an instruction decoder for controlling said processing circuitry to perform anchor data processing operations to generate anchor data elements; Equipped with The anchor data element is represents a portion of a two's complement number of bits corresponding to a range of a given significance defined by the anchor metadata that is representable using the anchor data element; or represents a special value other than the said portion of the bits of a two's complement number, or and having an encoding including type information indicating the type information specifies whether the special value is positive infinity, negative infinity, a non-numeric value, or a saturation type anchor data element; the processing circuitry is configured to set the type information to indicate a saturated anchor data element when the anchor data element depends on a previous anchor data processing operation that caused the corresponding anchor data element to overflow due to an improper setting of a significance range indicated by the anchor metadata; and the processing circuitry is configured to store the type information in the same register as the anchor data element, the type information including an indication of whether the anchor data element is a saturated type anchor data element; Device.
2. The apparatus of claim 1 , wherein the anchor data processing operations include a floating point to anchor data conversion operation for converting floating point values to the anchor data elements.
3. The apparatus of claim 2 , wherein if the floating-point value represents a special number, the processing circuitry is configured to generate the anchor data element with the type information indicating that the anchor data element represents the special value.
4. The apparatus of claim 3 , wherein the type information distinguishes whether the special number represented by the floating-point value is positive infinity, negative infinity, or NaN.
5. The apparatus of any one of claims 2 to 4, wherein in the floating-point to anchor data conversion operation, the processing circuitry is configured to generate the anchor data elements based on the anchor metadata.
6. In a floating point to anchor data conversion operation for converting a floating point value to the anchor data element, the processing circuitry comprises: the anchor data element represents a most significant element of an anchor data value that comprises one or more anchor data values, and representing the floating-point value as a two's complement number requires at least one bit of significance higher than the given range of significance representable using the anchor data element; or the anchor data element represents a least significant element of an anchor data value that includes one or more anchor data values, and wherein representing the floating-point value as a two's complement number requires at least one bit of significance lower than the given range of significance representable using the anchor data element. The apparatus of claim 1 , further configured to set the type information of the anchor data element to indicate the saturation type if any of the following conditions is met:
7. 7. An apparatus according to claim 1, wherein the encoding of the type information is not capable of distinguishing, for anchor data elements designated as being of the saturated type, whether the anchor data element represents a positive or negative value.
8. the processing circuitry includes an adder circuit for performing an addition of two anchor data elements to generate an added result anchor data element; When generating an addition result anchor data element representing a most significant element of an anchor data value including one or more anchor data elements each representing a respective portion of a bit of a two's complement number represented by the anchor data value, if the addition of the two anchor data elements causes an overflow, the addition circuit is configured to generate the addition result anchor data element having the type information specifying that the addition result anchor data element is of the saturation type. An apparatus according to any one of claims 1 to 7.
9. The anchor data element is when a given bit of the anchor data element has a first value, the anchor data element represents the portion of a bit of a two's complement number; when the predetermined bit of the anchor data element has a second value, the anchor data element represents the special value. A device according to any one of claims 1 to 8, comprising a coding.
10. 10. The apparatus of claim 9, wherein if the predetermined bit of the anchor data element has the second value, then at least one further bit of the anchor data element indicates what type of special value is represented by the anchor data element.
11. 11. The apparatus of claim 10, wherein when the given bit of the anchor data element has the first value, the at least one further bit of the anchor data element represents a portion of the portion of the two's complement number or at least one duplicate bit to accommodate a carry from the portion of the anchor data element representing the portion of the two's complement number.
12. Apparatus according to any one of claims 9 to 11, wherein the predetermined bit is a most significant bit of the anchor data element.
13. 13. An apparatus according to any preceding claim, wherein, for a given anchor data processing operation, if an input anchor data element has the type information specifying that the input anchor data element is a special value, the processing circuitry is configured to generate a corresponding result anchor data element having the type information, the type information specifying that the corresponding result anchor data element is a special value.
14. the processing circuitry includes an adder circuit for performing an addition of two anchor data elements to generate a result anchor data element; 14. The apparatus of claim 1, wherein if the two type information of the two anchor data elements indicates that one of the two anchor data elements represents positive infinity and the other of the two anchor data elements represents negative infinity, the addition circuit is configured to generate a result anchor data element having type information specifying that the result anchor data element represents a not-a-number.
15. the anchor data element is an N-bit value containing V overlapping bits and W non-overlapping bits; wherein in a floating-point to anchor data conversion operation for converting a floating-point value to the anchor data element, if the floating-point value represents a number other than a special number and the number represented by the floating-point value is within an allowed numerical range, the processing circuitry is configured to set the W non-overlapping bits of the anchor data element to represent a portion of the bits of a two's complement number corresponding to the floating-point value and to set the V overlapping bits of the anchor data element to a sign extension of the W non-overlapping bits. An apparatus according to any one of claims 1 to 14.
16. 16. The apparatus of claim 15, wherein N-V-W>0.
17. 17. The apparatus of claim 15 or 16, wherein the processing circuitry is responsive to a duplicate propagation instruction to align the V duplicate bits of a first anchor data element with the W non-duplicate bits of a second anchor data element and add the aligned duplicate and non-duplicate bits to generate an updated value of the second anchor data element.
18. In response to the duplicate propagation instruction, if one of the first anchor data element and the second anchor data element has type information that specifies the special value, the processing circuitry: retaining the previous value of the second anchor data element; or if the type information of the first anchor data element indicates a special value, propagating the type information of the first anchor data element to the type information of the second anchor data element; 20. The apparatus of claim 17, configured to perform one of the following:
19. 19. The apparatus of claim 17 or 18, wherein if the adding of the aligned overlap bits and non-overlapping bits causes an overflow of the second anchor data element, the processing circuitry is configured to set the type information of the second anchor data element to indicate a saturated type value.
20. Apparatus according to any one of claims 15 to 19, wherein the processing circuitry is responsive to a clear duplicate command to clear the duplicate bit of a target anchor data element to zero.
21. 21. The apparatus of claim 20, wherein in response to the clear duplicates instruction, if the target anchor data element has type information that specifies the special value, the processing circuitry is configured to retain a previous value of the target anchor data element.
22. 1. A computer program for controlling a host data processing apparatus to provide an instruction execution environment for executing instructions, the computer program comprising: instruction decode program logic for decoding program instructions of a target code to control said host data processing apparatus to perform data processing; the instruction decode program logic includes anchor data processing program logic for controlling the host data processing apparatus to perform anchor data processing operations to generate anchor data elements; The anchor data element is represents a portion of a two's complement number of bits corresponding to a range of a given significance defined by the anchor metadata that is representable using the anchor data element, or represents a special value other than the said portion of the bits of a two's complement number, or and having an encoding including type information indicating the type information specifies whether the special value is positive infinity, negative infinity, a non-numeric value, or a saturation type anchor data element; the instruction decode program logic is configured to control the host data processing apparatus to set the type information to indicate a saturated type anchor data element when the anchor data element depends on a previous anchor data processing operation that overflowed the corresponding anchor data element due to an improper setting of a significance range indicated by the anchor metadata; and the type information, including an indication of whether the anchor data element is a saturated type anchor data element, is stored in the same register as the anchor data element; Computer program.
23. 1. A data processing method comprising the steps of: Decoding one or more instructions; and controlling, in response to the decoded instructions, a processing circuit to perform anchor data processing operations to generate anchor data elements; The anchor data element is represents a portion of a two's complement number of bits corresponding to a range of a given significance defined by the anchor metadata that is representable using the anchor data element, or represents a special value other than the said portion of the bits of a two's complement number, or and having an encoding including type information indicating the type information specifies whether the special value is positive infinity, negative infinity, a non-numeric value, or a saturation type anchor data element; the type information is set to indicate a saturated type anchor data element when the anchor data element depends on a previous anchor data processing operation that overflowed the corresponding anchor data element due to an improper setting of a significance range indicated by the anchor metadata; and the type information, including an indication of whether the anchor data element is a saturated type anchor data element, is stored in the same register as the anchor data element; Data processing methods.
Citation Information
Patent Citations
Computer system, computer program and method for processing vectorfloatingpointtestdataclassimmediate instructions
JP2016512627A
Processor and method
JP2017142799A
Semiconductor device
JP2017199167A
Lane position information for vector processing
JP2018533799A
Multiplication of the first and second operands using redundant representation
JP2019500673A
