Converting Anchor Data Elements

HPA numbers address the non-associativity of floating point arithmetic by defining a significance range for mantissa bits, enabling reproducible and parallelizable calculations, thus improving computational efficiency.

JP7601776B2Active Publication Date: 2024-12-17ARM LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2021544785
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2019-05-29
Filing Date
2020-01-30
Publication Date
2024-12-17
Estimated Expiration
2040-01-30

AI Technical Summary

Technical Problem

Floating point arithmetic calculations are non-associative, leading to inconsistent results when adding small numbers of values, making it difficult to parallelize operations and reproduce results across different machine configurations.

Method used

The introduction of High-Precision Anchor (HPA) numbers, defined by a pair (i, a), allows for reproducible and associative addition by specifying the significance of the smallest bit of the mantissa and using a long two's complement integer, enabling conversion from floating point to HPA format and performing operations within a programmable range.

Benefits of technology

HPA numbers enable fast, accurate, and associative accumulation of floating point values, allowing parallelization of calculations and ensuring reproducible results, potentially leading to speedups of 100 times or more compared to existing hardware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007601776000011
    Figure 0007601776000011
  • Figure 0007601776000012
    Figure 0007601776000012
  • Figure 0007601776000013
    Figure 0007601776000013
Patent Text Reader

Abstract

An apparatus is provided that includes an instruction decoder that generates one or more control signals in response to an anchor data processing instruction. A conversion circuit performs a conversion from a data value to an anchor data selection value in response to the one or more control signals. The conversion is based on anchor metadata indicating a given significance range of the anchor data selection value. An output circuit writes the anchor data selection value to a register in response to the one or more control signals.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to data processing.

[0002] explanation 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 anchored (HPA) numbers has been proposed. High-precision anchored (HPA) numbers can be constructed from a pair (i,a) containing a long two's complement (e.g. 200-bit) integer i, usually by specifying the significance of the least significant bit of i, and a small anchored 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] Viewed from a first exemplary configuration, an apparatus is provided comprising: an instruction decoder for generating one or more control signals in response to an anchor data processing instruction; a conversion circuit for performing a conversion from a data value to an anchor data selection value in response to the one or more control signals, the conversion being based on anchor metadata indicating a given significance range of the anchor data selection value; and an output circuit for writing the anchor data selection value to a register in response to the one or more control signals.

[0005] Viewed from a second exemplary configuration, a data processing method is provided that includes receiving an anchor data processing instruction; generating one or more control signals in response to the anchor data processing instruction; performing a conversion from a data value to an anchor data selection value in response to the one or more control signals, the conversion being based on anchor metadata indicating a given significance range of the anchor data selection value; and writing the anchor data selection value to a register in response to the one or more control signals.

[0006] Viewed from a third exemplary configuration, there is provided a computer program for controlling a host data processing apparatus to provide an instruction execution environment, the computer program comprising: conversion program logic for performing a conversion from a data value to an anchor data selection value, the conversion being based on anchor metadata indicating a given significance range of the anchor data selection value; and output program logic for writing the anchor data selection value to a data structure of the instruction execution environment. [Brief description of the drawings]

[0007] The invention will be further described, by way of example only, with reference to embodiments illustrated in the accompanying drawings, in which: [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 is a schematic diagram of an apparatus 400 for performing anchor data processing instructions on data values ​​using anchor metadata to generate anchor data selection values. [Figure 16] FIG. 16 is a diagram showing a conversion circuit for executing the extraction command. [Figure 17] FIG. 17 illustrates an addition to the conversion circuit shown in FIG. 16, for example, to handle the conversion of floating point products. [Figure 18] FIG. 18 shows how special floating point values ​​can be handled. [Figure 19] FIG. 19 is a diagram illustrating how a conversion circuit can be used to generate multiple anchor data selection values. [Figure 20] FIG. 20 is a diagram illustrating how the extraction process described with reference to FIG. 16 is performed with padding. [Figure 21] FIG. 21 illustrates a flow chart illustrating a method for processing data according to some embodiments. [Figure 22] FIG. 22 is a diagram illustrating an example of a simulator that may be used, according to some examples.

[0008] Description of exemplary embodiments 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.

[0009] 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.

[0010] 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.

[0011] 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.

[0012] 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. [Table 1]

[0013] 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.

[0014] 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 -50Let 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.

[0015] 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).

[0016] Before describing the embodiments with reference to the accompanying drawings, the following description of the embodiments is provided.

[0017] According to some embodiments, an apparatus is provided that includes an instruction decoder that generates one or more control signals in response to an anchor data processing instruction; a conversion circuit that performs a conversion from a data value to an anchor data selection value in response to the one or more control signals, the conversion being based on anchor metadata indicating a given significance range of the anchor data selection value; and an output circuit that writes the anchor data selection value to a register in response to the one or more control signals.

[0018] An anchor data processing instruction allows a data value to be transformed into an anchor data selection value and stored in a register. The transformation is performed using anchor metadata, which indicates a given significance range for the generated anchor data selection value. An anchor data selection value can be thought of as comprising a portion of the "integer" bits of the HPA number. In particular, an anchor data selection value need not include duplicate bits.

[0019] In some embodiments, the conversion circuitry is adapted to extract selected bits from the data value that correspond to a given significance range of the anchor data selection value. Thus, the bits extracted from the data value may depend on a given window of significance as indicated by the anchor metadata, and bits outside this window may either be ignored or may cause an error condition (e.g., overflow or underflow).

[0020] In some embodiments, the data value is either a floating point number or at least a portion of the product of two floating point numbers, which portion could be, for example, the mantissa of the product of two floating point numbers.

[0021] In some embodiments, the anchor data processing instruction is an anchor data multiplication instruction that causes the processing circuit to perform a multiplication between two floating point numbers to generate a data value that includes an unrounded mantissa that includes a sign bit, an exponent, and at least one integer bit. The anchor data multiplication instruction multiplies two floating point numbers together to generate a product. This may include separate calculations of the mantissa, its exponent, and its sign of the product. In some embodiments, the calculation of the mantissa is performed by multiplying the mantissas of the two floating point numbers, including any implied integer bits before the decimal point. The result of this calculation is an unrounded mantissa, which itself includes at least one bit that represents a portion of an integer. For example, the mantissa 1.0 may be represented by bit 10 in a register. The first bit "1" represents the integer component of the mantissa. Similarly, the decimal value 1.5 may be represented in binary as 1.1. This may then be stored in a register as 11. Again, the first bit "1" represents the integer bit of the mantissa.

[0022] In some embodiments, the conversion circuitry is adapted to extract selected bits from the unrounded mantissa corresponding to a given significance range of the anchor data selection value, the significance of the selected bits being determined from at least the exponent. As described above, determining the product may include, for example, determining an exponent of the product, at least in part, from the exponents of two operators that are multiplied together. Extraction or selection of bits from the calculated mantissa may then be performed, at least in part, based on the calculated exponent.

[0023] In some embodiments, the selected bits are selected from bits that make up the unrounded mantissa having a significance that is within a given range of significance of the anchor data selection value. For example, the selected bits may be selected if the exponent of the product indicates that they are within a window defined by the metadata of the anchor data selection value.

[0024] In some embodiments, the anchor metadata includes a lane indication that indicates whether the anchor data selection value belongs to a bottom lane or a top lane. The top lane can be considered as the lane that contains the most significant bits of a number, and the bottom lane can be considered as the lane that contains the least significant bits of a number (e.g., an HPA number).

[0025] In some embodiments, the anchor data multiplication instruction causes the processing circuit to perform a multiplication between two floating-point numbers to generate a data value including an unrounded mantissa including a sign bit, an exponent, and at least one integer bit, and the conversion circuit is adapted to extract selected bits from the unrounded mantissa corresponding to a given significance range of the anchor data selection value, and when the lane indication indicates that the anchor data selection value belongs to the bottom lane, if the significance of the least significant bit of the data value is lower than the lower limit of the given significance range, the conversion circuit is adapted to signal an underflow, otherwise the conversion circuit is adapted to pad the selected bits extracted from the unrounded mantissa to the least significant position. The significance of the unrounded mantissa can be determined, for example, based on its corresponding exponent. When extracting the bits of the bottom lane, if there are bits of the unrounded mantissa that are less significant than a window defined by the metadata of the anchor data selection value, an underflow occurs. That is, there are bits in the mantissa that are considered to be too less significant to be included. As a result, an underflow condition is signaled. A response to this may be to signal an underflow error. However, in some embodiments, underflow is ignored because it has already been determined, for example by a programmer, that bits of a particular significance can be ignored. If no bits have a significance lower than the lower limit of a given range, padding is done at the least significant position of the "missing" bits. That is, if the lower limit of a given significance range is less than 2x the significance of the anchor data selection value, padding is done at the least significant position of the "missing" bits. 15 and the least significant bit of the data value is 2 16If the data value is not a bottom lane, padding containing a single bit must be inserted in the least significant position of the data value. For non-bottom lanes, no underflow signaling is required, since the bit may have appropriate significance for the lower lane (the lane closest to the bottom lane) or for the bottom lane itself. The value of the bits constituting the padding depends on whether the result of the multiplication is positive or negative. In particular, if the result of the multiplication is positive, the padding is done with zeros. It will be appreciated that in integer arithmetic, a positive number is made negative by computing its two's complement, i.e., by first inverting the bits of the number and then adding a "1". Thus, if the result of the multiplication is negative, the bits constituting the magnitude of the result are padded with zeros, and the bits are inverted and a "1" is added.

[0026] In some embodiments, the anchor data multiplication instruction causes the processing circuit to perform a multiplication between two floating-point numbers to generate a data value including an unrounded mantissa including a sign bit, an exponent, and at least one integer bit, and the conversion circuit is adapted to extract selected bits from the unrounded mantissa corresponding to a given significance range of the anchor data selection value, and when the lane indication indicates that the anchor data selection value belongs to the top lane, if the significance of the most significant bit of the data value is higher than the upper limit of the given significance range, the conversion circuit is adapted to signal an overflow, otherwise the conversion circuit is adapted to sign-extend the selected bits extracted from the unrounded mantissa. The significance of the unrounded mantissa can be determined, for example, based on its corresponding exponent. When extracting the bits of the top lane, if there are bits of the unrounded mantissa that are more significant than a window defined by the metadata of the anchor data selection value, an overflow occurs. That is, there are bits in the mantissa that are considered to be too significant to be included. As a result, an overflow condition is signaled. A response to this may be to signal an underflow error. If the bit does not have a significance higher than the upper limit of the given range, padding is performed via sign extension on the "missing" bit. That is, if the upper limit of a given significance range is greater than or equal to 2.30 and the most significant bit of the data value is 2 27 If it indicates that the number is greater than the top lane, the padding is done in the most significant position. The value of the padding depends on whether the sign bit is positive or negative, and bits are added accordingly to avoid changing the value itself. For example, if the sign bit is positive, the padding is done with zeros in the most significant position. If the sign bit is negative, the extracted bit (representing the magnitude) is first padded with zeros in the most significant position. This does not change the magnitude. The two's complement is then calculated (to represent the number as a negative form of an integer) by inverting the padded bits and adding "1". In the non-top lane cases, there is no need to signal an overflow, as the bits may have appropriate significance for higher lanes (lanes closer to the top lane) or for the top lane itself.

[0027] In some embodiments, the anchor data multiplication instruction causes the processing circuit to perform a multiplication between two floating-point numbers to generate a data value including an unrounded mantissa including a sign bit, an exponent, and at least one integer bit, and the conversion circuit is adapted to extract selected bits from the unrounded mantissa corresponding to a given significance range of the anchor data selection value, and when the lane indication indicates that the anchor data selection value does not belong to either the bottom lane or the top lane, if the significance of the least significant bit of the data value is higher than the lower limit of the given significance range, the conversion circuit is adapted to pad the selected bits extracted from the unrounded mantissa in the least significant position, and if the significance of the most significant bit of the data value is lower than the upper limit of the given significance range, the conversion circuit is adapted to pad the selected bits extracted from the unrounded mantissa in the most significant position. Thus, when the lane is neither the top lane nor the bottom lane, the padding depends on the relationship between the extracted bits and the boundaries of the significance range. As previously described, the bits constituting the padding depend on the sign bit of the data value.

[0028] In some embodiments, when the lane indication indicates that the anchor data selection value belongs to the top lane, in response to one of the two floating point numbers being a floating point special case, a floating point special case is indicated in the register. The floating point special cases may include NaN, positive infinity, and negative infinity. In such a case, the anchor data selection value may be encoded to represent the special case that occurred.

[0029] In some embodiments, the anchor data processing instruction is an anchor data extraction instruction and the data value is a floating point number including a sign bit, an exponent, and a mantissa. The anchor data extraction instruction extracts relevant bits from the mantissa of the floating point number to form an anchor data selection value.

[0030] In some embodiments, the conversion circuitry is adapted to extract selected bits from the unrounded mantissa corresponding to a given significance range of the anchor data selection value, and the significance of the selected bits is determined from at least the exponent. For example, the significance of the selected bits may be determined based on a combination of the components and the significance range indicated by the anchor metadata.

[0031] In some embodiments, the selected bits are selected from bits that make up the unrounded mantissa having a significance within a given range of significance of the anchor data selection value.

[0032] In some embodiments, the anchor metadata includes a lane indication that indicates whether the anchor data selection value belongs to a bottom lane or a top lane. The top lane can be considered as the lane that contains the most significant bits of a number, and the bottom lane can be considered as the lane that contains the least significant bits of a number (e.g., an HPA number).

[0033] In some embodiments, the conversion circuit is adapted to extract selected bits from the data value corresponding to a given significance range of the anchor data selection value, and when the lane indication indicates that the anchor data selection value belongs to the bottom lane, if the significance of the least significant bit of the data value is lower than the lower limit of the given significance range, the conversion circuit is adapted to signal an underflow, otherwise the conversion circuit is adapted to pad the selected bits extracted from the unrounded mantissa to the least significant position. As described above, when the anchor data selection value is indicated to belong to the bottom lane, if the least significant bit of the data value to be converted is lower than the lower limit of the given significance range specified, for example, by metadata, an underflow may occur. If an underflow does not occur, padding is performed as necessary based on whether the data value is positive or negative.

[0034] In some embodiments, the conversion circuit is adapted to extract selected bits from the data value corresponding to a given significance range of the anchor data selection value, and when the lane indication indicates that the anchor data selection value belongs to the top lane, if the significance of the most significant bit of the data value is higher than the upper limit of the given significance range, the conversion circuit is adapted to signal an overflow, otherwise the conversion circuit is adapted to pad the selected bit extracted from the unrounded mantissa to the most significant position. As before, and as described above, if the most significant bit of the data value to be converted is higher than the upper limit of the given significance range specified, for example, by metadata, when the anchor data selection value is indicated to belong to the top lane, an overflow may occur. If an overflow does not occur, padding is performed.

[0035] In some embodiments, the conversion circuit is adapted to extract selected bits from the data value corresponding to a given significance range of the anchor data selection value, and if the lane indication indicates that the anchor data selection value does not belong to either the bottom lane, if the significance of the least significant bit of the data value is higher than the lower limit of the given significance range, the conversion circuit is adapted to pad the selected bits extracted from the unrounded mantissa in the least significant position, and if the significance of the most significant bit of the data value is lower than the upper limit of the given significance range, the conversion circuit is adapted to pad the selected bits extracted from the unrounded mantissa in the most significant position. Thus, if the lane is neither the top lane nor the bottom lane, the padding depends on the relationship between the extracted bits and the boundaries of the significance range.

[0036] Furthermore, the configurations described below may also be relevant to the present technology.

[0037] 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.

[0038] 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.

[0039] The processing circuitry may store the type information in the same register as the anchor data element.

[0040] 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.

[0041] 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.

[0042] 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.

[0043] 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.

[0044] 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.

[0045] 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.

[0046] 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. This recognises that if saturation occurs because the anchor metadata defining the allowable range of anchor data values ​​is set improperly, it is not important to know whether the value is positive or negative, because in these cases the code will likely be re-executed later 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.

[0047] 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.

[0048] When performing an addition of two such anchor data elements, an overflow may occur. For example, in an addition to produce a result anchor data element that represents a most significant element of an anchor data value, an overflow may occur 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 where the result anchor data element is the most significant element of the anchor data value, the addition circuitry may generate a result anchor data element having type information specifying that the result anchor data element is of a saturating type.

[0049] 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.

[0050] 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.

[0051] 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, a result anchor data element may be produced that has type information specifying that the result represents NaN.

[0052] 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.

[0053] 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.

[0054] 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.

[0055] 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.

[0056] 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.

[0057] 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.

[0058] 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.

[0059] When used within program code, one example use of the overlap propagate instruction may be to designate a pair of adjacent anchor data elements of the same anchor data value as first and second anchor data elements, respectively (the second anchor data element being an element that represents a more significant 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 most significant element of the same anchor data value.

[0060] However, in another use case, the first anchor data element may comprise the top 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 the top 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 that are more significant than the bits of the first anchor data element.

[0061] 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.

[0062] 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-mentioned 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.

[0063] 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.

[0064] 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.

[0065] 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 that is 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.

[0066] Specific embodiments will now be described with reference to the drawings.

[0067] 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.

[0068] 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.

[0069] 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.

[0070] 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:

[0071] [Table 2]

[0072] The sign is 1 for negative numbers and 0 for positive numbers. Every number has a sign, including zero.

[0073] 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.

[0074] 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.

[0075] Exponent zero is reserved for subnormal numbers and zero in any format. Normal numbers represent the following values: -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).

[0076] A number with both exponent and fraction equal to 0 is zero.

[0077] 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.

[0078] [Table 3]

[0079] 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.

[0080] 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

[0081] In two's complement representation, a (n+1)-bit binary integer is the number iS*2 n where 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

[0082] Two's complement format is the virtually universal format for signed integers because it simplifies computer arithmetic.

[0083] 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.

[0084] 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.

[0085] There are several ways to round, called rounding modes, of which there are six:

[0086] [Table 4]

[0087] 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

[0088] Given these three values ​​and the truncated value, we can always calculate the correctly rounded value, as shown in the following table.

[0089] [Table 5]

[0090] 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 (77 in decimal) L_Gss It becomes.

[0091] 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.

[0092] 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.

[0093] 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).

[0094] 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.

[0095] 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.

[0096] 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.

[0097] By similar logic, L = L0^(G0|S0).

[0098] Now that we know L, G, and S for negative and positive integers, we can consider the rounding rules.

[0099] [Table 6]

[0100] 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.

[0101] 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:

number

[0102] 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?

number

[0103] If we're just returning the dollar amount ($4) from the sum ($4.12), we'll round correctly using RNA rounding mode. If we're adding $0.99 instead of $0.50, we'll 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'll zero out the least significant bit of the dollar amount.

[0104] 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.

[0105] 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.

[0106] 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).

[0107] 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).

[0108] 0 is injected into RZ mode and RX mode, and into RP mode and RM mode which are reduced to RZ mode.

[0109] 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.

[0110] 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.

[0111] 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. (2 45 +-2 45 )+2 20 =2 20 2 45 +(-2 45 +2 20 )=0

[0112] 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

[0113] 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.

[0114] Due to the IEEE NaN rule, there are no multiplication or addition identities: 1 and 0 serve as numeric identities.

[0115] 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.

[0116] 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 by performing the operations in the exact same order.

[0117] For example, in single precision: 2 20 +(-2 44 +2 44 )=2 20 However, (2 20 +-2 44 )+2 44 =0

[0118] 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.

[0119] 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.

[0120] 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).

[0121] 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.

[0122] 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.

[0123] 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.

[0124] 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.

[0125] Figure 2 also shows 64-bit integer operands. Such integer operands range from 0 to (2 64 -1), -2 for signed integers 63 ~2 63It 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.

[0126] 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.

[0127] The anchor value(s) may be provided to be able to represent a range of bit significances 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.

[0128] 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, e.g., 64, 128, 192, 256, ...). It is also possible for the width of the bit significance range to vary continuously in 1-bit-wide steps.

[0129] 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.

[0130] 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.)

[0131] 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.

[0132] 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.

[0133] 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.

[0134] 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.

[0135] 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.

[0136] 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.

[0137] 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, an RHPA number includes variable components having metadata that defines an anchor value that enables the processing circuit 14 to identify the significance of each bit of the 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 numerical values are represented using a redundant representation that includes bits with overlapping significance in adjacent lanes of the vector, 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.

[0138] 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 duplicate bits and N - V non-duplicate bits. In this example, the number V of duplicate bits is the same for each N-bit portion, but it is also possible to have N-bit portions with different numbers of duplicate bits.

[0139] 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.

[0140] 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, overlapping 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 the lanes means that the RHPA number as a whole 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 (except the top portion), then

number

[0141] 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.

[0142] 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.

[0143] 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).

[0144] 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).

[0145] 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.

[0146] 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.

[0147] 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.

[0148] 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.

[0149] 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.

[0150] 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.

[0151] 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.

[0152] 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 all computations, lane-by-lane processing is required to obtain a redundancy-free answer.

[0153] 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 part of the significand of f to the part of i under consideration. This comparison can be done in parallel for all corresponding lanes. The significand of f may span two parts (three parts depending on the value of p in the case of FP64 product), but each part can be created and operate independently.

[0154] 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 occupies the lowest 32 bits on the "right side" of the vector register lane, and the HPA number occupies a 64-bit register lane (including a 50-bit value and 14 duplicate bits). In 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

[0155] Part 1 of the HPA number has an adjusted 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.)

[0156] Part 0 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}}

[0157] This results in the HPA form looking like this:

[0158] [Table 7]

[0159] In general, correctly rounding the HPA result 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, non-redundant HPA numbers occupying multiple 64-bit lanes can be converted in parallel to a vector of FP64 numbers. The resulting vector is then "renormalized" so that the most significant element represents a complete HPA number to 0.5 ulp accuracy.

[0160] 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.

[0161] 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.

[0162] 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.

[0163] 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.

[0164] 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.

[0165] 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.

[0166] 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.

[0167] 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.

[0168] 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.

[0169] 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.

[0170] 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.

[0171] In one exemplary configuration, HPA processing requires information ("metadata") about a wide range of anchors, lane overlaps, and lane types or top, bottom, or middle positions. Because the width of HPA numbers is typically 200 bits or less and the anchor range 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.

[0172] 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.

[0173] 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.

[0174] 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.

[0175] 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.

[0176] 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.

[0177] 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.

[0178] 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.

[0179] 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.

[0180] 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.

[0181] 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.

[0182] 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.

[0183] 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.

[0184] 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 design principle of the SVE ISA that an opcode references no more than three vector registers.

[0185] Short sequences of existing SVE instructions can also be created to implement other important HPA operations.

[0186] 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.

[0187] This procedure can be applied to all pairs of adjacent HPA moieties, starting from the bottom lane.

[0188] Also, dedicated instructions for duplicate propagation and duplicate elimination may be provided, as described below with reference to FIGS.

[0189] 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.

[0190] 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.

[0191] This transformation algorithm can be implemented with typically 15 SVE instructions per HPA lane.

[0192] 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.

[0193] 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.

[0194] 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.

[0195] 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, n blocks of 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 Arm's Cortex-A72, the sums must be done in order, and for dependent FMA (Fused Multiply-Add), 3 additional 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.

[0196] 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, to reduce the vector of the HPA accumulator to scalar form, eliminate the redundancy of the scalar HPA, and return the scalar HPA to FP64 form, typically n≒10 3 instructions are required compared to ≒n / 4 cycles for n HPA accumulations of the representative value of l. For the representative value of l, l + 3×(l - 1)+15×l≒19×l - 3 = 35 - 73 instructions are required.

[0197] 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.

[0198] 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.

[0199] 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.

[0200] 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.

[0201] 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.

[0202] 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.

[0203] 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.

[0204] 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.

[0205] 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.

[0206] 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.

[0207] 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.

[0208] 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.

[0209] 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.

[0210] 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.

[0211] 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.

[0212] If you add a non-signed floating-point infinity and the result is NaN, an invalid operand exception may occur.

[0213] In addition, other kinds of exceptions may occur when converting from floating-point to the HPA or from the HPA to floating-point, depending on the kinds of special values ​​represented.

[0214] 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.

[0215] 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 lower 61 bits can take any value, and therefore it is not important which information is specified in the lower 61 bits.

[0216] 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.

[0217] 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.

[0218] 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.

[0219] 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.

[0220] 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).

[0221] 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.

[0222] 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.

[0223] 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.

[0224] Thus, if the top 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.

[0225] 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.

[0226] 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.

[0227] 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.

[0228] 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.

[0229] 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.

[0230] 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.

[0231] 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.

[0232] If the top 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 enough write ports to do this.

[0233] 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.

[0234] 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.

[0235] 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 bits from the first anchor data value need 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 top element of the first HPA value, and then adding them to the non-overlapping 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.

[0236] Anchor Data Selection Value 15 is a schematic diagram of an apparatus 400 for executing anchor data processing instructions on a data value using anchor metadata. The data value to be converted may be a floating point number or may be (part of) the result of the product of two floating point numbers, such as a mantissa generated by multiplying the mantissas of two floating point numbers.

[0237] In any event, the instruction is received by fetcher 410, which passes the instruction to decoder 420. Decoder 420 generates one or more control signals, which are received by translation circuit 430. The translation circuit generates an anchor data select value, which is passed to writeback circuit 440, which writes the anchor data select value to, for example, register 460 in register file 450. The anchor data select value may be a set of bits that corresponds to one element of the HPA number. However, the anchor data select value may exclude duplicate bits that may be present in the actual HPA number.

[0238] In this example, the conversion circuit 430 can extract bits from the data values ​​to generate the anchor data selection values. The bits extracted and how they are used to form the anchor data selection values ​​can depend on the metadata provided, along with an exponent associated with the data values.

[0239] There are a number of ways in which the data values ​​and anchor metadata can be provided: In some embodiments, the instruction includes references to registers (which may include the vector registers mentioned above) where the data values ​​and anchor metadata can be located.

[0240] Figure 16 illustrates a transform circuit for executing the extract instruction. Such circuitry may be replicated across vector units, and Figure 16 therefore illustrates in more detail an exemplary configuration for each of the transform and processing circuits 170, 172, 174 shown in Figure 6.

[0241] The input floating-point data 510 is comprised of a sign portion 512, an exponent portion 514, and a fraction portion 516. The relevant metadata portion is then extracted from the metadata maintained for the lane as metadata portion 500, including lane type field 502, overlap field 504, and significance field 506. 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 516 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 is a logic one value. However, if all 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.

[0242] Subtraction block 522 is arranged to subtract significand 506 from exponent 514 (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 524 to shift the floating-point mantissa by the appropriate amount.

[0243] Next, the AND circuit 526 receives the overlap information 504 and masks the output from the shift circuit by a specified number of overlap bits (equal to 64-p). The XOR circuit 528 then performs a first part of a two's complement function on the output from the AND circuit 526 if the floating point number is negative, as indicated by the sign value 512. This result is then passed to a 64-bit adder 532 to add the sign bit 512 ("1" if the input FP data is negative, "0" otherwise). In other words, if the input FP data is negative, a "1" is added. This completes the two's complement operation. At this point, the bits of the input floating point number associated with a particular HPA portion having a given significance and overlap amount are available as a two's complement and can be provided as an output to, for example, a 64-bit output register 532.

[0244] Although there are a number of ways in which the circuitry depicted in Figure 16 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 16. Such an instruction can be referred to as the HEXTRACT instruction.

[0245] The opcode for the HEXTRACT instruction in one example includes identifiers for the FP source register, metadata register, and destination accumulator register, which is consistent with the design principle of the SVE ISA that an opcode may reference no more than three vector registers.

[0246] FIG. 17 illustrates an addition to the conversion circuit shown in FIG. 16, for example, to handle the conversion of floating point products.

[0247] FIG. 17 shows a pair of floating-point numbers (input FP data 1 and input FP data 2) that are multiplied together. Each of these includes a sign bit, an exponent, and a fraction. The different components of the two floating-point numbers are processed separately. The two fraction components (including the implied integer bit) are multiplied together using a multiplication unit 620. In this example, we assume that the two floating-point numbers are double precision numbers. Therefore, the mantissas are each 53 bits (including the implied integer bit), so the product of the two mantissas is 106 bits. The two exponents are added together by an adder circuit 600. Finally, the sign bits are processed using an XOR gate 610, which makes the output sign bit negative if the two input sign bits are different and positive if the two input sign bits match.

[0248] To convert the result of the multiplication into an anchor data selection value, the outputs from XOR unit 610, adder 600, and multiplication unit 620, along with the metadata, may be passed as input FP data 510 to the conversion circuit of FIG.

[0249] Figure 18 illustrates how special floating-point values ​​such as NaN, positive infinity, negative infinity, etc. can be handled. This process is similar to the technique described with reference to Figure 9, except that there is no need to handle such inputs, since it is not possible to "saturate" the input floating-point value.

[0250] The input FP data is provided in the form of a product of two floating point numbers multiplied together. Through the conversion circuit, the anchor data selection value is stored in a register, such as a 64-bit register 700. The top three bits of this value are extracted and passed to a multiplexer 710. At the same time, the two floating point numbers are passed separately to an analysis unit 720 along with the metadata used to generate the anchor data selection value. The analysis unit 720 determines whether any of the operands are one of the special floating point values ​​mentioned above and whether the metadata indicates that the anchor data selection value belongs to the top lane. If both of these conditions are met, a set of three bits representing the HPA flag is output by the analysis unit 720, as described above with reference to Figures 10 and 11. Furthermore, a signal is passed to the multiplexer 710. This signal causes the multiplexer to select the HPA flag instead of the original top three flags from the 64-bit register if one of the operands is special. Otherwise, the original three bits are selected. The bit selected by multiplexer 710 is then added to the remaining 61 bits of 64-bit register 700 by concatenation circuit 730 .

[0251] The result of this circuit is that if one of the two operands (two floating-point numbers) being multiplied together is a special value, then a set of three HPA flag bits replaces the top three bits of the value computed by the conversion circuit; otherwise, no change is made.

[0252] FIG. 19 illustrates how a conversion circuit 800 such as that shown in relation to FIG. 16 can be used to generate multiple anchor data selection values. In this example, a pair of floating point numbers are multiplied together to generate a sign, an exponent, and a fraction, as previously described. In this example, assume that the mantissa of the product (including the implied integer bit) is 53 bits, i.e. the result is a double precision number. This is passed to the conversion circuit 800. In practice, the double precision number can be passed as an input to multiple processing lanes, each with its own conversion circuit 800. However, the double precision number can also be passed to the conversion circuit over many processor cycles. In any case, the output of the conversion is passed to three 32-bit registers 810, 820, 830. Since there are no overlapping bits, the three 32-bit registers can be used to store a total of 96 bits together, which is significantly more than the 53 bits provided. Therefore, padding must be performed, as described in relation to FIG. 20. Nevertheless, once the output is provided to the three registers, three conversions are performed.

[0253] For each transformation, different metadata is provided. The first metadata 840 is associated with the output generated for the first 32-bit register 810. It indicates that the output is associated with the first (bottom) lane, there are no duplicate bits, and it sets the significance of the least significant bit stored in the first 32-bit register 810 as s. The second metadata 850 is associated with the output generated for the second 32-bit register 820. It indicates that the output is associated with the second (middle) lane, there are again no duplicate bits, and it sets the significance of the least significant bit stored in the second 32-bit register 820 as s+32. If there are v duplicate bits in the first register 810, the significance is s+32-v. Finally, the third metadata 860 is associated with the output generated for the third 32-bit register 830. This indicates that the output is associated with the third (top) lane, there are no duplicate bits, and it also sets the significance of the least significant bit to s+32+32=s+64.

[0254] As a result, those bits of significance of the double precision input number that have significance (due to the exponent) between s and s+31 are placed in a first register 810. Bits with significance between s+32 and s+63 are placed in a second register 820, and bits with significance between s+64 and s+96 are placed in a third register. Bits outside this range of significance (i.e., below s or above s+96) will cause an underflow or overflow condition, respectively.

[0255] FIG. 20 illustrates how the extraction process described with reference to FIG. 16 is performed with padding. The process begins at 910, where it is determined what the lane indicator of the current transformation is. If the lane transformation is to the bottom lane, it is determined in step 920 whether the significance of the least significant bit of the data value being transformed is lower than the lower limit of the range of significance indicated by the metadata. In other words, it is determined whether the metadata cannot support such less significant bits. If yes, an underflow occurs in step 930. This may result in an underflow error or simply be ignored, depending on the implementation. In any case, if the answer in step 920 is no, the relevant bits are extracted (as described with reference to FIG. 16) and depending on whether the value is positive or negative, the least significant bits are padded with padding (e.g., with 0 for positive numbers and with 1 for negative numbers stored in two's complement format). If in step 910 the lane indication is that the transformation is to the top lane, it is determined in step 950 whether the significance of the most significant bit of the data being transformed is higher than the upper limit of the range of significance indicated by the metadata. In other words, it is determined whether the metadata cannot support such highly significant bits. If so, then in step 960, an overflow occurs. Unlike an underflow, an overflow is generally expected to be an error since it indicates that the significant bits must be ignored. If not, then in step 970, the relevant bits are extracted (as described with reference to FIG. 16) and the most significant bits are padded with padding depending on whether the value is positive or negative. If in step 910, it is determined that the lane is a middle lane, then in step 980, it is determined whether the significance of the least significant bit of the data is less than the lower limit. If so, in step 940, the least significant bit is padded as described above. If not, then in step 990, it is determined whether the significance of the most significant bit of the data value is greater than the upper limit.If so, the extraction is performed with padding of the most significant bits as described above in step 970. If not, the bits are simply extracted in step 995.

[0256] The above process recognizes that if the bits are too low or high in significance to correspond to the significance of the data value to which the metadata is being converted, then underflow or overflow will occur as necessary. However, in this example, this will only occur if the lane being processed is the bottom lane or the top lane, as appropriate. This is because as long as the top lane is not being processed, there will be no overflow, and bits that are too high in significance for the current lane can still be represented by the higher lane. Similarly, as long as the bottom lane is not being processed, there will be no underflow, and bits that are too low in significance for the current lane can still be represented by the lower lane. In other cases (including those of intermediate lanes), padding may occur as necessary, e.g., additional bits need to be added if the significance of the data is high or low enough for the current lane.

[0257] Consider the example of converting a 53-bit mantissa 1.00011...111 with an exponent of 55. The significance of the most significant bit is 55. When processing the top lane, if the significance range only extends to 50 (e.g., if the register has 50 non-overlapping bits and the anchor is 0), an overflow will occur because the top 3 bits cannot be represented. If the significance extends to 57 (e.g., if the register has 50 non-overlapping bits and the anchor is 7), padding must be done for the most significant 4 bits, which would otherwise be undefined.

[0258] Now consider the example of converting a 53-bit mantissa 1.00011...111 with an exponent of 107. The significance of the least significant bit is 55. When processing the bottom lane, if the significance range only goes down to 59 (e.g. the anchor itself is 59), an underflow will occur because the bottom 4 bits cannot be represented. If the significance goes down to 51 (e.g. the anchor is 51), padding must be done to represent the bottom 4 bits that would otherwise be undefined.

[0259] In this manner, underflow and overflow conditions are handled, and in other cases where bits are defined, the extracted bits are padded to allow for proper representation.

[0260] The values ​​of the bits that make up the padding depend on whether the overall value is positive or negative. If the overall value is positive, the padding consists of zeros. If the overall value is negative, the extracted bits are padded with zeros and then the two's complement form of the extracted bits is formed by inverting the bits and adding a "1". Consider the case where there are eight extracted bits (1010_1100) and each lane is 12 bits. This requires padding using 4 bits as described above. In this case, assume that a bit is added in the most significant position, resulting in bbbb_1010_1100. If the overall value is positive, these bits each have the value "0", thereby obtaining 0000_1010_1100. If the overall value is negative, these bits each initially have the value "0", thereby obtaining 0000_1010_1100. This is then converted to two's complement by first inverting the bits to get 1111_0101_0011, and then adding a "1" to get 111101010100.

[0261] 21 illustrates a flow chart 1000 of a method for processing data according to some embodiments. At step 1010, an anchor data processing instruction is received. At step 1020, a control signal corresponding to the anchor data processing instruction is generated. At step 1030, the control signal causes a transformation of the data value based on the anchor metadata to generate an anchor data selection value. At step 1040, the transformed anchor data selection value is written to a register.

[0262] FIG. 22 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, simulator implementations may run on a host processor 1230 that optionally runs a host operating system 1220 that supports a simulator program 1210. 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.

[0263] 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.

[0264] The simulator program 1210 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 1200 (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 1210. Thus, the program instructions of the target code 1200, including instructions supporting the processing of HPA values ​​described above, may be executed from within the instruction execution environment using the simulator program 1210, allowing a host computer 1230 that does not actually have the hardware functions of the devices described above to emulate these functions. The simulator program 1210 may include instruction decode program logic 1212 for decoding the instructions of the target code 1200 and mapping them to native instructions supported by the host hardware 1230. The instruction decode program logic 1212 includes anchor data processing program logic 1214 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.

[0265] The technology may also be configured according to one or more of the following clauses. (1) 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 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.

[0266] (2) The apparatus of clause 1, wherein the processing circuitry is configured to store the type information in the same register as the anchor data element.

[0267] (3) The apparatus of clause 1, wherein the anchor data processing operation includes a floating-point to anchor data conversion operation for converting a floating-point value to the anchor data element.

[0268] (4) The apparatus of clause 3, wherein if the floating-point value represents a special number, the processing circuitry is configured to generate an anchor data element having type information indicating that the anchor data element represents the special value.

[0269] (5) The apparatus of clause 4, wherein the type information distinguishes whether the special number represented by the floating-point value is positive infinity, negative infinity, or not-a-number.

[0270] (6) The apparatus of clause 3, wherein in the floating-point to anchor data conversion operation, the processing circuitry is configured to generate the anchor data element based on anchor metadata indicative of the given significance range of the anchor data element.

[0271] 7. The apparatus of claim 1, wherein the type information specifies whether the anchor data element is a saturation type anchor data element that depends on any one of a previous anchor data processing operation that overflowed the corresponding anchor data element and a previous floating-point to anchor data conversion operation in which a floating-point value was outside an acceptable numeric range for anchor data values ​​involving one or more anchor data elements.

[0272] (8) The apparatus of clause 7, wherein in a floating-point to anchor data conversion operation for converting a floating-point value to the anchor data element, the processing circuitry is configured to set type information of the anchor data element to indicate the saturation 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 higher significance 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 lower significance than a given range of significance representable using the anchor data element.

[0273] (9) The apparatus of clause 7, wherein the encoding of the type information is incapable of distinguishing, for an anchor data element designated as a saturated type, whether the anchor data element represents a positive value or a negative value.

[0274] (10) The apparatus of clause 7, wherein the processing circuitry includes an adder circuit for performing an addition of two anchor data elements to generate a result anchor data element, and wherein when generating the result anchor data element representing a most significant element of the 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 adder circuit is configured to generate a result anchor data element having type information specifying that the result anchor data element is of a saturation type.

[0275] (11) The apparatus of claim 1, wherein the anchor data element has an encoding such that when a given bit of the anchor data element has a first value, the anchor data element represents the portion of bits of a two's complement number, and when the given bit of the anchor data element has a second value, the anchor data element represents the special value.

[0276] (12) The apparatus of claim 11, wherein if the given 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.

[0277] (13) The apparatus of claim 12, wherein when the predetermined 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 a two's complement number, or at least one redundant bit to accommodate a carry from the portion of the anchor data element representing the portion of a two's complement number.

[0278] (14) The apparatus of claim 11, wherein the predetermined bit is a most significant bit of the anchor data element.

[0279] (15) The apparatus of claim 1, wherein for a given anchor data processing operation, if an input anchor data element has 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 type information specifying that the result anchor data element is a special value.

[0280] (16) The apparatus of clause 1, wherein the processing circuitry includes an addition circuit for performing an addition of two anchor data elements to generate a result anchor data element, and wherein when the 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 circuitry is configured to generate a result anchor data element having type information specifying that the result anchor data element represents a not-a-number.

[0281] 17. The apparatus of claim 1, wherein the anchor data element is an N-bit value including V overlapping bits and W non-overlapping bits, and wherein in a floating-point to anchor data conversion operation to convert the floating-point value to the anchor data element, if the floating-point value represents a numeric value other than a special value and the numeric value represented by the floating-point value is within an allowed numeric 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 sign extension of the W non-overlapping bits.

[0282] (18) The device of claim 17, wherein NVW>0.

[0283] (19) The apparatus of clause 17, wherein the processing circuitry, in response to the overlap propagation instruction, aligns the V overlap bits of the first anchor data element with the W non-overlapping bits of the second anchor data element and adds the aligned overlap and non-overlapping bits to generate an updated value of the second anchor data element.

[0284] (20) The apparatus of clause 19, wherein in response to the clear duplicates instruction, the processing circuitry is configured to perform one of: if one of the first anchor data element and the second anchor data element has type information specifying the special value, retaining a previous value of the second anchor data element; or, if the type information of the first anchor data element indicates the special value, propagating the type information of the first anchor data element to the type information of the second anchor data element.

[0285] (21) The apparatus of claim 19, wherein if addition 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 type information of the second anchor data element to indicate a saturated type value.

[0286] (22) The apparatus of clause 17, wherein the processing circuitry clears the duplicate bit of the target anchor data element to zero in response to a clear duplicate command.

[0287] (23) The apparatus of clause 22, wherein in response to the clear duplicates instruction, if the target anchor data element has type information specifying the special value, the processing circuitry is configured to retain a previous value of the target anchor data element.

[0288] (24) 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 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.

[0289] (25) A method of data processing 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 a portion of a two's complement number of bits.

[0290] 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.

[0291] Although exemplary embodiments of the 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, additions, and modifications can be made by those skilled in the art without departing from the scope and spirit of the invention as defined by the appended claims. For example, various combinations of the features of the dependent claims can be made with the features of the independent claims without departing from the scope of the invention.

Claims

1. an instruction decoder responsive to the anchor data processing instruction to generate one or more control signals; a transformation circuit responsive to the one or more control signals to perform a transformation from data values ​​to anchor data selection values ​​that are part of the anchor data values, the transformation being based on anchor metadata indicative of a given significance range of the anchor data selection values ​​that are part of the anchor data values; an output circuit responsive to the one or more control signals for writing the anchor data selection value, which is a portion of an anchor data value, to a register; An apparatus comprising:

2. the conversion circuitry being adapted to extract selected bits from the data values ​​which correspond to the given significance range of the anchor data selection value; 2. The apparatus of claim 1.

3. the data value is either a floating point number or at least a portion of a product of two floating point numbers; 3. Apparatus according to claim 1 or 2.

4. the anchor data processing instruction is an anchor data multiplication instruction; the anchor data multiply instruction causes the processing circuit to perform a multiplication between two floating point numbers to generate the data value including a sign bit, an exponent, and an unrounded mantissa including at least one integer bit; An apparatus according to any one of claims 1 to 3.

5. the conversion circuitry is adapted to extract selected bits from the unrounded mantissa that correspond to the given significance range of the anchor data selection value; the significance of the selected bit is determined from at least the exponent; 5. The apparatus of claim 4.

6. the selected bits are selected from bits constituting the unrounded mantissa having significance within the given range of significance of the anchor data selection value.

6. The apparatus of claim 5.

7. The anchor metadata includes a lane indication indicating whether the anchor data selection value belongs to a bottom lane or a top lane. An apparatus according to any one of claims 4 to 6.

8. the anchor data multiply instruction causes the processing circuit to perform a multiplication between two floating point numbers to generate the data value including a sign bit, an exponent, and an unrounded mantissa including at least one integer bit; the conversion circuitry is adapted to extract selected bits from the unrounded mantissa that correspond to the given significance range of the anchor data selection value; When the lane indication indicates that the anchor data selection value belongs to the bottom lane, the conversion circuit being adapted to signal an underflow if the significance of a least significant bit of the data value is below a lower limit of the given significance range; otherwise, the conversion circuit is adapted to pad the selected bits extracted from the unrounded mantissa into a least significant position.

8. The apparatus of claim 7.

9. the anchor data multiply instruction causes the processing circuit to perform a multiplication between two floating point numbers to generate the data value including a sign bit, an exponent, and an unrounded mantissa including at least one integer bit; the conversion circuitry is adapted to extract selected bits from the unrounded mantissa that correspond to the given significance range of the anchor data selection value; When the lane indication indicates that the anchor data selection value belongs to the top lane, the conversion circuit being adapted to signal an overflow if the significance of a most significant bit of the data value is higher than an upper limit of the given significance range; otherwise, the conversion circuit is adapted to sign-extend the selected bits extracted from the unrounded mantissa.

8. The apparatus of claim 7.

10. the anchor data multiply instruction causes the processing circuit to perform a multiplication between two floating point numbers to generate the data value including a sign bit, an exponent, and an unrounded mantissa including at least one integer bit; the conversion circuitry is adapted to extract selected bits from the unrounded mantissa that correspond to the given significance range of the anchor data selection value; When the lane indication indicates that the anchor data selection value does not belong to either the bottom lane or the top lane, if the significance of a least significant bit of the data value is below a lower limit of the given significance range, the conversion circuit is adapted to pad the selected bit extracted from the unrounded mantissa into a least significant position; if the significance of a most significant bit of the data value is higher than an upper limit of the given significance range, the conversion circuit is adapted to pad the selected bit extracted from the unrounded mantissa into a most significant position.

8. The apparatus of claim 7.

11. when the lane indication indicates that the anchor data selection value belongs to the top lane, in response to one of the two floating point numbers being a floating point special case, the floating point special case is indicated in a register; An apparatus according to any one of claims 7 to 10.

12. the anchor data processing instruction is an anchor data extraction instruction, the data value is a floating point number including a sign bit, an exponent, and a mantissa; An apparatus according to any one of claims 1 to 3.

13. the conversion circuitry is adapted to extract selected bits from an unrounded mantissa corresponding to the given significance range of the anchor data selection value; the significance of the selected bit is determined from at least the exponent; 13. The apparatus of claim 12.

14. the selected bits are selected from bits constituting the unrounded mantissa having significance within the given range of significance of the anchor data selection value.

14. The apparatus of claim 13.

15. The anchor metadata includes a lane indication indicating whether the anchor data selection value belongs to a bottom lane or a top lane. An apparatus according to any one of claims 13 to 14.

16. the conversion circuitry is adapted to extract selected bits from the data values ​​which correspond to the given significance range of the anchor data selection value; When the lane indication indicates that the anchor data selection value belongs to the bottom lane, the conversion circuit being adapted to signal an underflow if the significance of a least significant bit of the data value is below a lower limit of the given significance range; otherwise, the conversion circuit is adapted to pad the selected bits extracted from the unrounded mantissa into a least significant position.

16. The apparatus of claim 15.

17. the conversion circuitry is adapted to extract selected bits from the data values ​​which correspond to the given significance range of the anchor data selection value; When the lane indication indicates that the anchor data selection value belongs to the top lane, the conversion circuit being adapted to signal an overflow if the significance of a most significant bit of the data value is higher than an upper limit of the given significance range; otherwise, the conversion circuit is adapted to pad the selected bits extracted from the unrounded mantissa into a most significant position.

16. The apparatus of claim 15.

18. the conversion circuitry is adapted to extract selected bits from the data values ​​which correspond to the given significance range of the anchor data selection value; When the lane indication indicates that the anchor data selection value does not belong to either the bottom lane or the top lane, if the significance of a least significant bit of the data value is below a lower limit of the given significance range, the conversion circuit is adapted to pad the selected bit extracted from the unrounded mantissa into a least significant position; if the significance of a most significant bit of the data value is higher than an upper limit of the given significance range, the conversion circuit is adapted to pad the selected bit extracted from the unrounded mantissa into a most significant position.

16. The apparatus of claim 15.

19. receiving an anchor data processing instruction; generating one or more control signals in response to the anchor data processing instructions; performing a transformation from data values ​​to anchor data selection values ​​that are part of the anchor data values ​​in response to the one or more control signals, the transformation being based on anchor metadata indicative of a given significance range of the anchor data selection values ​​that are part of the anchor data values; writing the anchor data selection value, which is a portion of an anchor data value, to a register in response to the one or more control signals; (c) a method for processing data,

20. 1. A computer program for controlling a host data processing apparatus to provide an instruction execution environment, comprising: transformation program logic for performing a transformation from a data value to an anchor data selection value that is a part of the anchor data value, said transformation being based on anchor metadata indicating a given significance range of the anchor data selection value that is a part of the anchor data value; output program logic for writing the anchor data selection value, which is a portion of the anchor data value, to a data structure of the instruction execution environment; A computer program comprising:

Citation Information

Patent Citations

  • Data processing apparatus and method using programmable validity data

    JP2018500635A

  • Lane position information for vector processing

    JP2018533799A

  • Apparatus and method for processing input operand values

    JP2020507844A

  • An apparatus and method for processing input operand values

    WO2018138469A1