Computer processor for higher precision computation using mixed precision decomposition of operations

By converting floating-point values ​​into multiple integers or lower-precision floating-point values ​​for arithmetic operations, and then executing these operations in a computer processor using dedicated hardware circuitry, the problem of high resource consumption in floating-point data operations is solved, resulting in more efficient calculations and greater accuracy.

CN112506467BActive Publication Date: 2024-08-30INTEL CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011389021.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-26
Publication Date
2024-08-30
Estimated Expiration
2039-08-26

AI Technical Summary

Technical Problem

Existing technologies consume high resources and have low computational efficiency when processing floating-point data operations in multidimensional datasets, making it difficult to achieve efficient precision conversion and arithmetic operations.

Method used

By converting floating-point values ​​into multiple lower-precision integer or floating-point values ​​for arithmetic operations, and executing these operations in integer or lower-precision floating-point hardware units, and then reconstructing them into floating-point values, computational efficiency is improved using dedicated hardware circuitry.

Benefits of technology

It achieves faster arithmetic operation time and higher throughput, while maintaining or improving data accuracy and reducing computing resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112506467B_ABST
    Figure CN112506467B_ABST
Patent Text Reader

Abstract

The present application discloses a computer processor for higher precision calculations using mixed precision decomposition of operations. The embodiments detailed herein are about arithmetic operations on floating point values. The exemplary processor includes a decoding circuit for decoding an instruction, wherein the instruction specifies the location of multiple operands, and the values ​​of these operands are in floating point format. The exemplary processor further includes an execution circuit for executing the decoded instruction, wherein the execution includes: converting the value of each operand, each value is converted to multiple lower precision values, wherein an exponent is stored for each operand; performing an arithmetic operation between the lower precision values ​​converted from the values ​​of the multiple operands; and generating a floating point value by converting the resulting value from the arithmetic operation to a floating point format, and storing the floating point value.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with application number 201910790247.0 filed on August 26, 2019, entitled “Computer processor for higher precision calculations using mixed precision decomposition of operations”, and with a priority date of September 27, 2018. Technical Field

[0002] Embodiments of the present invention relate to the field of computer processor architectures, and more particularly to precision conversion of values ​​used for arithmetic operations within computer processor architectures. Background Art

[0003] Matrices, vectors, and other multidimensional data sets are becoming increasingly important in many computing tasks such as machine learning and other batch data processing. Performing arithmetic operations on floating-point data elements in these multidimensional data sets can be resource-intensive and / or computationally time-consuming. BRIEF DESCRIPTION OF THE DRAWINGS

[0004] The present invention may be best understood by referring to the following description and accompanying drawings which illustrate embodiments of the invention. In the drawings:

[0005] Figure 1 Operations according to one embodiment of the present invention are shown: converting each value from a floating point value to integers for use in arithmetic operations, and reconstructing the resulting values ​​from these arithmetic operations back into floating point.

[0006] Figure 2A Pseudo code for converting an FP32 value into three unsigned 8-bit integers according to one embodiment of the present invention is shown.

[0007] Figure 2B Pseudo code for converting an FP32 value into two unsigned 16-bit integers according to one embodiment of the present invention is shown.

[0008] Figure 2C Pseudo code for converting an FP32 value into three signed 8-bit integers according to one embodiment of the present invention is shown.

[0009] Figure 2D Pseudo code for converting an FP32 value to four unsigned 8-bit integers according to one embodiment of the present invention is shown.

[0010] Figure 2E Pseudo code for reconstructing an FP32 value from four signed 8-bit integers according to one embodiment of the present invention is shown.

[0011] Figure 3 The data accuracy of an embodiment of the present invention using a floating point to multiple integer approach is shown compared to previous approaches.

[0012] Figure 4 Operation according to one embodiment of the present invention is shown: each value is converted from a value to multiple lower precision floating points for arithmetic operations, and the resulting values ​​from these arithmetic operations are reconstructed back to floating point.

[0013] Figure 5A Pseudo code for converting an FP32 value into two bfloat16 values ​​according to one embodiment of the present invention is shown.

[0014] Figure 5B Pseudo code for constructing an FP32 value from two bfloat16 values ​​according to one embodiment of the present invention is shown.

[0015] Figure 6 The data accuracy of an embodiment of the present invention using floating point to multiple lower precision floating point methods is shown compared to previous methods.

[0016] Fig. 7A is a flow chart illustrating an arithmetic operation including converting a floating point value to multiple lower precision values ​​and reconstructing the resulting values ​​back to floating point according to one embodiment of the present invention.

[0017] Figure 7B is a flow chart illustrating value conversion from a floating point value to a plurality of lower precision values ​​according to one embodiment of the present invention.

[0018] Fig. 8A is a block diagram illustrating both an exemplary in-order pipeline and an exemplary register-renaming, out-of-order issue / execution pipeline according to embodiments of the present invention.

[0019] Figure 8B is a block diagram illustrating both an exemplary embodiment of an in-order architecture core and an exemplary register renaming, out-of-order issue / execution architecture core to be included in a processor in accordance with embodiments of the present invention.

[0020] Fig. 9 is a block diagram of a single-core processor and a multi-core processor with an integrated memory controller and graphics device according to an embodiment of the present invention.

[0021] Fig.10 A block diagram of a system according to an embodiment of the present invention is shown.

[0022] Fig.11 A block diagram of a second system according to an embodiment of the present invention is shown.

[0023] Fig.12 A block diagram showing a third system according to an embodiment of the present invention is shown.

[0024] Fig.13A block diagram of a system on a chip (SoC) is shown according to an embodiment of the present invention.

[0025] Fig.14 A block diagram illustrating the conversion of binary instructions in a source instruction set into binary instructions in a target instruction set using a software instruction converter according to an embodiment of the present invention.

[0026] Fig.15A and Fig. 15B is a block diagram illustrating a general vector friendly instruction format and instruction templates thereof according to an embodiment of the present invention.

[0027] Figures 16A-16D is a block diagram illustrating an exemplary specific vector friendly instruction format according to an embodiment of the present invention.

[0028] Fig.17 is a block diagram of a register architecture according to one embodiment of the present invention.

[0029] Fig.18A is a block diagram of a single processor core and its connection to an on-die interconnect network and its local subset of a level 2 (L2) cache in accordance with an embodiment of the present invention; and

[0030] Fig.18B According to an embodiment of the present invention Fig.18A An expanded view of a portion of a processor core in FIG.

[0031] Fig.19 An embodiment of a configured sheet is shown.

[0032] Fig. 20 Several examples of matrix storage are shown.

[0033] Fig.21 An embodiment of a system utilizing a matrix (slice) to operate an accelerator is shown.

[0034] Fig. 22 and Fig.23 Different embodiments are shown how to use a matrix operation accelerator to share memory.

[0035] Fig.24 An embodiment using a tiled matrix multiply-accumulate operation ("TMMA") is illustrated.

[0036] Fig.25 An embodiment of a subset of the execution of an iteration of a chained fused multiply-accumulate instruction is illustrated.

[0037] Fig.26 A SIMD implementation with a size that is a power of two is shown, where the accumulator uses a size that is larger than the size of the input to the multiplier, according to an embodiment. DETAILED DESCRIPTION

[0038] In the following description, numerous specific details are set forth. However, it should be understood that embodiments of the present invention may be practiced without these specific details. In other instances, well-known circuits, structures, and techniques are not shown in detail to avoid obscuring the understanding of this specification.

[0039] Bracketed text and boxes with dashed borders (such as long dashes, short dashes, dot-dash lines, and dotted lines) may be used to illustrate optional operations that add additional features to embodiments of the invention. However, such notation should not be taken to mean that these are the only options or the only optional operations, and / or that boxes with solid borders are not optional in some embodiments of the invention.

[0040] References in the specification to "one embodiment," "an embodiment," "an example embodiment," etc. indicate that the described embodiment may include a particular feature, structure, or characteristic, but not every embodiment may include the particular feature, structure, or characteristic. Furthermore, such phrases do not necessarily refer to the same embodiment. Furthermore, when a particular feature, structure, or characteristic is described in conjunction with an embodiment, it is considered to be within the knowledge of those skilled in the art to affect such feature, structure, or characteristic in conjunction with other embodiments, whether or not explicitly described.

[0041] The following description and claims may use the terms "coupled" and "connected" and their derivatives. These terms are not intended to be synonymous with each other. "Coupled" is used to indicate that two or more elements that may or may not be in direct physical or electrical contact with each other cooperate or interact with each other. "Connected" is used to indicate the establishment of communication between two or more elements that are coupled to each other. As used herein, "set" refers to any positive integer number of items that includes an item.

[0042] Precision of values

[0043] In computing, values ​​are often represented in either integer format or floating point format. Values ​​occupy a number of bits in computer memory. Depending on the range of values ​​used in the computation, a different number of bits may be allocated. For example, an integer may occupy 8 bits and have a range of -128 to 127 if it is a signed integer (-2 7 to 2 7 -1), and if it is an unsigned integer has a range of 0 to 255 (0 to 2 8 -1). This 8-bit integer format is often abbreviated as int8, for example, int8 for signed integers and unit8 for unsigned integers. Except for the examples specifically referred to as unsigned or signed, whenever we write "int", it can also be replaced with "uint". A variety of integer formats are used in computing, and Table 1 shows a list of exemplary integer formats.

[0044] Table 1. Example integer formats

[0045]

[0046]

[0047] The range of the integer format is -2(n-1) to 2(n-1)-1 for signed integers and 0 to 2 for unsigned integers. n -1. The integer format can represent integers with exact precision, but for real numbers other than integers (which are irrational or rational numbers that do not include integers), the values ​​stored in the integer format are approximations of these values. To represent values ​​in the same range using the same number of bits, approximating real numbers in integer format is often not as accurate as approximating real numbers in floating-point format.

[0048] The floating point (FP) format uses a formulaic representation of real numbers as an approximation to support the trade-off between range and precision. Values ​​can be represented approximately as a fixed number of significant digits (significand, which may also be called the "mantissa", and the two terms are used interchangeably) and scaled using an exponent with some fixed base (note that the exponent may also be called the ratio or the exponential ratio, and these terms are used interchangeably); the base used for scaling may be 2, 10, or 16 (or another integer). Values ​​can be represented in the following form: Significand × Base 指数 , where the significand can be an integer value or a floating point value, the base is an integer greater than or equal to 2, and the exponent is an integer. Floating point systems can be used to represent values ​​of varying magnitude in calculations using a fixed number of digits. A variety of floating point formats are used in calculations, and Table 2 shows a list of exemplary floating point formats.

[0049] Table 2. Example floating point formats

[0050]

[0051]

[0052] In Table 2, the precision of the floating point format increases from the bfloat16 floating point format to the octal precision floating point format because more bits are used for the significant digit precision (from 8 bits in bfloat16 to 237 bits in octal precision).

[0053] Of the exemplary floating-point formats in Table 2, bfloat16 is a relatively new floating-point format that appears to be gaining traction due to its ability to work well in machine learning (ML) and artificial intelligence (AI) algorithms. However, bfloat16 may have lower accuracy than the single-precision floating-point format (FP32) because, as shown in Table 2, FP32 values ​​have an 8-bit exponent and a 24-bit significand (1 significand is implicit), while bfloat16 values ​​have an 8-bit exponent and an 8-bit significand. The reduced significand size means that many values ​​(but not all values) cannot be represented as accurately in the bfloat16 format as in the FP32 format.

[0054] Since dedicated circuits / logic are built using the bfloat16 format (e.g., in machine learning), it is desirable to use the bfloat16 format to represent higher precision values ​​(e.g., values ​​stored in FP32, FP64, FP128, or FP256 formats) in calculations, especially in vector / matrix calculations (e.g., general matrix-matrix multiplication, GEMM), and then perform arithmetic operations using bfloat16. Some embodiments of the present invention combine multiple (K) bfloat16 values ​​together to represent higher precision floating point values. Since multiple bfloat16 values ​​have 8×K significant digit precision bits, they can represent a single value in any higher precision value format by increasing the multiple K. Therefore, embodiments of the present invention can utilize existing bfloat16 hardware units (e.g., circuits) that are dedicated to bfloat16 arithmetic operations and can run one or more orders of magnitude faster than classic floating point hardware units / circuits using FP32, FP64, FP128, or FP256 formats. Using bfloat16 hardware units / circuits to run bfloat16 arithmetic operations may approach and / or exceed FP32 / 64 / 128 / 256 accuracy by combining multiple bfloat16 values, and may additionally achieve faster execution rates than classic floating point hardware units / circuits using FP32, FP64, FP128, or FP256 formats.

[0055] In addition to bfloat16, machine learning (ML) and artificial intelligence (AI) also widely use integer formats such as int4, int8, int16, int32, int64, and inte128. In ML and / or AI, floating point values ​​(e.g., floating point values ​​stored in FP32, FP64, FP128, or FP256 formats) can be quantized to be stored in integer format, and the quantized values ​​in integer format are then used in ML and / or AI applications (e.g., in neural networks). Quantization is helpful in this application because ML / AI-based hardware often includes hardware units (e.g., circuits) that are specialized for integer arithmetic operations and can run one or more orders of magnitude faster than classic floating point hardware units / circuits using FP32, FP64, FP128, or FP256 formats. Using integer hardware units / circuits to perform integer arithmetic operations can approach and / or exceed FP32 / 64 / 128 / 256 accuracy by combining multiple integer values, and can additionally achieve faster execution rates than classic floating-point hardware units / circuits using FP32, FP64, FP128, or FP256 formats.

[0056] Converting a single floating point value from FP32, FP64, FP128, or FP256 format to multiple values ​​in bfloat16 format or integer formats such as int8 and int16 often results in multiple values ​​in each of the multiple values ​​with lower precision than the original floating point value, because fewer bits are used to represent each of the multiple values ​​(hence referred to as lower precision values). However, faster hardware units / circuits for bfloat16 format and integer formats (e.g., one or more orders of magnitude faster than classic floating point hardware units / circuits using FP32, FP64, FP128, or FP256 formats) exist in some computer architectures, and the converted value can be used in multiple arithmetic operations (e.g., in vector or matrix arithmetic operations, the converted value is often used multiple times), so that the additional cost of conversion and reconstruction (e.g., computing time and hardware / software resources) is spread over multiple arithmetic operations, and embodiments of the present invention can result in faster total arithmetic operation time (thus resulting in higher throughput) and approximately the same accuracy as or even better accuracy than arithmetic operations without conversion.

[0057] The examples provided in the disclosure herein below use conversion from FP32 to bfloat16 and conversion from FP32 to int8. Obviously, embodiments of the present invention are not limited thereto, and each of the values ​​in a floating point format (e.g., the format in Table 2) can be converted using embodiments of the present invention to: (1) multiple values ​​in a lower precision floating point format (e.g., another format in Table 2 with fewer significant digits); or (2) multiple integer values ​​in an integer format (which is in lower precision, and which can be a format in Table 1 with a smaller bit length). Such conversions can achieve faster total arithmetic operation time (thus resulting in higher throughput) and approximate the same accuracy as or even better accuracy than arithmetic operations without conversion.

[0058] Embodiments of the present invention may implement new instructions for such conversions, and these may be used not only for machine learning (ML) and artificial intelligence (AI), but also for high performance computing (HPC) applications and other applications. Embodiments of the present invention may utilize hardware circuits (e.g., multiplier-accumulator (MAC) circuits, fused multiply-add (FMA) circuits) dedicated to arithmetic operations (e.g., general matrix-matrix multiplication (GEMM)) for specific data formats (e.g., bfloat16 or various integer formats). In addition to and / or in lieu of faster total arithmetic operation time as discussed, embodiments of the present invention may adjust the accuracy of arithmetic operations as explained in more detail below. Note that although examples are given for matrix multiplication, embodiments of the present invention may be applied to other arithmetic operations (one or more of addition, subtraction, multiplication, and division) between 1D, 2D, 3D, or other dimensional arrays (such as between matrices and matrices, between matrices and vectors, or between vectors and matrices).

[0059] Convert each from floating point to multiple integers

[0060] The input floating point value can be converted to multiple integers by quantization. Quantization of the input floating point value adds additional requirements for quantization support. However, quantization allows the resulting multiple integer values ​​to use integer units that can be executed one or more orders of magnitude faster than the classic floating point hardware units / circuits in computer processors using FP32, FP64, FP128 or FP256.

[0061] In one embodiment, a computer processor may obtain an instruction that specifies at least two operands, each operand including parameters in a floating point format. These parameters may correspond to the input of an array of one dimension (1D), two dimensions (2D), three dimensions (3D) or any other dimension. A 1D array may be referred to as a vector of N data elements, and a 2D array may be referred to as a matrix or tile of M*N data elements (note that the terms "matrix" and "tile" are used interchangeably in this disclosure). Data elements are typically in the same floating point format (e.g., one of FP32, FP64, FP128 or FP256 formats). Instructions are used to perform one or more arithmetic operations between two operands, and the arithmetic operation may be one or more of addition, subtraction, multiplication and division. Each floating point value in the floating point value identified by the operand may be quantized into multiple integers, and the shared exponents of these multiple integers may be stored in a memory or register (e.g., a register in a physical register file (PRF) of a processor). The processor may perform a series of integer arithmetic operations and identify a final exponent, ultimately converting the execution result back to floating point before storing it in a resulting 1D array or 2D array.

[0062] Quantization to integers and conversion back to floating point values ​​does not comply with current Institute of Electrical and Electronics Engineers (IEEE) standards for value representation, such as the IEEE 754 standard. However, this series of integer arithmetic operations can utilize integer arithmetic hardware units / circuits for performing integer multiplication-accumulation operations, such as multiplier-accumulator (MAC) circuits (also known as multiply-add circuits or MADD circuits). In one embodiment, the MAC circuits include fused multiply-add (FMA) circuits. The MAC circuits can run one or more orders of magnitude faster in their integer arithmetic operations than classic floating point hardware units / circuits using FP32, FP64, FP128, or FP256 formats. In some embodiments, non-IEEE-compliant computations provide comparable or better accuracy than floating point arithmetic operations without quantization and conversion.

[0063] Figure 1 Operation according to one embodiment of the present invention is shown: each value is converted from a floating point value to multiple integers for arithmetic operations, and the resulting values ​​from these arithmetic operations are reconstructed back to floating point. At mark 102, the instruction is decoded. The instruction specifies at least two operands, each operand identifies a location (e.g., memory, cache, or register) for an array, which is a matrix A in FP32 format. {m,k} and matrix B in FP32 format {k,n} In an embodiment of the present invention, matrix A and matrix B may be stored in a register, a cache or a memory.

[0064] At markers 104 and 106, the values ​​in matrix A and matrix B are then quantized. Quantization produces matrices A' and B', which contain 16-bit quantized values ​​for corresponding values ​​in matrix A and matrix B. Each quantized value is then split into two parts: at markers 112 and 116, the upper 8-bit values ​​are obtained to form matrices A1 and matrix B1; and at markers 114 and 118, the lower 8-bit values ​​are obtained to form matrices A2 and B2. Subsequently, at markers 122 to 128, integer arithmetic operations are performed. In this example, the integer arithmetic operation is a product between matrices. Other arithmetic operations (e.g., one or more of addition, subtraction, multiplication, and division) may also be performed at markers 122 to 128. Four product operations are performed: A1*B1, A1*B2, A2*B1, and A2*B2. Depending on the implementation, the product operations may be performed serially or in parallel. The resulting integers from indices 122 to 128 are then reconstructed and converted back to FP32 by dequantization at indices 132 .

[0065] Note that the product operation as shown at marks 122 to 128 can be accumulated to multiple times the bit length of the input value so that the accuracy of the result is maintained. In this example, two input int8 values ​​(each 8 bits) can be accumulated in a minimum of 16 bits (preferably 24 or more bits) as the arithmetic operation result, so the accumulator storing the result of the product operation has a bit width of at least 2*8=16 bits for each product result. In an embodiment of the present invention, the concept is that the accumulator used to store the result of the arithmetic operation between the converted lower precision values ​​is large enough so that the accuracy of the arithmetic operation is not lost. The integer arithmetic operation hardware circuit (e.g., MAC and / or FMA circuit) that implements the accumulator / accumulator does not comply with the current IEEE standard, but the mixed precision decomposition of the operation allows embodiments of the present invention to perform arithmetic operations with higher precision.

[0066] One measure of computational work is computational complexity, which can be denoted by a capital O notation, O(x), where x is the highest order of magnitude of the work. In this example, the processor performs the arithmetic operation four times, and each integer computation has a computational complexity of O(mnk). That is, the highest order of magnitude of the computation is one or more times m*n*k (k products for m*n data elements). Subsequently, the processor performs a conversion back to FP32, which has a computational complexity of O(mn) for floating-point computations. If the product between matrix A and matrix B is performed without quantization and reconstruction in markup 104-132, the floating-point computation between matrix A and matrix B has a computational complexity of O(mnk). However, integer computations with O(mnk) can be ten or more times faster (i.e., one or more orders of magnitude faster) than floating-point computations with O(mnk). Therefore, Figure 1The operation shown in can be more efficient than the floating-point product without quantization and reconstruction process even if four more inner products are performed.

[0067] Note that in this example, Figure 1 The values ​​of the matrix in are quantized and then split into two parts. As shown in the following example, embodiments of the present invention include splitting the quantized values ​​into more than two parts. In some embodiments, it is preferred that each FP32 value (24 significant digits of precision) is split into three int8s (3*8 bits = 24 bits). In general, the number of split parts may depend on the desired accuracy of the approximation using the quantization of the floating point value.

[0068] A floating point value may be quantized using as many bits as necessary to obtain the desired accuracy. For example, the FP32 value 17.1 may be quantized to an integer value of 17 using int16 or even int8. However, to achieve higher accuracy, embodiments of the present invention may quantize a value using two int16 values ​​or four int8 values ​​(both using 32 bits). This quantization may use a smaller exponent to quantize the value to a larger integer. The following example illustrates quantizing and splitting an original FP32 value into multiple integer values.

[0069] Example 1: Convert FP32 value to three unsigned integers uint8

[0070] For this conversion, it is assumed that the values ​​are in the range [Minval, Maxval]. For example, the values ​​of the data array may be in the range [-19, 19], and the FP32 value 17.1 will be quantized. Figure 2A Pseudocode for converting FP32 values ​​to three unsigned 8-bit integers according to one embodiment of the present invention is shown. At mark 202, the ratio is determined, and the ratio is based on the integer format (uint8) and the number of integers to be used (three). Therefore, the ratio is (Maxval-Minval) / (2^(integer length*number of integers)-1), which is 38 / (2^(8*3)-1)=38 / 16,777,215=2.2649766*(10^(-6)) in decimal. The ratio can be stored in a register, cache, or memory.

[0071] At reference 204, three numbers are then set as masks to obtain lower precision values ​​of the three parts from the quantized FP32 value. first_8_bits will only pick the first 8 bits, since 255 has all 1s in binary (bits 0-7); second_8_bits will pick the middle 8 bits, since 65280 has all 1s in bits 8-15 and 0s in bits 8-7; and third_8_bits will only pick the third set of 8 bits, since 16,711,680 has all 1s in bits 16-23 and 0s in bits 0-15.

[0072] At reference 206, an intermediate value v = 17.1 - (-19) = 36.1 is obtained. At reference 208, the intermediate value is quantized, where the quantized value num = uint32_t 36.1 / scale = 15,938,354. The quantized value is a binary number [11110011] [00110011] [00110010] having 24 bits, where brackets are added to show the division into three parts. At reference 210, the quantized intermediate value is divided into three parts using the mask defined at reference 204. For the second and third parts, the resulting values ​​are right-shifted 8 and 16 bits so that they are 8-bit values ​​such that q1 = [00110010]; q2 = [00110011]; q3 = [11110011]. These three unsigned integers can then be used to perform arithmetic operations with other unsigned integers obtained by quantizing another FP32 value. The arithmetic operations can use integer arithmetic operation circuits such as multiplier-accumulator (MAC) circuits, wherein each 8-bit value is assigned to a corresponding MAC circuit based on its partial position, and the result of the calculation is reconstructed as discussed above in this article. Although masks are used in this example to obtain lower precision values ​​for the three parts, other methods can also be used to obtain lower precision values. For example, shifting and / or truncation can be used to obtain lower precision values. Embodiments of the present invention cover various methods of obtaining / identifying lower precision values.

[0073] Note that the accuracy of the quantization is based on the value of the ratio, and the smaller the ratio, the better the approximation you get from the quantization. The ratio value is based on several factors: the range of values, and the number of bits available. The smaller the range and / or the more bits available for quantization, the smaller the ratio and the better the approximation.

[0074] The value of the ratio may be provided by an instruction for requesting an arithmetic operation. For example, in addition to two or more operands of a 1D array, a 2D array, a 3D array, or other dimensional array, each of which contains data elements, the instruction may also include one or more operands specifying an array range. Alternatively or additionally, the processor may scan the data elements of the array and determine the range upon receiving the instruction.

[0075] Example 2-4: Converting FP32 values ​​to different numbers of integers

[0076] Examples 2-4 provide further examples of quantization of FP32 values. Figure 2B Pseudo code for converting an FP32 value into two unsigned 16-bit integers according to one embodiment of the present invention is shown. Figure 2A The pseudocode in is similar, but the scale is smaller, and the two 16-bit values ​​q1 and q2 use more bits than the three 8-bit values ​​q1, q2, and q3. This quantization may result in more Figure 2A A better approximation of the quantization in .

[0077] Figure 2C Pseudo code for converting an FP32 value into three signed 8-bit integers according to one embodiment of the present invention is shown. Figure 2C and Figure 2A Similarly, one difference is that three 8-bit values ​​are generated at reference 230, where the values ​​of q1, q2, and q3 are in the range of signed 8-bit integers (from the range of unsigned integers [0,2 8 -1] to the range of signed integers [-2 7 ,2 7 -1]) minus 128(2 7 ).

[0078] Figure 2D Pseudo code for converting an FP32 value to four unsigned 8-bit integers according to one embodiment of the present invention is shown. Figure 2D and Figure 2A Similar, and one difference is that using 32 bits (8 bits per integer * 4 integers = 32) for quantization, the ratio is smaller, so the quantization may result in a smaller Figure 2A A better approximation of the quantization in .

[0079] Although in Figure 2A-2DFP32 is used in the examples in , but similar pseudocode can be used to quantize values ​​in other floating point formats such as FP64, FP128, or FP256. For example, FP64 has 53 bits for its significand, and by using 7 8-bit unsigned integers (uint8), we can accomplish covering the precision of the FP64 significand. The ratio is an even smaller value: ratio = (maxval–minval) / (2^(8*7)-1. In general, the number of bits available for quantization can be the bit length of the significand of the corresponding floating point format or exceed the bit length of the significand of the corresponding floating point format. In some embodiments, it may be desirable to deliberately use a bit length that is smaller than the bit length of the significand of the corresponding floating point format (e.g., to achieve a quality of service compromise—less accurate but much faster than the original floating point format).

[0080] Note that when software routines are available and fast, quantization using embodiments of the present invention may not be necessary. For example, one may quantize FP128 values ​​into 8-long strings of uint16, but software double-double precision or software quad precision may operate faster than arithmetic operations using 8-long strings of uint16. Determining whether to quantize and how many bits to use for quantization may depend on the availability of hardware circuits that perform fast integer arithmetic operations and how fast the hardware circuits are. The magnitude of the increase in computational speed should compensate for the extra work required to perform quantization and reconstruction as discussed herein.

[0081] Example 5: Reconstructing an FP32 value from four signed integers

[0082] Once the arithmetic operations have been performed on the multiple integer values ​​from quantization and division, they are reconstructed to return the final result in floating point format of the original values. Figure 2E Pseudocode for reconstructing an FP32 value from four signed 8-bit integers according to one embodiment of the present invention is shown. Figure 2E is used, and the ratio remains the same Figure 2D The conversion to four unsigned integers in is the same as another example, because the same number of bits (32 bits) are used for quantization and reconstruction. The reconstructed intermediate value is num, which is obtained at mark 240 by adjusting the range based on the range of signed 8-bit integers (int8) and then shifting the bits, because the four signed integers from the arithmetic operation correspond to different bit positions of the final result. At mark 242, the intermediate value is then converted back to FP32 using the minimum value and scale, and the intermediate value is an integer represented by the full 32 bits of the result of the four signed 8-bit accumulations, which may already be 32 bits.

[0083] Note that in some embodiments, each of the arithmetic operations on lower precision int8 values ​​may have been accumulated to a larger int type, such as an int32 value. The int32 values ​​are then combined to form the result of the arithmetic operation. Subsequently, reconstruction to FP32 may be a simple conversion of the int32 value to the corresponding FP32 value (without Figure 2E displacement shown in the figure).

[0084] Adjusting Workload and Accuracy: Floating Point to Integer

[0085] In with Figure 1 In the example of the invention, two matrices are split into two pairs of items, and matrix multiplication of them produces four times the workload of the integer operation shown in any of the indicia 122-128. However, in some computer architectures, since arithmetic operations according to integers can run significantly faster than the same arithmetic operations according to floating points, performing additional conversions and reconstructions can be more efficient than performing arithmetic operations on the original floating point values. In addition, some integer operations in the integer operations can be skipped to make embodiments of the present invention more efficient.

[0086] Since different numbers of integers are used to convert floating points, different numbers of terms are obtained from the matrix operations between the two matrices. For example, if two integers are used to partition each data element of the matrix, four times the amount of multiplication is performed for the matrix multiplication (as shown in marks 122-128). If three integers are used, nine times the amount of multiplication is performed, and if four integers are used, 16 times the amount of multiplication is performed. Since integer arithmetic hardware circuits (e.g., MAC circuits) can be executed accurately (without any accuracy loss from arithmetic operations), the calculation of the entire workload can be very accurate (only the accuracy is lost in the quantization step). And if we sacrifice some accuracy in arithmetic operations, we can skip some of the multiple workloads.

[0087] For example, in Figure 1, the quantization of A results in a matrix A1 formed using the upper 8 bits and a matrix A2 formed using the lower 8 bits, and the quantization of B results in a matrix B1 formed using the upper 8 bits and a matrix B2 formed using the lower 8 bits. The workload can be expressed as int8x2_4p, where "int8x" indicates an int8 operation, "2" indicates that each FP32 value is split into 2 int8 values, and "4p" indicates that four items are included in the calculation. Instead of quadruple the workload A1*B1, A1*B2, A2*B1, and A2*B2, we can skip the multiplication for the least significant part, that is, the multiplication A2*B2 between the lower 8 bits. The workload can be shown as int8x2_3p (one item less than int8x2_4p including A2*B2). Therefore, instead of quadruple the workload, we can save about 25% of the workload by performing multiplications for three higher significant parts (at the expense of some accuracy loss).

[0088] For another example, the quantization of A results in three matrices A1 to A3, each of which is formed using 8 bits from the most significant bit to the least significant bit (i.e., A1: bits 23-16; A2: bits 15-8; and A3: bits 7:0), and the quantization of B can result in three matrices B1 to B3, each of which is formed using 8 bits from the most significant bit to the least significant bit (i.e., B1: bits 23-16; B2: bits 15-8; and B3: bits 7:0). The workload is a matrix multiplication of nine times: int8x3_9p, which is A1*B1+A1*B2+A1*B3+A2*B1+A2*B2+A2*B3+A3*B1+A3*B2+A3*B3. Similarly, we can skip the multiplication for the least significant part, i.e., the multiplication between the lowest 8 bits, A3*B3, and obtain int8x3_8p.

[0089] In addition, if we want to further remove workload, we can remove one or more lower valid parts, thereby reducing accuracy while increasing calculation speed or reducing computing resource usage. For example, we can discard items with coefficients that add up to 5 or more, so we can additionally discard A2*B3 and A3*B2. In order to further increase calculation speed or reduce computing resource usage, we can further discard items with coefficients that add up to 4 or more: A1*B3, A2*B2, A3*B1. The more items that are discarded, the less accurate the reconstructed floating-point value obtained when approximating the floating-point value without quantization and reconstruction, but the workload performed is also less. Embodiments of the present invention provide methods for adjusting workload and accuracy.

[0090] An application using an embodiment of the present invention may determine one or more quality of service (QoS) requirements for accuracy of arithmetic operations, workload constraints, and computational speed requirements, and a processor implementing an embodiment of the present invention may determine how to meet these QoS requirements. For example, the processor may determine: (1) how many integers; (2) the bit length of each of the integers; (3) whether the integers are signed or unsigned; and / or (4) how many items are used to perform the arithmetic operation. The determination may be based on the received instruction. In addition to two or more operands that each contain arrays of data elements, the instruction may also specify one or more operands that specify one or more of (1) to (4). Note that determining (1) to (2) also contributes to the calculation of the ratio discussed above in Example 1 herein.

[0091] In some embodiments, the determination made by the processor may also be determined internally without being specified by instructions. The processor may determine (1) to (4) based on available computing resources (e.g., available circuitry, required bandwidth, and / or storage space in registers / cache / memory for the required arithmetic operations). Note that the internal arithmetic operations, including conversions and reconstructions, are not visible to applications using some embodiments of the present invention.

[0092] With optional adjustments in some embodiments of the present invention, an application may have more options than previously discussed: use floating point in arithmetic operations (which may be accurate but slow); use quantization to quantize each floating point value to a single integer (which may be inexact but fast); or use quantization to quantize each floating point value to multiple integers, run integer arithmetic operations, and reconstruct back to floating point (which may be fast and relatively accurate, or even more accurate than the original floating point value). Embodiments of the present invention provide another knob to adjust the workload to adapt the QoS requirements of the application and / or to better utilize the available computing resources of the processor.

[0093] Note that the quantized results in embodiments of the present invention may be stored for out-of-order execution of instructions. For example, if the values ​​of matrix A are quantized in the first instruction, the quantized results may be stored in a register in the PRF. When a subsequent second instruction also uses matrix A, the stored quantized results of matrix A may be obtained from the register, and repeated quantization is not required.

[0094] Accuracy of floating point to integer method compared to previous methods

[0095] As discussed herein above, without embodiments of the present invention, one can perform arithmetic operations with floating points, which can be accurate, but slow. One can also perform arithmetic operations with integers, where each floating point value is quantized with a single integer (in contrast to the use of multiple integers in embodiments of the present invention for quantization), which is less accurate, but faster. On the other hand, using embodiments of the present invention can provide both accuracy and speed, or provide a desired compromise of accuracy and speed. Testing using pseudo-random values ​​confirms features of embodiments of the present invention.

[0096] Figure 3 The data accuracy of an embodiment of the present invention using a floating point to multiple integer approach is shown compared to the previous approach. The input data is a single precision pseudo-random value between [0,1]. The x-axis is the number of consecutive dot products performed (which can be called the problem size), and the y-axis is the accuracy of the resulting data. As one would expect, the more dot products are performed in a sequence, the less accurate the resulting data will be, because each floating point dot product can only hold a limited number of bits. For example, FP32 has 24 bits for significant digit precision, so dot product results with more than 24 bits are truncated, resulting in lower accuracy. As more results are accumulated on the axis from left to right, less accurate resulting data is shown.

[0097] The baseline accuracy of the dot product is shown at marker 302. The data is not quantized, and the dot product is performed using FP32 input data. The accuracy of this dot product is better than the accuracy shown at marker 304, where each data is quantized to a single int16 integer. This is not surprising considering the accuracy lost due to quantization.

[0098] Mark 306 shows the accuracy of the dot product using an embodiment of the present invention, where each value is quantized into two int16 integers. The accuracy of the embodiment of the present invention is not only better than quantization to a single value, but also better than no quantization. The improvement of the embodiment of the present invention over the no quantization method can be attributed to the intermediate error when running FP32 dot products in the latter. In this example, the intermediate result of the first dot product is the input to the second dot product, and the intermediate result of the second dot product is the input to the third dot product. Each of the intermediate results of the dot product truncates multiple bits, so some accuracy is lost. In contrast, in the former, since the int16 integers are accumulated into a wider accumulation field (for example, in this example, a 64-bit dot product), the product is completed without loss of accuracy.

[0099] That is, some embodiments of the present invention lose accuracy during the initial quantization, but thereafter perform the dot product as an integer dot product, and the intermediate results are integers, and these integers are stored in an accumulator with a sufficiently long bit width, thereby not resulting in a cumulative loss of accuracy. In general, in some embodiments of the present invention, when an arithmetic operation includes a series of operations, the intermediate results are stored using a bit width that is long enough without losing accuracy. For example, the first intermediate result of the first dot product of two int16s will be stored in a 32-bit (or longer) accumulation field, and the next intermediate result of the dot product between (1) the first intermediate result and (2) the third int16 value will be stored in a 48-bit (or longer) accumulation field. Since chaining arithmetic operations does not lose accuracy in these embodiments of the present invention, the advantages of these embodiments of the present invention are more obvious when a large number of arithmetic operations are performed sequentially.

[0100] Convert each from floating point to multiple lower precision floats

[0101] Similar to conversion from floating point to integer, embodiments of the present invention include conversion from floating point values, each of which is converted to multiple lower precision floating point values, such as bfloat16.

[0102] Figure 4 Operation according to one embodiment of the present invention is shown: each value is converted from a floating point value to multiple lower precision floating points for arithmetic operations, and the values ​​resulting from these arithmetic operations are reconstructed back to floating point. This example converts FP32 values ​​to bfloat16, but of course other conversions from higher precision floating points to lower precision floating points can also use embodiments of the present invention.

[0103] Operation begins at reference 402 and is similar to Figure 1The operation at mark 102 in is similar, so the relevant discussion is not repeated here. Each value in value is then converted to two values ​​in bfloat16 format. At marks 404 and 406, the values ​​in A and B of FP32 are approximated using the values ​​in bfloat16 format. The values ​​of A1 and B1 (in bfloat16 format) are approximations of the values ​​of A and B (in FP32 format) and have lower precision than the values ​​of A and B because bfloat16 has fewer mantissa bits (8 bits relative to 24 bits) than FP32. As shown at marks 412 and 416, A1 and B1 have values ​​represented by the most significant 8-bit mantissa of the values ​​in A and B. At marks 414 and 416, the remainder of A and B after subtracting A1 and B1 are approximated to A2 and B2, respectively, in bfloat16 format. At markers 422-428, bfloat16 floating point products of two matrix pairs are performed: A1*B1, A1*B2, A2*B1, and A2*B2. Depending on the implementation, the product operations may be performed serially or in parallel. At marker 432, the resulting values ​​from markers 422 to 428 are then reconstructed and converted back to FP32.

[0104] Note that similar to the floating point to integer approach discussed above in this article, the product operation shown at markers 422 to 428 can be accumulated to multiple times the bit length of the input value. The accumulated bit width is wider than the bit width of the input value, so that the accumulation ratio is more accurate than the case where the accumulated bit width is equal to the bit width of the input value. In this example, the two input bfloat16 values ​​(each with 8 bits of effective digit precision) can be accumulated to FP32 (which includes 16 bits of effective digit precision) or more as the arithmetic operation result. For example, the accumulator can store the arithmetic operation result of the product as an FP32 value (with 24 bits of effective digit precision). Therefore, the results of markers 422 to 428 can already be in FP32 format, and the reconstruction can be a simple sum of the results of markers 422 to 428 without converting back. The floating point arithmetic operation hardware circuit (e.g., MAC and / or FMA circuit) that implements such an accumulator / accumulator does not comply with the current IEEE standard, but the mixed precision decomposition of the operation allows embodiments of the present invention to perform arithmetic operations with higher precision.

[0105] and Figure 1Similar to the arithmetic operations in , the processor performs four arithmetic operations, each bfloat16 calculation has a computational complexity of O(mnk) (k products for m×n data elements), and then the processor performs a conversion back to FP32, which has a computational complexity of O(mnk) for FP32 floating point calculations. The computational complexity of arithmetic operations using bfloat16 (which has four times the O(mnk)) appears to be worse than the computational complexity of arithmetic operations using FP32 (which is O(mnk)). However, arithmetic circuits dedicated to bfloat16 arithmetic operations can be used to perform the matrix arithmetic operations at marks 422-428, and these bfloat16 arithmetic circuits can be run one or more orders of magnitude faster than classic floating point hardware units / circuits using FP32. Therefore, by performing Figure 4 The operations in (including converting FP32 values ​​into multiple bfloat16 values ​​each, then using bfloat16 to perform arithmetic operations, and then converting back to FP32 values) can be more efficient than performing arithmetic operations on FP32 values.

[0106] Note that the conversion to lower precision values, the performance of arithmetic operations, and the reconstruction may not conform to an Institute of Electrical and Electronics Engineers (IEEE) standard for value representation, such as IEEE 754. However, this series of arithmetic operations on lower precision values ​​may utilize arithmetic hardware units.

[0107] Example 6 and Example 7: Convert an FP32 value to multiple bfloat16 values ​​and reconstruct an FP32 value from multiple bfloat16 values

[0108] exist Figure 4 In the example, each FP32 value in matrix A and matrix B is converted to two bfloat16 values. Figure 5A Pseudo code for converting an FP32 value into two bfloat16 values ​​according to one embodiment of the present invention is shown. At reference 502, the FP32 value x is approximated using the bfloat16 value b1. At reference 504, the remainder of x minus b1 is set to the FP32 value tmp. Subsequently, at reference 506, the FP32 value tmp is approximated using the bfloat16 value b2. Figure 4 As discussed, these two bfloat16 values ​​b1 and b2 are then used for arithmetic operations between arrays (1D or 2D).

[0109] Once the arithmetic operation is completed, a bfloat16 value may be returned. For example, the operations at references 422 to 428 may result in bfloat16 values ​​(in some embodiments, these results may already be FP32 and reconstruction does not require conversion back as discussed above herein), and these bfloat16 values ​​may be converted back to FP32 format. Figure 5B Pseudo code for constructing an FP32 value from two bfloat16 values ​​according to one embodiment of the present invention is shown. As shown at reference 510, the construction of the FP32 value x is simply the addition of two bfloat16 values ​​stored in FP32 format.

[0110] Adjusting workload and accuracy: floating point to lower precision floating point

[0111] Although Figure 4-5B The conversion of one FP32 value to two bfloat16 values ​​is shown, but it is obvious that one can convert the FP32 value to more than two bfloat16 values. The difference in using different numbers of bfloat16 values ​​for each FP32 value is the computational complexity. Similar to the floating point to multiple integers approach discussed in this article, when Figure 4 As shown in , splitting each FP32 value into two bfloat16 values ​​results in four times the number of multiplications, splitting each FP32 value into three bfloat16 values ​​results in nine times the number of multiplications, and splitting each FP32 value into four bfloat16 values ​​results in 16 times the number of multiplications. If we sacrifice some accuracy in the arithmetic operations, we can skip some of the multiplication workload.

[0112] For example, we can reference the four inner products of a bfloat16 multiplication as follows:

[0113] bx2_4p: given by A1*B1+A1*B2+A2*B1+A2*B2

[0114] Among them, "bx" indicates a bfloat16 operation, "2" indicates that each FP32 value is split into two bfloat16 values, and "4p" indicates that four terms are included in the calculation.

[0115] To reduce the workload, we can skip the lower-order terms A2*B2, so that the workload becomes the following:

[0116] bx2_3p: given by A1*B1+A1*B2+A2*B1

[0117] Similarly, the workload for splitting each FP32 value into three bfloat16 values ​​can be shown as follows:

[0118] bx3_9p: given by A1*B1+A1*B2+A1*B3+A2*B1+A2*B2+A2*B3+A3*B1+A3*B2+A3*B3

[0119] One can reduce the workload by skipping the lowest order terms A3*B3 (i.e., skipping the terms with coefficients that add to 6):

[0120] bx3_8p: given by A1*B1+A1*B2+A1*B3+A2*B1+A2*B2+A2*B3+A3*B1+A3*B2

[0121] The workload can be further reduced by discarding the additional terms A3*B2 and A2*B3 with coefficients added to 5 and obtaining bx3_6p. This process can continue. By discarding more terms, the workload is reduced, which can increase the calculation speed and / or reduce the use of computing resources at the expense of reducing the accuracy of the calculation. Table 3 shows a list of exemplary terms selected when converting values ​​from FP32 to bfloat16 or int8.

[0122] Table 3. Example item selection for conversion from FP32 to bfloat16 and int8

[0123]

[0124]

[0125] An application using an embodiment of the present invention may determine one or more quality of service (QoS) requirements for accuracy of arithmetic operations, workload constraints, and computational speed requirements, and a processor implementing an embodiment of the present invention may determine how to meet these QoS requirements. For example, the processor may determine: (1) what lower precision floating point format to use (e.g., bfloat16 or other lower precision format relative to the original floating point format); (2) how many lower precision floating point values ​​to use to convert the original floating point format; and / or (3) how many items to use to perform the arithmetic operation. This determination may be based on the received instruction. In addition to two or more operands each containing arrays of data elements, the instruction may also specify one or more operands indicating one or more of (1) to (3).

[0126] In some embodiments, the determination made by the processor may also be determined internally without being specified by instructions. The processor may determine (1) to (3) based on available computing resources (e.g., available circuitry, required bandwidth, and / or storage space in registers / cache / memory for the required arithmetic operations). Note that the internal arithmetic operations, including conversions and reconstructions, are not visible to applications using these embodiments of the present invention.

[0127] With optional adjustments in some embodiments of the present invention, applications may have more than the two options previously discussed: use raw floating point in arithmetic operations (which may be accurate, but slow); or convert each raw floating point value to multiple lower precision floating point values, run integer arithmetic operations, and reconstruct back to floating point in the raw floating point format (which may be fast and relatively accurate, or even more accurate). Embodiments of the present invention provide another knob to adjust the workload to adapt to the QoS requirements of the application and / or to better utilize the available computing resources of the processor.

[0128] Note that the intermediate results in embodiments of the present invention may be stored for out-of-order execution of instructions. For example, if in a first instruction the value of matrix A is split into two floating point values ​​of lower precision (e.g., Figure 4 If A1 and A2 in , these lower precision floating point values ​​can be stored in registers in the PRF (or in cache or memory). When a subsequent second instruction also uses matrix A, the stored lower precision floating point values ​​of matrix A can be obtained from the registers, and repeated quantization is not required.

[0129] Floating point to multiple lower precision floating point methods are more accurate than previous methods

[0130] As discussed above herein, in the absence of embodiments of the present invention, people can run arithmetic operations with original floating point format, which can be accurate, but slow. People can also run arithmetic operations with floating point format of lower precision, wherein using floating point value of lower precision to approximate each original floating point value (in contrast with multiple floating point values ​​of lower precision used for single original floating point value in embodiments herein), which is less accurate, but fast. On the other hand, using embodiments of the present invention can provide both accuracy and speed, or provide expected accuracy and speed compromise. Tests using pseudo-random values ​​confirm the features of embodiments of the present invention.

[0131] Figure 6 The data accuracy of an embodiment of the present invention using floating point to multiple lower precision floating point methods is shown compared to previous methods. Figure 6 The layout and Figure 3 The layout of is similar to , and as explained at mark 650 , the raw data is FP64 pseudo-random values ​​in the range [-1.0, 1.0].

[0132] The baseline accuracy of the original FP32 dot product (as measured by FP64 accuracy) is shown at marker 602. Figure 3Similarly, the more consecutive dot products are performed, the less accurate the result, and the curve moves toward being less accurate (upward from left to right in the figure) as the problem size increases. In contrast, each FP32 value can be converted to a single bfloat16 value, and due to the lower precision of bfloat16, the accuracy curve at marker 604 is significantly worse than the accuracy curve for FP32, as explained at marker 652.

[0133] One can convert each FP32 value into two bfloat16 values, and use all four terms of the dot product (similar to the four terms discussed above: A1*B1, A1*B2, A2*B1, and A2*B2) The accuracy curve at the mark 612, labeled as bx2_4p, is the result. The dot product can skip the lowest order terms (e.g., A2*B2), which results in the accuracy curve at the mark 614 (labeled as bx2_3p). It can be understood that the accuracy of the bx2_4p point is better than the accuracy of bx2_3p, and both are not as accurate as the FP32 baseline. The worse accuracy of bx2 relative to the baseline is also logical, because each bfloat16 has 8 bits of significant digit precision, and the two bfloat16s have a total of 16 bits of significant digit precision. In contrast, each FP32 has 24 bits of significant digit precision, so using two bfloat16 values ​​to represent one FP32 value will result in a significant loss of accuracy. The accuracy loss in the initial conversion leads to a lower overall conversion and reconstruction accuracy than the baseline.

[0134] One can also split each FP32 into three bfloat16s and use all nine terms of the dot product (similar to the four terms discussed above: A1*B1, A1*B2, A1*B3, A2*B1, A2*B2, A2*B3, A3*B1, A3*B2, and A3*B3). The accuracy curve at mark 622, labeled bx3_9p, is the result. The dot product can skip the lowest order terms whose coefficients add to 5 or more to get six terms (i.e., discarding A3*B2, B2*A3, and A3*B3), which leads to the accuracy curve at mark 624 (labeled bx3_6p). It can be understood that the accuracy of the bx3_9p point is better than that of bx3_6p.

[0135] However, it seems counterintuitive that the accuracy of both bx3_9p and bx3_6p is shown to be better than the baseline accuracy of FP32. Upon further examination, this accuracy improvement is also logical. The three bfloat16s have a total of 24 bits of significant digit precision, so the conversion from the FP32 value (which also has 24 bits of significant digit precision) to the three bfloat16 values ​​does not lose accuracy. During the continuous dot products using the original FP32 values, the intermediate errors are as described above in this article about Figure 3In contrast, the conversion from the FP32 value to the three bfloat16 values ​​can be performed without loss of accuracy, and the dot product using bfloat16 can maintain better accuracy during the intermediate arithmetic operations because the accumulator used for the intermediate arithmetic operation results has a bit width that is multiple times the bit width of the input value (e.g., 8 bits of significant digit precision of the input bfloat16 value versus 24 bits of significant digit precision of the FP32 accumulator used to store the intermediate arithmetic operation results). Therefore, the accuracy of bx3_9p and bx3_6p is better than that of the original FP32. In that case, embodiments of the present invention can achieve both better accuracy and fast execution speed (assuming that the dedicated bfloat16 runs one or more orders of magnitude faster than FP32).

[0136] Some embodiments of the present invention

[0137] Fig. 7A 700 is a flow chart illustrating an arithmetic operation according to one embodiment of the present invention, the arithmetic operation comprising: converting a floating point value into a plurality of values ​​of lower precision, and reconstructing the value obtained from the arithmetic operation back into a floating point. The method 700 may be performed on a processor comprising a decoding circuit and an execution circuit. At mark 702, the decoding circuit decodes an instruction, wherein the instruction specifies the location of a plurality of operands, and the values ​​of the operands are in a floating point format. The instruction may specify at least two operands, each operand including one or more parameters for performing an arithmetic operation on a data element. The operation code (opcode) of the instruction may indicate the arithmetic operation to be performed. In addition, the operation code and / or the operand may indicate that the values ​​of the plurality of operands are in a floating point format.

[0138] For example, each operand in the operand may indicate a vector (1D array), a matrix (2D array) in a floating point format. Each operand may also indicate a multidimensional tensor (a geometric object describing the linear relationship between geometric vectors, scalars and other tensors) or a scalar also in a floating point format. The floating point format may be one of standard FP16, FP32, FP64, FP128 or FP256, or may be a proprietary floating point format with its own definition of exponent width, significant digit precision and / or sign bit. Each vector or matrix may contain multiple data elements, each of which is stored in one or more storage units such as registers, caches or computer memories. The operand may point to the location of a storage unit (e.g., a memory, cache or register) so that a decoding circuit may obtain the data elements of a vector or matrix. The arithmetic operation may be one or more of addition, subtraction, multiplication and division of data elements.

[0139] In one embodiment, one or more additional operands may specify one or more quality of service (QoS) requirements for the arithmetic operation. The QoS requirement may be one or more of the following: accuracy of the arithmetic operation (the level of accuracy required by the instruction that is expected to be maintained after the arithmetic operation), workload constraints (computational resources expected to be consumed during the arithmetic operation), computational speed requirements (execution time expected to complete the arithmetic operation). In one embodiment, the QoS requirements determine how the execution circuit executes the decoded instructions. Alternatively or additionally, in one embodiment, the opcode may specify one or more quality of service (QoS) requirements for the arithmetic operation. In addition, the opcode and one or more additional operands may specify an accumulated bit length for storing the result of the arithmetic operation (e.g., as discussed above in this document, as a multiple of the bit length of the input value).

[0140] At mark 704, the execution circuit executes the decoded instruction. The execution includes: at mark 712, for each operand conversion value, each value is converted to a plurality of lower precision values, wherein an exponent is stored for each operand. The exponent for each operand may be stored in a register, a cache, or a memory. In one embodiment, the value of lower precision is in integer format, such as int4, int8, int16, int32, int64, int128, or another n-bit integer. The integer format has fewer bits than the effective digit precision of the floating-point format used by a vector or matrix. In another embodiment, the value of lower precision is another floating-point format, and the other floating-point format has fewer bits than the effective digit precision of the floating-point format used by a vector or matrix. When the value of lower precision is the other floating-point format of lower precision, the stored exponent is one of the values ​​of the lower precision for the operand.

[0141] In one embodiment, the number of converted lower precision values ​​for each value may depend on the number of additional operations required for the QoS. For example, when the accuracy of the arithmetic operation is expected to be high, each value may be converted to more lower precision values ​​(e.g., each A may be converted to A1, A2, and A3 instead of A1, A2, and A3). Figure 1 and Figure 4 ). In addition, each value may be converted to more values ​​of lower precision when more computing resources are available for execution. In addition, each value may be converted to fewer values ​​of lower precision when the expected execution time is short (e.g., below a specified threshold or general indication of fast execution).

[0142] Execution further includes, at reference 714, performing an arithmetic operation between lower precision values ​​converted from the values ​​of the plurality of operands. The arithmetic operation includes Figure 1 and Figure 4, and discussed in the relevant paragraphs above in this document. The arithmetic operation may be performed in a circuit dedicated to a particular arithmetic operation. For example, when the execution circuit includes one or more dedicated multiplier-accumulator (MAC) circuits, the one or more dedicated MAC circuits are used to perform integer multiplication-accumulation operations. In one embodiment, each MAC circuit is a fused multiply-add (FMA) circuit. In one embodiment, the circuit may be dedicated to low-precision floating point values ​​in bfloat16 format. For example, dedicated circuits have been built for bfloat16 arithmetic operations in machine learning (ML) and artificial intelligence (AI) applications.

[0143] In one embodiment, the number of arithmetic operations may depend on the number of additional operations required for the QoS. For example, when the accuracy of the arithmetic operations is expected to be high, more arithmetic operations are performed; and when the accuracy of the arithmetic operations is expected to be low, some operations are skipped (e.g., Figure 1 In contrast, the lowest order may be skipped, resulting in lower accuracy, when the inner product of four terms is performed in order to obtain high accuracy. In addition, when the computational resources consumed are expected to be high, more arithmetic operations are performed. In addition, when the expected execution time is short (below a specified threshold or general indication of fast execution), some operations (e.g., Figure 6 As shown in , bx3_8p is executed instead of bx3_9p to skip the arithmetic operation on the lowest-order term).

[0144] Execution additionally includes, at reference 716, generating a floating point value by converting the value resulting from the arithmetic operation to a floating point format and storing the floating point value. The generation of the floating point value includes Figure 1 and Figure 4 , and the reconstruction discussed in the relevant paragraphs above in this article. The floating point value can be stored in a location specified by the instruction (e.g., memory, cache, or register). In one embodiment, the floating point value is stored in the location where the input operand is stored.

[0145] Figure 7B is a flow chart illustrating a value conversion from a floating point value to a plurality of lower precision values ​​according to one embodiment of the present invention. The operation may be in Fig. 7A An embodiment of the operation in mark 712.

[0146] When value conversion is used to convert each value to an integer, each value in floating point format is quantized at reference 722. The quantization includes determining, at reference 732, an exponent for the operand based on a value range of the value and a plurality of integer values.

[0147] In one embodiment, quantization includes: determining an exponent for an operand based on a value range of the value and a plurality of lower precision values, each of the plurality of lower precision values ​​being an integer value, at 732. Each value is then quantized to an integer value (e.g., the value num in Examples 1-4) based on the value range at reference 734. Quantization is discussed in more detail herein above with respect to Examples 1-4.

[0148] In one embodiment, the instruction may have one or more operands indicating a range of values ​​for each operand indicating a value in a floating point format. Thus, in an embodiment, quantization may use the range of values ​​from the instruction. In another embodiment, the range of values ​​is not provided by the instruction, and the range is determined by examining all values ​​of the operands. For example, the processor may scan all data elements identified by the operands and determine the range for the operands.

[0149] At reference 723, each value (either an original value or a value resulting from quantization of the original value) is identified using a plurality of bits including at least a first plurality of bits and a second plurality of bits. At reference 724, a first plurality of bits of the plurality of bits for a first lower precision value are identified to approximate each value; and at reference 724, a second plurality of bits for a second lower precision value that does not overlap with the first plurality of bits are identified to represent the remainder of the approximation of the first lower precision value, wherein the first lower precision value and the second lower precision value are used to perform an arithmetic operation with lower precision values ​​from one or more other operands. Figure 1-2E An example of identifying a first plurality of bits and a second plurality of bits for conversion to an integer format is provided, and Figure 4-5B A similar example is provided for converting to lower precision floating point.

[0150] Using embodiments of the present invention, general matrix-matrix multiplication (GEMM) and other vector / matrix arithmetic operations can be run more efficiently and with adjustable accuracy options. The conversion and reconstruction methods in embodiments of the present invention can be applied to machine learning (ML) and artificial intelligence (AI), high performance computing (HPC) applications and other applications. For example, the original values ​​in vectors and matrices can be converted to values ​​of lower precision, and these lower precision values ​​are used to perform arithmetic operations. When dedicated hardware circuits are implemented for these arithmetic operations, arithmetic operations can be run one or more orders of magnitude faster than the original values. Lower precision values ​​can use hardware circuits to generate weights for neural networks, and they can also use the same or different hardware circuits to generate input values ​​for activation functions. Once the arithmetic operation utilizes the hardware circuit, the resulting value can then be converted back to the original floating point format.

[0151] Furthermore, in some computer architectures, it may be expensive and impractical to use hardware circuitry to perform arithmetic operations in a higher precision floating point format (e.g., FP128, FP256, etc.). Embodiments of the present invention may convert each of the values ​​in the higher precision floating point format to a number of lower precision formats (e.g., int4, int8, bfloat16) and perform arithmetic operations in the lower precision format. The results in the lower precision format may then be reconstructed into a higher precision floating point format, such as in Figure 1-7B Therefore, embodiments of the present invention can alleviate the need to build hardware circuits to perform arithmetic operations in higher precision floating point formats.

[0152] Exemplary Processor Architectures and Data Types

[0153] Fig. 8A is a block diagram illustrating both an exemplary in-order pipeline and an exemplary register-renaming, out-of-order issue / execution pipeline of embodiments of the present invention. Figure 8B is a block diagram illustrating both an exemplary embodiment of an in-order architecture core and an exemplary register renaming, out-of-order issue / execution architecture core to be included in a processor in accordance with embodiments of the present invention. Figure 8A-B The solid line boxes in show an in-order pipeline and in-order core, while the optional addition of dashed line boxes shows a register-renaming, out-of-order issue / execution pipeline and core. Considering that the in-order aspect is a subset of the out-of-order aspect, the out-of-order aspect will be described.

[0154] exist Fig. 8A , processor pipeline 800 includes fetch stage 802, length decode stage 804, decode stage 806, allocation stage 808, rename stage 810, schedule (also called dispatch or issue) stage 812, register read / memory read stage 814, execute stage 816, write back / memory write stage 818, exception handling stage 822, and commit stage 824. Each stage may include circuitry for performing operations in the stage, and the circuitry may be referred to as fetch circuitry, decode circuitry, schedule circuitry, execute circuitry, etc. to indicate that hardware circuitry is used to implement the stages.

[0155] Figure 8B A processor core 890 is shown, which includes a front end unit 830, which is coupled to an execution engine unit 850, and both the front end unit 830 and the execution engine unit 850 are coupled to a memory unit 870. The core 890 can be a reduced instruction set computing (RISC) core, a complex instruction set computing (CISC) core, a very long instruction word (VLIW) core, or a hybrid or alternative core type. As another option, the core 890 can be a special-purpose core, such as, for example, a network or communication core, a compression engine, a coprocessor core, a general-purpose computing graphics processing unit (GPGPU) core, a graphics core, and the like.

[0156] The front end unit 830 includes a branch prediction unit 832, which is coupled to an instruction cache unit 834, which is coupled to an instruction translation lookaside buffer (TLB) 836, which is coupled to an instruction fetch unit 838, which is coupled to a decode unit 840. The decode unit 840 (or decoder) can decode the instruction and generate one or more micro-operations, microcode entry points, microinstructions, other instructions, or other control signals decoded from the original instruction, or otherwise reflecting the original instruction, or derived from the original instruction as output. The decode unit 840 can be implemented using a variety of different mechanisms. Examples of suitable mechanisms include, but are not limited to, lookup tables, hardware implementations, programmable logic arrays (PLA), microcode read-only memories (ROMs), etc. In one embodiment, the core 890 includes a microcode ROM or other medium (e.g., in the decode unit 840, or otherwise within the front end unit 830) that stores microcode for certain macroinstructions. Decode unit 840 is coupled to rename / allocator unit 852 in execution engine unit 850 .

[0157] The execution engine unit 850 includes a rename / allocator unit 852 coupled to a retirement unit 854 and a set 856 of one or more scheduler units. The scheduler unit(s) 856 represent any number of different schedulers, including reservation stations, central instruction windows, etc. The scheduler unit(s) 856 are coupled to physical register file(s) units 858. Each of the physical register file(s) units 858 represents one or more physical register files, where different physical register files store one or more different data types, such as scalar integers, scalar floating points, packed integers, packed floating points, vector integers, vector floating points, status (e.g., an instruction pointer as the address of the next instruction to be executed), etc. In one embodiment, the physical register file(s) units 858 include a vector register unit, a write mask register unit, and a scalar register unit. These register units may provide architectural vector registers, vector mask registers, and general purpose registers. The physical register file(s) unit 858 is overlapped by the retirement unit 854 to illustrate various ways in which register renaming and out-of-order execution may be implemented (e.g., using reorder buffer(s) and retirement register file(s); using future files(s), history buffer(s), retirement register file(s); using register maps and register pools, etc.). The retirement unit 854 and the physical register file(s) unit 858 are coupled to the execution cluster(s) 860. The execution cluster(s) 860 include a set 862 of one or more execution units and a set 864 of one or more memory access units. The execution unit 862 may perform various operations (e.g., shifts, additions, subtractions, multiplications) and may perform on various data types (e.g., scalar floating point, packed integer, packed floating point, vector integer, vector floating point). While some embodiments may include multiple execution units dedicated to a particular function or set of functions, other embodiments may include only one execution unit or multiple execution units that all perform all functions. Scheduler unit(s) 856, physical register file(s) units 858, and execution cluster(s) 860 are shown as potentially multiple, as some embodiments create separate pipelines for certain types of data / operations (e.g., scalar integer pipelines, scalar floating point / packed integer / packed floating point / vector integer / vector floating point pipelines, and / or memory access pipelines each with its own scheduler unit, physical register file(s) units, and / or execution cluster—and in the case of separate memory access pipelines, certain embodiments are implemented where only the execution cluster of that pipeline has memory access unit(s) 864). It should also be understood that where separate pipelines are used, one or more of these pipelines may be out-of-order issue / execution, and the rest may be in-order.

[0158] A set of memory access units 864 is coupled to a memory unit 870, which includes a data TLB unit 872, which is coupled to a data cache unit 874, which is coupled to a second level (L2) cache unit 876. In an exemplary embodiment, the memory access unit 864 may include a load unit, a store address unit, and a store data unit, each of which is coupled to the data TLB unit 872 in the memory unit 870. The instruction cache unit 834 is also coupled to a second level (L2) cache unit 876 in the memory unit 870. The L2 cache unit 876 is coupled to one or more other levels of cache and ultimately to the main memory.

[0159] As an example, an exemplary register renaming out-of-order issue / execution core architecture may implement pipeline 800 as follows: 1) instruction fetch 838 performs fetch stage 802 and length decode stage 804; 2) decode unit 840 performs decode stage 806; 3) rename / allocator unit 852 performs allocation stage 808 and rename stage 810; 4) (multiple) scheduler units 856 perform scheduling stage 812; 5) (multiple) physical register file units 858 and memory units 870 perform register read / memory read stage 814; execution cluster 860 performs execution stage 816; 6) memory unit 870 and (multiple) physical register file units 858 perform write back / memory write stage 818; 7) each unit may be involved in an exception handling stage 822; and 8) retirement unit 854 and (multiple) physical register file units 858 perform commit stage 824.

[0160] Core 890 may support one or more instruction sets (e.g., the x86 instruction set (with some extensions that have been added with newer versions); the MIPS instruction set of MIPS Technologies, Inc. of Sunnyvale, California; the ARM instruction set of ARM Holdings, Inc. of Sunnyvale, California (with optional additional extensions such as NEON)), including the instruction(s) described herein. In one embodiment, core 890 includes logic to support packed data instruction set extensions (e.g., AVX1, AVX2, Advanced Matrix Extensions (AMX), and / or some form of the generic vector friendly instruction format (U=0 and / or U=1) described below), thereby allowing operations used by many multimedia applications to be performed using packed data.

[0161] It should be understood that a core may support multithreading (executing a set of two or more operations or threads in parallel), and that this multithreading may be accomplished in a variety of ways, including time-division multithreading, simultaneous multithreading (where a single physical core provides a logical core for each of the threads that the physical core is simultaneously multithreading), or a combination thereof (e.g., time-division fetching and decoding and subsequent operations such as Hyper-Threading (Simultaneous Multithreading).

[0162] Although register renaming is described in the context of out-of-order execution, it should be understood that register renaming can be used in an in-order architecture. Although the illustrated embodiment of the processor also includes separate instruction and data cache units 834 / 874 and a shared L2 cache unit 876, alternative embodiments may have a single internal cache for both instructions and data, such as, for example, a first level (L1) internal cache or multiple levels of internal cache. In some embodiments, the system may include a combination of internal caches and external caches external to the core and / or processor. Alternatively, all caches may be external to the core and / or processor.

[0163] Fig. 9 is a block diagram of a processor 900 that may have more than one core, may have an integrated memory controller, and may have integrated graphics according to an embodiment of the present invention. Fig. 9 The solid line box in the figure illustrates a processor 900 having a single core 902A, a system agent 910, a set 916 of one or more bus controller units, while the optional addition of the dashed line box illustrates an alternative processor 900 having multiple cores 902A-N, a set 914 of one or more integrated memory controller units in the system agent unit 910, and dedicated logic 908 (e.g., integrated graphics logic).

[0164] Thus, different implementations of processor 900 may include: 1) a CPU, where the dedicated logic 908 is integrated graphics and / or scientific (throughput) logic (which may include one or more cores), and cores 902A-N are one or more general purpose cores (e.g., general purpose in-order cores, general purpose out-of-order cores, combinations of the two); 2) a coprocessor, where cores 902A-N are a large number of dedicated cores intended primarily for graphics and / or scientific (throughput); and 3) a coprocessor, where cores 902A-N are a large number of general purpose in-order cores. Thus, processor 900 may be a general purpose processor, a coprocessor, or a dedicated processor, such as, for example, a network or communication processor, a compression engine, a graphics processor, a GPGPU (general purpose graphics processing unit), a high throughput integrated many-core (MIC) coprocessor (including 30 or more cores), an embedded processor, and the like. The processor may be implemented on one or more chips. Processor 900 may be part of one or more substrates, and / or may be implemented on one or more substrates using any of a variety of process technologies (such as, for example, BiCMOS, CMOS, or NMOS).

[0165] The memory hierarchy includes one or more levels of cache within the core, a set of one or more shared cache units 906, and external memory (not shown) coupled to a set of integrated memory controller units 914. The set of shared cache units 906 may include one or more intermediate levels of cache, such as a second level (L2), a third level (L3), a fourth level (L4), or other levels of cache, a last level cache (LLC), and / or a combination of the above. Although in one embodiment, a ring-based interconnect unit 912 interconnects the dedicated logic 908, the set of shared cache units 906, and the system agent unit 910 / (multiple) integrated memory controller units 914, alternative embodiments may use any number of well-known techniques to interconnect such units. In one embodiment, coherency is maintained between the one or more cache units 906 and the cores 902A-N.

[0166] In some embodiments, one or more cores 902A-N may be multithreaded. System agent 910 includes those components that coordinate and operate cores 902A-N. System agent unit 910 may include, for example, a power control unit (PCU) and a display unit. The PCU may be, or may include, the logic and components required to regulate the power state of cores 902A-N and integrated graphics logic 908. The display unit is used to drive one or more externally connected displays.

[0167] The cores 902A-N may be homogeneous or heterogeneous in terms of the architectural instruction set; that is, two or more of the cores 902A-N may be capable of executing the same instruction set, while other cores may be capable of executing only a subset of the instruction set or a different instruction set.

[0168] Figure 10-13 is a block diagram of an exemplary computer architecture. Other system designs and configurations known in the art for laptops, desktops, handheld PCs, personal digital assistants, engineering workstations, servers, network devices, network hubs, switches, embedded processors, digital signal processors (DSPs), graphics devices, video game devices, set-top boxes, microcontrollers, cellular phones, portable media players, handheld devices, and various other electronic devices are also suitable. In general, a wide variety of systems or electronic devices that can contain processors and / or other execution logic as disclosed herein are generally suitable.

[0169] Reference now Fig.10 , shown is a block diagram of a system 1000 according to one embodiment of the present invention. The system 1000 may include one or more processors 1010, 1015 coupled to a controller hub 1020. In one embodiment, the controller hub 1020 includes a graphics memory controller hub (GMCH) 1090 and an input / output hub (IOH) 1050 (which may be on separate chips); the GMCH 1090 includes a memory and a graphics controller to which a memory 1040 and a coprocessor 1045 are coupled; and the IOH 1050 couples an input / output (I / O) device 1060 to the GMCH 1090. Alternatively, one or both of the memory and the graphics controller are integrated within a processor (as described herein), the memory 1040 and the coprocessor 1045 are directly coupled to the processor 1010, and the controller hub 1020 and the IOH 1050 are in a single chip.

[0170] The optional nature of the additional processor 1015 is Fig.10 Each processor 1010 , 1015 may include one or more of the processing cores described herein, and may be a version of processor 900 .

[0171] The memory 1040 may be, for example, a dynamic random access memory (DRAM), a phase change memory (PCM), or a combination of the two. For at least one embodiment, the controller hub 1020 communicates with the processor(s) 1010, 1015 via a multi-drop bus such as a front-side bus (FSB), a point-to-point interface such as a Quick Path Interconnect (QPI), or a similar connection 1095.

[0172] In one embodiment, coprocessor 1045 is a special purpose processor such as, for example, a high throughput MIC processor, a network or communication processor, a compression engine, a graphics processor, a GPGPU, an embedded processor, etc. In one embodiment, controller hub 1020 may include an integrated graphics accelerator.

[0173] There may be various differences between processors 1010 , 1015 in terms of a range of quality metrics including architectural, microarchitectural, thermal, power consumption characteristics, etc.

[0174] In one embodiment, processor 1010 executes instructions that control general types of data processing operations. Embedded within these instructions may be coprocessor instructions. Processor 1010 recognizes these coprocessor instructions as being of a type that should be executed by an attached coprocessor 1045. Accordingly, processor 1010 issues these coprocessor instructions (or control signals representing coprocessor instructions) to coprocessor 1045 on a coprocessor bus or other interconnect. Coprocessor(s) 1045 accept and execute the received coprocessor instructions.

[0175] See now Fig.11 , shown is a block diagram of a first more specific exemplary system 1100 according to an embodiment of the present invention. Fig.11 As shown in FIG. 1 , multiprocessor system 1100 is a point-to-point interconnect system and includes a first processor 1170 and a second processor 1180 coupled via a point-to-point interconnect 1150. Each of processors 1170 and 1180 may be a version of processor 900. In one embodiment of the present invention, processors 1170 and 1180 are processors 1010 and 1015, respectively, and coprocessor 1138 is coprocessor 1045. In another embodiment, processors 1170 and 1180 are processor 1010 and coprocessor 1045, respectively.

[0176] Processors 1170 and 1180 are shown as including integrated memory controller (IMC) units 1172 and 1182, respectively. Processor 1170 also includes point-to-point (PP) interfaces 1176 and 1178 as part of its bus controller unit; similarly, second processor 1180 includes PP interfaces 1186 and 1188. Processors 1170, 1180 can exchange information via PP interface 1150 using point-to-point (PP) interface circuits 1178, 1188. Fig.11 As shown in FIG. 1 , IMCs 1172 and 1182 couple the processors to respective memories, namely, memory 1132 and memory 1134 , which may be portions of main memory locally attached to the respective processors.

[0177] Processors 1170, 1180 may each exchange information with a chipset 1190 via respective PP interfaces 1152, 1154 using point-to-point interface circuits 1176, 1194, 1186, 1198. Chipset 1190 may optionally exchange information with a coprocessor 1138 via a high performance interface 1139. In one embodiment, coprocessor 1138 is a special purpose processor such as, for example, a high throughput MIC processor, a network or communication processor, a compression engine, a graphics processor, a GPGPU, an embedded processor, or the like.

[0178] A shared cache (not shown) may be included in either processor, or external to both processors but connected to the processors via the PP interconnect, so that if the processors are placed in a low power mode, local cache information of either or both processors may be stored in the shared cache.

[0179] Chipset 1190 may be coupled to first bus 1116 via interface 1196. In one embodiment, first bus 1116 may be a peripheral component interconnect (PCI) bus or a bus such as a PCI Express bus or another third generation I / O interconnect bus, but the scope of the present invention is not limited in this regard.

[0180] like Fig.11 As shown in , various I / O devices 1114 may be coupled to the first bus 1116 along with a bus bridge 1118 that couples the first bus 1116 to a second bus 1120. In one embodiment, one or more additional processors 1115 such as a coprocessor, a high throughput MIC processor, a GPGPU, an accelerator (such as, for example, a graphics accelerator or a digital signal processing (DSP) unit), a field programmable gate array, or any other processor are coupled to the first bus 1116. In one embodiment, the second bus 1120 may be a low pin count (LPC) bus. In one embodiment, various devices may be coupled to the second bus 1120 including, for example, a keyboard and / or mouse 1122, communication devices 1127, and a storage unit 1128 such as a disk drive or other mass storage device which may include instructions / code and data 1130. Additionally, an audio I / O 1124 may be coupled to the second bus 1120. Note that other architectures are possible. For example, instead of Fig.11 Instead of a point-to-point architecture, the system may implement a multi-drop bus or other such architecture.

[0181] Reference now Fig.12 , shown is a block diagram of a second more specific exemplary system 1200 according to an embodiment of the present invention. Fig.11 and 12Similar elements in the same reference numerals are used, and Fig.12 Omitted Fig.11 to avoid confusion Fig.12 other aspects.

[0182] Fig.12 Processors 1270, 1280 are shown to include integrated memory and I / O control logic ("CL") 1272 and 1282, respectively. Thus, CL 1272, 1282 includes an integrated memory controller unit and includes I / O control logic. Fig.12 The illustration shows that not only the memories 1232, 1234 are coupled to the CLs 1272, 1282, but also the I / O devices 1214 are coupled to the control logic 1272, 1282. The legacy I / O devices 1215 are coupled to the chipset 1290.

[0183] Reference now Fig.13 , shown is a block diagram of a SoC 1300 according to an embodiment of the present invention. Fig. 9 Similar elements in the same figure are marked with similar reference numerals. In addition, the dashed boxes are optional features on more advanced SoCs. Fig.13 , interconnect unit(s) 1302 are coupled to: application processor 1310, which includes a set of one or more cores 902A-N and a shared cache unit(s) 906; system agent unit 910; bus controller unit(s) 916; integrated memory controller unit(s) 914; a set of one or more coprocessors 1320, which may include integrated graphics logic, image processors, audio processors, and video processors; static random access memory (SRAM) unit 1330; direct memory access (DMA) unit 1332; and a display unit 1340 for coupling to one or more external displays. In one embodiment, coprocessor(s) 1320 include special purpose processors such as, for example, network or communication processors, compression engines, GPGPUs, high throughput MIC processors, or embedded processors, among others.

[0184] The various embodiments of the mechanisms disclosed herein may be implemented in hardware, software, firmware, or a combination of such implementations. Embodiments of the present invention may be implemented as a computer program or program code executed on a programmable system, the programmable system comprising at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0185] Program code (such as Fig.11The code 1130 shown in FIG. 11 is applied to the input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor, such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0186] The program code can be implemented with a high-level process-oriented programming language or an object-oriented programming language to communicate with the processing system. If necessary, the program code can also be implemented with assembly language or machine language. In fact, the mechanism described herein is not limited to the scope of any specific programming language. In any case, the language can be a compiled language or an interpreted language.

[0187] One or more aspects of at least one embodiment may be implemented by representative instructions stored on a machine-readable medium that represents various logic within a processor, which when read by a machine causes the machine to fabricate logic for performing the techniques described herein. Such representations, known as "IP cores," may be stored on a tangible, machine-readable medium and supplied to various customers or manufacturing facilities to load into fabrication machines that actually fabricate the logic or processor.

[0188] Such machine-readable storage media may include, but are not limited to, a non-transitory, tangible arrangement of an article manufactured or formed by a machine or apparatus, including storage media such as a hard disk; any other type of disk, including floppy disks, optical disks, compact disk-read only memory (CD-ROM), compact disk-rewritable (CD-RW), digital video / versatile disk (DVD), Blu-ray (BD), and magneto-optical disks; semiconductor devices, such as read-only memory (ROM), random access memory (RAM) such as dynamic random access memory (DRAM) and static random access memory (SRAM), erasable programmable read-only memory (EPROM), flash memory, electrically erasable programmable read-only memory (EEPROM); phase change memory (PCM); magnetic or optical cards; or any other type of medium suitable for storing electronic instructions.

[0189] Therefore, embodiments of the present invention also include non-transitory tangible machine-readable media containing instructions or containing design data, such as hardware description language (HDL), which defines the structures, circuits, devices, processors and / or system features described herein. These embodiments are also referred to as program products.

[0190] In some cases, the instruction converter can be used to convert instructions from a source instruction set to a target instruction set. For example, the instruction converter can convert (e.g., using static binary conversion, dynamic binary conversion including dynamic compilation), deform, simulate or otherwise convert instructions into one or more other instructions to be processed by the core. The instruction converter can be implemented in software, hardware, firmware, or a combination thereof. The instruction converter can be on the processor, outside the processor, or partially on the processor and partially outside the processor.

[0191] Fig.14 1 is a block diagram of a software instruction converter that converts binary instructions in a source instruction set into binary instructions in a target instruction set according to an embodiment of the present invention. In the illustrated embodiment, the instruction converter is a software instruction converter, but alternatively, the instruction converter can be implemented in software, firmware, hardware, or various combinations thereof. Fig.14 It is shown that an x86 compiler 1404 can be used to compile a program in a high-level language 1402 to generate x86 binary code 1406 that can be natively executed by a processor 1416 having at least one x86 instruction set core. The processor 1416 having at least one x86 instruction set core represents any processor that performs substantially the same functions as an Intel processor having at least one x86 instruction set core by compatibly executing or otherwise processing: (1) a substantial portion of the instruction set of an Intel x86 instruction set core, or (2) an object code version of an application or other software that is targeted to run on an Intel processor having at least one x86 instruction set core to achieve substantially the same results as an Intel processor having at least one x86 instruction set core. The x86 compiler 1404 represents a compiler that can be used to generate x86 binary code 1406 (e.g., object code) that can be executed on a processor having at least one x86 instruction set core 1416 with or without additional linking processing. Similarly, Fig.14It is shown that a program in a high-level language 1402 can be compiled using an alternative instruction set compiler 1408 to generate an alternative instruction set binary code 1410 that can be natively executed by a processor 1414 that does not have at least one x86 instruction set core (e.g., a processor that has a core that executes the MIPS instruction set of MIPS Technologies, Inc. of Sunnyvale, California, and / or executes the ARM instruction set of ARM Holdings, Inc. of Sunnyvale, California). The instruction converter 1412 is used to convert the x86 binary code 1406 into code that can be natively executed by the processor 1414 that does not have an x86 instruction set core. The converted code is unlikely to be the same as the alternative instruction set binary code 1410 because an instruction converter that can do so is difficult to manufacture; however, the converted code will complete the general operation and be composed of instructions from the alternative instruction set. Therefore, the instruction converter 1412 represents software, firmware, hardware, or a combination thereof that allows a processor or other electronic device that does not have an x86 instruction set processor or core to execute the x86 binary code 1406 through simulation, emulation, or any other process.

[0192] Example instruction format

[0193] Embodiments of the (multiple) instructions described herein can be embodied in different formats. In addition, exemplary systems, architectures, and pipelines are described in detail below. Embodiments of the (multiple) instructions can be executed on such systems, architectures, and pipelines, but are not limited to those systems, architectures, and pipelines described in detail.

[0194] The vector friendly instruction format is an instruction format suitable for vector instructions (e.g., there are specific fields dedicated to vector operations). Although embodiments are described in which both vector and scalar operations are supported through the vector friendly instruction format, alternative embodiments only use vector operations through the vector friendly instruction format.

[0195] Figure 15A-15B is a block diagram illustrating a general vector friendly instruction format and instruction templates thereof according to an embodiment of the present invention. Fig.15A is a block diagram showing a general vector friendly instruction format and a class A instruction template thereof according to an embodiment of the present invention; and Fig. 15B 1 is a block diagram illustrating a generic vector friendly instruction format and its class B instruction templates according to an embodiment of the present invention. Specifically, class A and class B instruction templates are defined for the generic vector friendly instruction format 1500, both of which include instruction templates without memory access 1505 and instruction templates with memory access 1520. The term "generic" in the context of the vector friendly instruction format refers to an instruction format that is not bound to any particular instruction set.

[0196] Although embodiments of the present invention will be described in which the vector friendly instruction format supports: 64-byte vector operand length (or size) with 32-bit (4-byte) or 64-bit (8-byte) data element width (or size) (and thus, a 64-byte vector consists of 16 doubleword-sized elements, or alternatively, 8 quadword-sized elements); 64-byte vector operand length (or size) with 16-bit (2-byte) or 8-bit (1-byte) data element width (or size); 32-byte vector operand length (or size) with 32-bit (4-byte) or 64-bit (8-byte) data element width (or size); byte), 64-bit (8-byte), 16-bit (2-byte), or 8-bit (1-byte) data element width (or size); and 16-byte vector operand length (or size) with 32-bit (4-byte), 64-bit (8-byte), 16-bit (2-byte), or 8-bit (1-byte) data element width (or size); however, alternative embodiments may support larger, smaller, and / or different vector operand sizes (e.g., 256-byte vector operands) with larger, smaller, or different data element widths (e.g., 128-bit (16-byte) data element width).

[0197] Fig.15A The class A instruction templates include: 1) within the instruction templates with no memory access 1505, there are shown instruction templates for full rounding control type operations 1510 without memory access, and instruction templates for data transformation type operations 1515 without memory access; and 2) within the instruction templates with memory access 1520, there are shown instruction templates for timeliness of memory access 1525 and instruction templates for non-timeliness of memory access 1530. Fig. 15B The Class B instruction templates include: 1) within the instruction template without memory access 1505, there are shown an instruction template for a partial rounding control type operation 1512 with write mask control without memory access and an instruction template for a vsize type operation 1517 with write mask control without memory access; and 2) within the instruction template with memory access 1520, there is shown an instruction template for a write mask control 1527 with memory access.

[0198] The generic vector friendly instruction format 1500 includes the following listed in accordance with Figures 15A-15B The following fields are in the order shown.

[0199] Format field 1540 - The specific value in this field (the instruction format identifier value) uniquely identifies the vector friendly instruction format, and thereby identifies that the instruction appears in the vector friendly instruction format in the instruction stream. Thus, this field is optional in the sense that it is not required for instruction sets that only have a generic vector friendly instruction format.

[0200] Basic operation field 1542 - its content distinguishes different basic operations.

[0201] Register index field 1544 - its content specifies the location of the source or destination operand in a register or in memory, either directly or through address generation. These fields include a sufficient number of bits to select N registers from a PxQ (e.g., 32x512, 16x128, 32x1024, 64x1024) register file. Although in one embodiment N may be up to three source registers and one destination register, alternative embodiments may support more or fewer source and destination registers (e.g., may support up to two sources, one of which is also used as a destination; may support up to three sources, one of which is also used as a destination; may support up to two sources and one destination).

[0202] Modifier field 1546 - its content distinguishes instructions appearing in the generic vector instruction format that specify memory access from instructions appearing in the generic vector instruction format that do not specify memory access; i.e., distinguishes between instruction templates with no memory access 1505 and instruction templates with memory access 1520. Memory access operations read and / or write to the memory hierarchy (in some cases, using values ​​in registers to specify source and / or destination addresses), while non-memory access operations do not (e.g., the source and / or destination are registers). Although in one embodiment, this field also selects between three different ways to perform memory address calculations, alternative embodiments may support more, fewer, or different ways to perform memory address calculations.

[0203] Extended operation field 1550 - its content distinguishes which of various operations are to be performed in addition to the base operation. This field is context specific. In one embodiment of the invention, this field is divided into a class field 1568, an alpha field 1552, and a beta field 1554. The extended operation field 1550 allows multiple common groups of operations to be performed in a single instruction instead of 2, 3, or 4 instructions.

[0204] Scale field 1560 - its content allows for memory address generation (e.g., for use with (2 比例 *The address generated by (index + base address) is scaled proportionally to the contents of the index field.

[0205] Displacement field 1562A - its contents are used as part of memory address generation (e.g., for use with (2 比例 *address generation of (index+base+displacement)).

[0206] Displacement Factor field 1562B (note that the juxtaposition of displacement field 1562A directly over displacement factor field 1562B indicates that one or the other is used) - its contents are used as part of address generation; it specifies the displacement factor by which the size (N) of the memory access will be scaled - where N is the number of bytes in the memory access (e.g., for use with (2 比例 * index + base address + scaled displacement). Redundant low-order bits are ignored, and therefore the contents of the displacement factor field are multiplied by the total size of the memory operand (N) to generate the final displacement that will be used in calculating the effective address. The value of N is determined by the processor hardware at runtime based on the full opcode field 1574 (described herein) and the data manipulation field 1554C. The displacement field 1562A and the displacement factor field 1562B are optional in the sense that they are not used for instruction templates without memory access 1505 and / or different embodiments may implement only one of the two or neither of the two.

[0207] Data element width field 1564 - its contents distinguish which of multiple data element widths will be used (in some embodiments for all instructions; in other embodiments for only some of the instructions). This field is optional in the sense that it is not required if only one data element width is supported and / or some aspect of the opcode is used to support the data element width.

[0208] Write mask field 1570 - its content controls, on a data element position by data element position basis, whether the data element position in the destination vector operand reflects the results of the base and augmented operations. Class A instruction templates support merge-write masking, while class B instruction templates support both merge-write masking and zeroing-write masking. When merged, the vector mask allows any set of elements in the destination to be protected from update during the execution of any operation (specified by the base and augmented operations); in another embodiment, the old value of each element of the destination where the corresponding mask bit has a 0 is maintained. Conversely, when zeroed, the vector mask allows any set of elements in the destination to be zeroed during the execution of any operation (specified by the base and augmented operations); in one embodiment, the elements of the destination are set to 0 when the corresponding mask bit has a 0 value. A subset of this functionality is the ability to control the vector length of the operation being performed (i.e., the span from the first to the last element being modified), however, the elements being modified do not have to be consecutive. Thus, the write mask field 1570 allows partial vector operations, which include loads, stores, arithmetic, logical, etc. Although embodiments of the present invention are described in which the contents of write mask field 1570 select one of multiple write mask registers that contains a write mask to be used (and thereby, the contents of write mask field 1570 indirectly identify the mask to be performed), alternative embodiments alternatively or additionally allow the contents of mask write field 1570 to directly specify the mask to be performed.

[0209] Immediate field 1572 - its contents allow specification of an immediate value. This field is optional in the sense that it is not present in implementations of the generic vector friendly format that do not support immediate values ​​and is not present in instructions that do not use immediate values.

[0210] Class field 1568 - its content distinguishes between instructions of different classes. Figure 15A-15B , the contents of this field select between class A and class B instructions. Figure 15A-15B In , rounded squares are used to indicate that a specific value exists in a field (for example, in Figure 15A-15B Class A 1568A and class B 1568B are used for class field 1568 respectively).

[0211] Class A instruction template

[0212] In the case of the class A non-memory access 1505 instruction templates, the alpha field 1552 is interpreted as an RS field 1552A whose content distinguishes which of the different extended operation types is to be performed (e.g., rounding 1552A.1 and data transformation 1552A.2 are specified for the instruction templates for the no-memory access rounding type operation 1510 and the no-memory access data transformation type operation 1515, respectively), while the beta field 1554 distinguishes which of the specified types of operations is to be performed. In the no-memory access 1505 instruction templates, the scale field 1560, the displacement field 1562A, and the displacement factor field 1562B are not present.

[0213] Instruction templates without memory access - full rounding control type operations

[0214] In the instruction templates of the full rounding control type operation 1510 without memory access, the beta field 1554 is interpreted as a rounding control field 1554A that provides static rounding for its content(s). Although in the described embodiment of the invention the rounding control field 1554A includes a suppress all floating point exceptions (SAE) field 1556 and a rounding operation control field 1558, alternative embodiments may support both concepts, may encode both concepts as the same field, or may have only one or the other of these concepts / fields (e.g., may have only the rounding operation control field 1558).

[0215] SAE field 1556 - its content distinguishes whether exception event reporting is disabled; when the content of SAE field 1556 indicates that suppression is enabled, the given instruction does not report any kind of floating point exception flags and does not invoke any floating point exception handler.

[0216] Round operation control field 1558 - its contents distinguish which of a set of rounding operations is to be performed (e.g., round up, round down, round toward zero, and round to nearest). Thus, the round operation control field 1558 allows the rounding mode to be changed on an instruction-by-instruction basis. In one embodiment of the invention in which the processor includes a control register for specifying the rounding mode, the contents of the round operation control field 1558 override the register value.

[0217] Instruction templates without memory access - data transformation operations

[0218] In the instruction template for the no memory access data transform type operation 1515, the beta field 1554 is interpreted as a data transform field 1554B, the content of which distinguishes which of multiple data transforms is to be performed (eg, no data transform, blend, broadcast).

[0219] In the case of an instruction template of class A memory access 1520, the alpha field 1552 is interpreted as an eviction hint field 1552B, whose content distinguishes which of the eviction hints is to be used (in Fig.15A , the instruction templates for memory access temporal 1525 and memory access non-temporal 1530 specify temporal 1552B.1 and non-temporal 1552B.2, respectively, and the β field 1554 is interpreted as a data manipulation field 1554C, whose content distinguishes which of a plurality of data manipulation operations (also referred to as primitives) is to be performed (e.g., no manipulation, broadcast, up-conversion of the source, and down-conversion of the destination). The instruction template for memory access 1520 includes a scale field 1560, and optionally includes a displacement field 1562A or a displacement factor field 1562B (sometimes referred to as a displacement scale field).

[0220] Vector memory instructions use the conversion support to perform vector loads from memory and vector stores to memory. As with normal vector instructions, vector memory instructions transfer data to / from memory in an element-wise manner, where the actual elements transferred are specified by the contents of the vector mask selected as the writemask.

[0221] Instruction templates for memory accesses - time-sensitive

[0222] Temporal data is data that is likely to be reused quickly enough to benefit from cache operations. However, this is a hint, and different processors can implement it in different ways, including ignoring the hint completely.

[0223] Instruction templates for memory accesses - non-temporal

[0224] Non-temporal data is data that is unlikely to be reused quickly enough to benefit from cache operations in the first level cache and should be given eviction priority. However, this is a hint, and different processors can implement it in different ways, including ignoring the hint completely.

[0225] Class B instruction template

[0226] In the case of a class B instruction template, the alpha field 1552 is interpreted as a write mask control (Z) field 1552C, the content of which distinguishes whether the write mask controlled by the write mask field 1570 should be merge or zero.

[0227] In the case of a class B non-memory access 1505 instruction template, a portion of the beta field 1554 is interpreted as an RL field 1557A, the contents of which distinguish which of the different augmented operation types are to be performed (e.g., the instruction template for the no memory access write mask control partial rounding control type operation 1512 and the instruction template for the no memory access write mask control VSIZE type operation 1317 specify rounding 1557A.1 and vector length (VSIZE) 1557A.2, respectively), while the remainder of the beta field 1554 distinguishes which of the specified types of operations are to be performed. In the no memory access 1505 instruction template, the scale field 1560, the displacement field 1562A, and the displacement factor field 1562B are not present.

[0228] In the instruction template of the write mask control part round control type operation 1510 without memory access, the rest of the β field 1554 is interpreted as the round operation field 1559A, and exception event reporting is disabled (the given instruction does not report any kind of floating point exception flag and does not invoke any floating point exception handler).

[0229] Round operation control field 1559A - As with round operation control field 1558, its contents distinguish which of a set of rounding operations (e.g., round up, round down, round toward zero, and round to nearest) is to be performed. Thus, round operation control field 1559A allows the rounding mode to be changed on an instruction-by-instruction basis. In one embodiment of the invention in which the processor includes a control register for specifying the rounding mode, the contents of round operation control field 1559 override that register value.

[0230] In the instruction template for a write mask control VSIZE type operation 1517 without memory access, the remainder of the β field 1554 is interpreted as a vector length field 1559B, the contents of which distinguish which of multiple data vector lengths (e.g., 128 bytes, 256 bytes, or 512 bytes) is to be executed.

[0231] In the case of a class B memory access 1520 instruction template, a portion of the beta field 1554 is interpreted as a broadcast field 1557B, the content of which distinguishes whether a broadcast-type data manipulation operation is to be performed, and the remainder of the beta field 1554 is interpreted as a vector length field 159B. The memory access 1520 instruction template includes a scale field 1560 and optionally includes a displacement field 1562A or a displacement factor field 1562B.

[0232] For the generic vector friendly instruction format 1500, the full opcode field 1574 is shown to include the format field 1540, the base operation field 1542, and the data element width field 1564. Although one embodiment is shown in which the full opcode field 1574 includes all of these fields, in embodiments that do not support all of these fields, the full opcode field 1574 includes less than all of these fields. The full opcode field 1574 provides an operation code (opcode).

[0233] The augment operation field 1550, data element width field 1564, and write mask field 1570 allow these features to be specified on an instruction-by-instruction basis in the generic vector friendly instruction format.

[0234] The combination of the write mask field and the data element width field creates various types of instructions because these instructions allow the mask to be applied based on different data element widths.

[0235] The various instruction templates that appear within class A and class B are beneficial in different situations. In some embodiments of the present invention, different processors or different cores within a processor may support only class A, only class B, or both classes. For example, a high-performance general purpose out-of-order core intended for general purpose computing may support only class B, a core intended primarily for graphics and / or scientific (throughput) computing may support only class A, and a core intended for both general purpose computing and graphics and / or scientific (throughput) computing may support both class A and class B (of course, a core with some mixture of templates and instructions from these two classes, but not all templates and instructions from these two classes, is within the scope of the present invention). Likewise, a single processor may include multiple cores, all of which support the same class, or different cores in which support different classes. For example, in a processor with separate graphics cores and general purpose cores, one of the graphics cores intended primarily for graphics and / or scientific computing may support only class A, while one or more of the general purpose cores may be a high-performance general purpose core with out-of-order execution and register renaming intended for general purpose computing that supports only class B. Another processor that does not have a separate graphics core may include one or more general-purpose in-order or out-of-order cores that support both class A and class B. Of course, in different embodiments of the invention, features from one class may also be implemented in the other class. A program written in a high-level language will be made (e.g., just-in-time or statically compiled) into a variety of different executable forms, including: 1) a form with only instructions of the class(es) supported by the target processor for execution; or 2) a form with alternative routines written using different combinations of instructions of all classes and with control flow code that selects these routines to execute based on instructions supported by the processor currently executing the code.

[0236] Figures 16A-16Dis a block diagram illustrating an exemplary specific vector friendly instruction format according to an embodiment of the present invention. Fig.16A A specific vector friendly instruction format 1600 is shown that specifies the location, size, interpretation, and order of various fields, as well as the values ​​of some of those fields, and in this sense, the specific vector friendly instruction format 1600 is specific. The specific vector friendly instruction format 1600 can be used to extend the x86 instruction set, and thus some of the fields are similar or identical to those used in the existing x86 instruction set and its extensions (e.g., AVX). The format remains consistent with the prefix encoding field, real opcode byte field, MOD R / M field, SIB field, displacement field, and immediate field of the existing x86 instruction set with extensions. Illustration from Figure 15A-15B Fields from Figures 16A-16D The fields are mapped to Figure 15A-15B fields.

[0237] It should be understood that although embodiments of the present invention are described with reference to the specific vector friendly instruction format 1600 in the context of the general vector friendly instruction format 1500 for illustrative purposes, the present invention is not limited to the specific vector friendly instruction format 1600 unless otherwise stated. For example, the general vector friendly instruction format 1500 contemplates various possible sizes for various fields, while the specific vector friendly instruction format 1600 is shown as having fields of specific sizes. As a specific example, although the data element width field 1564 is shown as a one-bit field in the specific vector friendly instruction format 1600, the present invention is not limited thereto (i.e., the general vector friendly instruction format 1500 contemplates other sizes for the data element width field 1564).

[0238] The generic vector friendly instruction format 1500 includes the following listed in accordance with Fig.16A The following fields are in the order shown.

[0239] EVEX prefix (bytes 0-3) 1602 - encoded in four-byte form.

[0240] Format field 1540 (EVEX byte 0, bits [7:0]) - The first byte (EVEX byte 0) is the format field 1540, and it contains 0x62 (a unique value used to distinguish the vector friendly instruction format in one embodiment of the invention).

[0241] The second through fourth bytes (EVEX bytes 1-3) include a number of bit fields that provide specific capabilities.

[0242] REX field 1605 (EVEX byte 1, bits [7-5]) - consists of the EVEX.R bit field (EVEX byte 1, bits [7]-R), the EVEX.X bit field (EVEX byte 1, bits [6]-X), and (1157BEX byte 1, bits [5]-B). The EVEX.R, EVEX.X, and EVEX.B bit fields provide the same functionality as the corresponding VEX bit fields and are encoded using 1's complement form, i.e., ZMM0 is encoded as 1111B and ZMM15 is encoded as 0000B. The other fields of these instructions encode the lower three bits of the register index (rrr, xxx, and bbb) as is known in the art, whereby Rrrr, Xxxx, and Bbbb may be formed by adding EVEX.R, EVEX.X, and EVEX.B.

[0243] REX' field 1610 - This is the first portion of the REX' field 1610 and is the EVEX.R' bit field (EVEX byte 1, bit [4] - R') used to encode the upper 16 or lower 16 registers of the extended 32 register set. In one embodiment of the invention, this bit is stored in a bit-reversed format along with the other bits indicated below to distinguish (in 32-bit mode of the known x86) from a BOUND instruction whose real opcode byte is 62, but does not accept a value of 11 in the MOD field in the MODR / M field (described below); an alternative embodiment of the invention does not store this indicated bit and the other indicated bits below in an inverted format. A value of 1 is used to encode the lower 16 registers. In other words, R'Rrrr is formed by combining EVEX.R', EVEX.R, and the other RRRs from the other fields.

[0244] Opcode map field 1615 (EVEX byte 1, bits [3:0] – mmmm) – its contents encode the implied leading opcode byte (0F, 0F 38, or 0F 3).

[0245] Data element width field 1564 (EVEX byte 2, bit [7] – W) – denoted by the notation EVEX.W. EVEX.W is used to define the granularity (size) of the data type (32-bit data element or 64-bit data element).

[0246] EVEX.vvvv 1620 (EVEX byte 2, bits [6:3] - vvvv) - The role of EVEX.vvvv may include the following: 1) EVEX.vvvv encodes the first source register operand specified in inverted (1's complement) form and is valid for instructions with two or more source operands; 2) EVEX.vvvv encodes the destination register operand specified in 1's complement form for a particular vector displacement; or 3) EVEX.vvvv does not encode any operand, this field is reserved, and should contain 1111b. Thus, EVEX.vvvv field 1620 encodes the 4 low-order bits of the first source register designator stored in inverted (1's complement) form. Depending on the instruction, additional different EVEX bit fields are used to extend the designator size to 32 registers.

[0247] EVEX.U 1568 Class field (EVEX byte 2, bit [2] - U) - if EVEX.U = 0, it indicates Class A or EVEX.U0; if EVEX.U = 1, it indicates Class B or EVEX.U1.

[0248] Prefix encoding field 1625 (EVEX byte 2, bits [1:0]-pp) - provides additional bits for the base operation field. In addition to providing support for legacy SSE instructions in EVEX prefix format, this also has the benefit of compressing the SIMD prefix (EVEX prefix only requires 2 bits, rather than requiring bytes to express the SIMD prefix). In one embodiment, to support legacy SSE instructions that use SIMD prefixes (66H, F2H, F3H) in both legacy format and in EVEX prefix format, these legacy SIMD prefixes are encoded into the SIMD prefix encoding field; and at runtime are expanded into the legacy SIMD prefix before being provided to the decoder's PLA (so that the PLA can execute both these legacy instructions in legacy format and these legacy instructions in EVEX format without modification). Although newer instructions can use the contents of the EVEX prefix encoding field directly as an opcode extension, for consistency, specific embodiments expand in a similar manner, but allow for different meanings specified by these legacy SIMD prefixes. Alternative embodiments may redesign the PLA to support 2-bit SIMD prefix encodings, and thus do not require expansion.

[0249] alpha field 1552 (EVEX byte 3, bit [7] - EH, also known as EVEX.EH, EVEX.rs, EVEX.RL, EVEX.WriteMaskControl, and EVEX.N; also shown as alpha) - As previously described, this field is context specific.

[0250] Beta field 1554 (EVEX byte 3, bits [6:4] - SSS, also known as EVEX.s2-0, EVEX.r 2-0 , EVEX.rr1, EVEX.LL0, EVEX.LLB, also shown as βββ) - As mentioned earlier, this field is context-specific.

[0251] REX' field 1610 - This is the remainder of the REX' field and is the EVEX.V' bit field (EVEX byte 3, bit [3] - V') that can be used to encode the upper 16 or lower 16 registers of the extended 32 register set. This bit is stored in a bit-reversed format. A value of 1 is used to encode the lower 16 registers. In other words, V'VVV is formed by combining EVEX.V', EVEX.vvvv.

[0252] Write mask field 1570 (EVEX byte 3, bits [2:0] - kkk) - its contents specify the index of a register in the write mask register, as previously described. In one embodiment of the invention, a particular value of EVEX.kkk = 000 has special behavior that implies that no write mask is used for a particular instruction (this can be implemented in a variety of ways, including using a write mask that is hardwired to all objects or hardware that bypasses the mask hardware).

[0253] The real opcode field 1630 (byte 4) is also referred to as the opcode byte. A portion of the opcode is specified in this field.

[0254] The MOD R / M field 1640 (byte 5) includes a MOD field 1642, a Reg field 1644, and an R / M field 1646. As previously described, the content of the MOD field 1642 distinguishes memory access operations from non-memory access operations. The role of the Reg field 1644 can be attributed to two situations: encoding a destination register operand or a source register operand; or being treated as an opcode extension and not used to encode any instruction operand. The role of the R / M field 1646 may include the following: encoding an instruction operand that references a memory address; or encoding a destination register operand or a source register operand.

[0255] Scale, Index, Base (SIB) Byte (Byte 6) - As previously described, the contents of the scale field 1650 are used for memory address generation. SIB.xxx 1654 and SIB.bbb 1656 - The contents of these fields have been mentioned previously for register indexes Xxxx and Bbbb.

[0256] Displacement field 1562A (bytes 7-10) - When the MOD field 1642 contains 10, bytes 7-10 are the displacement field 1562A, and it works the same as the traditional 32-bit displacement (disp32) and works at byte granularity.

[0257] Displacement Factor Field 1562B (Byte 7) - When MOD field 1642 contains 01, byte 7 is the displacement factor field 1562B. The location of this field is the same as that of the traditional x86 instruction set 8-bit displacement (disp8) that works at byte granularity. Since disp8 is sign-extended, it can only address between -128 and 127 byte offsets; in terms of a 64-byte cache line, disp8 uses 8 bits that can be set to only four really useful values ​​-128, -64, 0, and 64; since a larger range is often needed, disp32 is used; however, disp32 requires 4 bytes. In contrast to disp8 and disp32, displacement factor field 1562B is a reinterpretation of disp8; when displacement factor field 1562B is used, the actual displacement is determined by multiplying the contents of the displacement factor field by the size (N) of the memory operand access. This type of displacement is referred to as disp8*N. This reduces the average instruction length (a single byte for the displacement, but with a much larger range). Such compressed displacements are based on the assumption that the effective displacement is a multiple of the granularity of the memory access, and thus the redundant low-order bits of the address offset do not need to be encoded. In other words, the displacement factor field 1562B replaces the traditional x86 instruction set 8-bit displacement. Thus, the displacement factor field 1562B is encoded in the same manner as the x86 instruction set 8-bit displacement (thus, there is no change in the ModRM / SIB encoding rules), the only difference being that disp8 is overloaded to disp8*N. In other words, there is no change in the encoding rules or encoding length, but only in the hardware's interpretation of the displacement value (which requires scaling the displacement by the size of the memory operand to obtain a byte-based address offset).

[0258] The immediate field 1572 operates as previously described.

[0259] Full opcode field

[0260] Fig. 16B 1 is a block diagram illustrating fields of a specific vector friendly instruction format 1600 that make up a full opcode field 1574 according to one embodiment of the present invention. Specifically, the full opcode field 1574 includes a format field 1540, a base operation field 1542, and a data element width (W) field 1564. The base operation field 1542 includes a prefix encoding field 1625, an opcode map field 1615, and a real opcode field 1630.

[0261] Register Index Field

[0262] Fig. 16C 16 is a block diagram illustrating fields of a specific vector friendly instruction format 1600 that constitute a register index field 1544 according to one embodiment of the present invention. Specifically, the register index field 1544 includes a REX field 1605, a REX' field 1610, a MODR / M.reg field 1644, a MODR / Mr / m field 1646, a VVVV field 1620, a xxx field 1654, and a bbb field 1656.

[0263] Expand the operation field

[0264] Fig.16D is a block diagram illustrating the fields of the specific vector friendly instruction format 1600 that make up the extended operation field 1550 according to one embodiment of the present invention. When the class (U) field 1568 contains 0, it indicates EVEX.U0 (class A 1, 568A); when it contains 1, it indicates EVEX.U1 (class B 1568B). When U=0 and the MOD field 1642 contains 11 (indicating a no memory access operation), the alpha field 1552 (EVEX byte 3, bit [7] - EH) is interpreted as the rs field 1552A. When the rs field 1552A contains 1 (round 1552A.1), the beta field 1554 (EVEX byte 3, bits [6:4] - SSS) is interpreted as the round control field 1554A. The round control field 1554A includes a one-bit SAE field 1556 and a two-bit round operation field 1558. When the rs field 1552A contains 0 (data transformation 1552A.2), the beta field 1554 (EVEX byte 3, bits [6:4]-SSS) is interpreted as a three-bit data transformation field 1554B. When U=0 and the MOD field 1642 contains 00, 01, or 10 (indicating a memory access operation), the alpha field 1552 (EVEX byte 3, bits [7]-EH) is interpreted as an eviction hint (EH) field 1552B, and the beta field 1554 (EVEX byte 3, bits [6:4]-SSS) is interpreted as a three-bit data manipulation field 1554C.

[0265] When U=1, the alpha field 1552 (EVEX byte 3, bit [7]–EH) is interpreted as the write mask control (Z) field 1552C. When U=1 and the MOD field 1642 contains 11 (indicating a no memory access operation), a portion of the beta field 1654 (EVEX byte 3, bit [4]–S0) is interpreted as the RL field 1657A; when it contains 1 (rounded 1557A.1), the remainder of the beta field 1554 (EVEX byte 3, bits [6-5]–S0) is interpreted as the RL field 1657A. 2-1) is interpreted as the rounding operation field 1559A, and when the RL field 1557A contains 0 (VSIZE 1557.A2), the remainder of the beta field 1554 (EVEX byte 3, bits [6-5] - S 2-1 ) is interpreted as the vector length field 1559B (EVEX byte 3, bits [6-5] – L 1-0 ). When U=1 and the MOD field 1642 contains 00, 01, or 10 (indicating a memory access operation), the beta field 1554 (EVEX byte 3, bits [6:4] - SSS) is interpreted as the vector length field 1559B (EVEX byte 3, bits [6-5] - L 1-0 ) and the broadcast field 1557B (EVEX byte 3, bit [4]–B).

[0266] Fig.17 17 is a block diagram of a register architecture 1700 according to one embodiment of the present invention. In the illustrated embodiment, there are 32 512-bit wide vector registers 1710; these registers are referenced as zmm0 through zmm31. The lower order 256 bits of the lower 16 zmm registers are overlaid on registers ymm0-16. The lower order 128 bits of the lower 16 zmm registers (the lower order 128 bits of the ymm registers) are overlaid on registers xmm0-15. The dedicated vector friendly instruction format 1600 operates on these overlaid register files as shown in the following table.

[0267]

[0268] In other words, the vector length field 1559B selects between a maximum length and one or more other shorter lengths, where each such shorter length is half the previous length, and instruction templates without a vector length field 1559B operate on the maximum vector length. In addition, in one embodiment, the class B instruction templates of the dedicated vector friendly instruction format 1600 operate on packed or scalar single / double precision floating point data and packed or scalar integer data. Scalar operations are operations performed on the lowest order data element position in the zmm / ymm / xmm register; higher order data element positions either remain the same as before the instruction or are reset to zero, depending on the embodiment.

[0269] Write mask registers 1715 - In the illustrated embodiment, there are 8 write mask registers (k0 through k7), each of which is 64 bits in size. In an alternative embodiment, the size of the write mask registers 1715 is 16 bits. As previously described, in one embodiment of the present invention, vector mask register k0 cannot be used as a write mask; when the encoding that normally indicates k0 is used as a write mask, it selects a hardwired write mask of 0xFFFF, effectively disabling write masking for that instruction.

[0270] General purpose registers 1725 - In the embodiment shown, there are sixteen 64-bit general purpose registers that are used with existing x86 addressing modes to address memory operands. These registers are referenced by the names RAX, RBX, RCX, RDX, RBP, RSI, RDI, RSP, and R8 through R15.

[0271] A scalar floating point stack register file (x87 stack) 1745 on which an MMX packed integer flat register file 1750 is overlaid - in the illustrated embodiment, the x87 stack is an eight-element stack used to perform scalar floating point operations on 32 / 64 / 80-bit floating point data using the x87 instruction set extension; while MMX registers are used to perform operations on 64-bit packed integer data, as well as to hold operands for some operations performed between MMX and XMM registers.

[0272] Alternative embodiments of the present invention may use wider or narrower registers. In addition, alternative embodiments of the present invention may use more, fewer or different register files and registers.

[0273] Figure 18A-18B A block diagram showing a more specific exemplary in-order core architecture, which would be one logic block among several logic blocks in a chip (including other cores of the same type and / or different types). Depending on the application, the logic block communicates with some fixed function logic, memory I / O interfaces, and other necessary I / O logic via a high bandwidth interconnect network (e.g., a ring network).

[0274] Fig.18A1 is a block diagram of a single processor core and its connection to an on-die interconnect network 1802 and its local subset 1804 of a second level (L2) cache according to an embodiment of the present invention. In one embodiment, the instruction decoder 1800 supports the x86 instruction set with a packed data instruction set extension. The L1 cache 1806 allows low latency access to cache memory into the scalar and vector units. Although in one embodiment (to simplify the design), the scalar unit 1808 and the vector unit 1810 use separate register sets (scalar registers 1812 and vector registers 1814, respectively), and data transferred between these registers is written to memory and then read back from the first level (L1) cache 1806, alternative embodiments of the present invention may use different approaches (e.g., using a single register set or including a communication path that allows data to be transferred between the two register files without being written and read back).

[0275] The local subset 1804 of the L2 cache is part of the global L2 cache, which is divided into multiple separate local subsets, one local subset for each processor core. Each processor core has a direct access path to its own local subset 1804 of the L2 cache. The data read by the processor core is stored in its L2 cache subset 1804 and can be quickly accessed in parallel with other processor cores accessing their own local L2 cache subsets. The data written by the processor core is stored in its own L2 cache subset 1804 and is dumped and cleared from other subsets when necessary. The ring network ensures the consistency of shared data. The ring network is bidirectional to allow agents such as processor cores, L2 caches and other logic blocks to communicate with each other within the chip. Each ring data path is 1012 bits wide in each direction.

[0276] Fig.18B According to an embodiment of the present invention Fig.18A An expanded view of a portion of a processor core in FIG. Fig.18B Includes the L1 data cache 1806A portion of the L1 cache 1804, as well as more details about the vector unit 1810 and vector registers 1814. Specifically, the vector unit 1810 is a 16-wide vector processing unit (VPU) (see 16-wide ALU 1828) that executes one or more of integer, single-precision floating point, and double-precision floating point instructions. The VPU supports blending of register inputs through blending unit 1820, numerical conversion through numerical conversion units 1822A-B, and copying of memory inputs through copy unit 1824. Write mask register 1826 allows asserted vector writes.

[0277] Example Slice / Matrix Operations and Hardware

[0278] Fig.19 An embodiment of a configured slice is illustrated. As shown, there are four slices 1911, 1913, 1915, and 1917 loaded from application memory 1901. In this example, slices T0 1911 and T1 1913 have M rows and N columns with 4 element bytes (e.g., single precision data). Slices T2 1915 and T3 1917 have M rows and N / 2 columns with 8 element bytes (e.g., double precision data). Since double precision operands are twice as wide as single precision operands, this configuration is consistent with providing a palette of slice options, providing at least 16*N*M bytes of total storage for at least 4 names. Depending on the instruction encoding scheme used, the number of available slices varies.

[0279] In some embodiments, slice parameters are definable. For example, a "palette" is used to provide slice options. Exemplary options include, but are not limited to: number of slice names, number of bytes in a row stored, number of rows and columns in a slice, etc. For example, the maximum "height" (number of rows) of a slice may be defined as:

[0280] Maximum number of rows in a slice = constructed storage / (number of palette names / number of bytes per row)

[0281] Thus, applications can be written so that fixed use of names will be able to take advantage of different storage sizes across implementations.

[0282] Configuration of tiles is accomplished using a tile configuration ("TILECONFIG") instruction, in which specific tile usage is defined within a selected palette. The declaration includes the number of tile names to be used, the requested number of rows and columns for each name (tile), and in some embodiments, the requested data type for each tile. In some embodiments, a consistency check is performed during execution of the TILECONFIG instruction to determine that it matches the constraints of the palette entries.

[0283] Fig. 20 Several examples of matrix storage are shown. In (A), slices are stored in memory. As shown, each "row" consists of four packed data elements. To get to the next "row", a stride value is used. Note that rows can be stored consecutively in memory. When the slice storage does not map the underlying memory array row width, strided memory access allows access to one row and then to the next row.

[0284] Tile loads from memory and stores to memory are typically strided accesses from application memory to packed rows of data. Exemplary TILELOAD and TILESTORE instructions or other instruction references to application memory as TILE operands in load operation instructions are restartable in some embodiments to handle (up to) 2*row page faults, unmasked floating point exceptions, and / or interrupts per instruction.

[0285] In (B), the matrix is ​​stored in slices consisting of multiple registers, such as packed data registers (Single Instruction Multiple Data (SIMD) or vector registers). In this example, the slice is superimposed on three physical registers. Typically, contiguous registers are used, however, this need not be the case.

[0286] In (C), the matrix is ​​stored in a slice in non-register storage accessible by a fused multiply-accumulate (FMA) circuit used in a slice operation. The storage may be inside the FMA, or adjacent to the FMA. Furthermore, in some embodiments, as discussed below, the storage may be used for data elements rather than for entire rows or slices.

[0287] The supported parameters of the TMMA architecture are reported via CPUID. In some embodiments, the information list includes the maximum height and the maximum SIMD scale. Configuring the TMMA architecture requires specifying the scale of each tile, the element size of each tile, and the palette identifier. This configuration is completed by executing the TILECONFIG instruction.

[0288] Successful execution of the TILECONFIG instruction enables subsequent TILE operators. The TILERELEASEALL instruction clears the tile configuration and disables TILE operations (until the next TILECONFIG instruction is executed). In some embodiments, XSAVE, XSTORE, etc. are used in context switches that use tiles. In some embodiments, 2 XCR0 bits are used in XSAVE, one for TILECONFIG metadata and one corresponding to the actual tile payload data.

[0289] TILECONFIG not only configures tile usage, but also sets a state variable that indicates that the program is in the code region if the tile is configured. An implementation may enumerate restrictions on other instructions that may be used with tile regions, such as no use of existing register sets, and so on.

[0290] Exiting a tile region is typically accomplished using the TILERELEASEALL instruction. This instruction takes no parameters and immediately invalidates all tiles (indicating that data no longer requires any preservation or restoration) and clears the internal state corresponding to being in the tile region.

[0291] In some embodiments, slice operations will zero any rows and any columns that exceed the dimensions specified by the slice configuration. For example, as each row is written, the slice operation will zero the data beyond the configured number of columns (taking the size of the element into account). For example, for 64-byte rows and a slice configured with 10 rows and 12 columns, an operation that writes an FP32 element will write the output / result data to each of the first 10 rows with 12*4 bytes and zero the remaining 4*4 bytes in each row. The slice operation also completely zeroes any rows after the first 10 configured rows. When using a 1K slice with 64-byte rows, there will be 16 rows, so in this example, the last 6 rows will also be zeroed.

[0292] In some embodiments, when loading data, context restore (e.g., XRSTOR) forces that data beyond the configured rows of the slice will be maintained as zeros. If there is no valid configuration, all rows are zeroed. An XRSTOR on the slice data can load garbage information in columns beyond those configured. It should not be possible for the XRSTOR to clear beyond the configured number of columns because there is no element width associated with the slice configuration.

[0293] A context save (e.g., XSAVE) exposes the entire TILE memory area when it is written to memory. If XRSTOR loads useless data into the rightmost portion of a tile, that data will be saved by XSAVE. For rows exceeding the number specified for each tile, XSAVE will write zeros.

[0294] In some embodiments, slice instructions are restartable. Operations accessing memory allow restarting after a page fault. Compute instructions that process floating point operations also allow unmasked floating point exceptions, by virtue of masking of exceptions controlled by control and / or status registers.

[0295] To support restarting instructions after these events, these instructions store information in the start registers described in detail below.

[0296] Fig.21An embodiment of a system utilizing a matrix (slice) operation accelerator is illustrated. In the illustration, a host processor / processing system 2101 passes a command 2111 (e.g., a matrix manipulation operation, such as an arithmetic or matrix manipulation operation, or a load and store operation) to a matrix operation accelerator 2107. However, this is shown in this manner for discussion purposes only. As described in detail later, the accelerator 2107 may be part of a processing core. Typically, the command 2111, which is a slice manipulation operator instruction, refers to the slice as a register-register ("reg-reg") or register-memory ("reg-mem") format. Other commands such as TILESTORE, TILELOAD, TILECONFIG, etc. do not perform data operations on the slice. The command may be a decoded instruction (e.g., a micro-operation) or a macro-instruction for the accelerator 2107 to handle.

[0297] In this example, the consistent memory interface 2103 is coupled to the host processor / processing system 2101 and the matrix operation accelerator 2207 so that they can share memory. Fig. 22 and Fig.23 Different embodiments of how to use a matrix operation accelerator to share memory are shown. Fig. 22 As shown in , the host processor 2201 and the matrix operation accelerator circuit 2205 share the same memory 2203. Fig.23 An embodiment is shown in which the host processor 2301 and the matrix operation accelerator 2305 do not share memory, but can access each other's memory. For example, the processor 2301 can access the slice memory 2307 and utilize its host memory 2303 as usual. Similarly, the matrix operation accelerator 2305 can access the host memory 2303, but more typically uses its own memory 2307. Note that these memories can be of different types.

[0298] The matrix operation accelerator 2107 includes a plurality of FMAs 2109 coupled to a data buffer 2105 (in some implementations, one or more of these buffers 2105 are stored in a grid of FMAs as shown). The data buffer 2105 buffers slices loaded from memory (e.g., using a slice load or slice store instruction) and / or slices to be stored to memory. The data buffer may be, for example, a plurality of registers. Typically, these FMAs are arranged as a grid of chained FMAs 2109 capable of reading and writing slices. In this example, the matrix operation accelerator 2107 is used to perform a matrix multiplication operation using slices T0, T1, and T2. At least one of the slices is accommodated in the FMA grid 2109. In some embodiments, all slices in the operation are stored in the FMA grid 2109. In other embodiments, only a subset is stored in the FMA grid 2109. As shown, T1 is accommodated, while T0 and T2 are not accommodated. Note that A, B, and C refer to the matrices of these patches, which may or may not occupy the entire space of the patch.

[0299] Embodiments of the present invention may use dedicated matrix operation circuitry. Fig.24 An embodiment of a matrix multiply-accumulate operation ("TMMA") using a tile is illustrated. The number of rows in the matrix (tile A 2401) matches the number of series-connected (chained) FMAs, which include the latency of the computation. The implementation is free to recycle on a grid of smaller height, but the computation remains the same.

[0300] The source / destination vectors come from a slice of N rows (slice C 2405), and the grid of FMAs 2411 performs N vector-matrix operations, resulting in a complete instruction to perform the matrix multiplication of the slice. Slice B 2403 is another vector source, and provides a "broadcast" term to the FMA in each stage.

[0301] In operation, in some embodiments the elements of matrix B (stored in slice B 2403) are spread across the rectangular grid of FMAs. Matrix B (stored in slice A 2401) has its row elements transposed to match the column dimensions of the rectangular grid of FMAs. At each FMA in the grid, the elements of A and B are multiplied and added to the incoming augend (from above in the figure), and the outgoing sum is passed to the next row (or final output) of the FMA.

[0302] Fig.25 An embodiment of a subset of the execution of an iteration of a chained fused multiply-accumulate instruction is illustrated. Specifically, this illustrates the execution circuitry of an iteration of one packed data element position of the destination. In this embodiment, the chained fused multiply-accumulate is operating on a signed source, where the accumulator is twice the size of the input data.

[0303] The first signed source (source 1 2501) and the second signed source (source 2 2503) each have four packed data elements. Each of these packed data elements stores signed data such as floating point data. The third signed source (source 3 2509) has two packed data elements, each of which stores signed data. The size of the first signed source 2501 and the size of the second signed source 2503 are half the size of the third signed source (initial value or previous result) 2509. For example, the first signed source 2501 and the second signed source 2503 may have 32-bit packed data elements (e.g., single precision floating point), while the third signed source 2509 may have 64-bit packed data elements (e.g., double precision floating point).

[0304] In this illustration, only the most significant two packed data element positions of the first signed source 2501 and the second signed source 2503 are shown, as well as the most significant packed data element position of the third signed source 2509. Of course, other packed data element positions will also be processed.

[0305] As shown, packed data elements are processed in pairs. For example, multiplier circuit 2505 is used to multiply the data of the most significant packed data element position of the first signed source 2501 and the second signed source 2503, and multiplier circuit 2507 is used to multiply the data of the second most significant packed data element position from the first signed source 2501 and the second signed source 2503. In some embodiments, these multiplier circuits 2505 and 2507 are reused for other packed data element positions. In other embodiments, additional multiplier circuits are used so that the packed data elements are processed in parallel. In some contexts, parallel execution is completed using a channel of size that is the size of the signed third source 2509. The results of each multiplication in these multiplications are added using addition circuit 2511.

[0306] The result of the addition of these multiplication results is added to the data from the most significant packed data element position from Signed Source 3 2509 (using a different adder 2513 or the same adder 2511).

[0307] Finally, the result of the second addition is stored in the signed destination 2515 in the packed data element position corresponding to the used packed data element position from the signed third source 2509, or is passed on to the next iteration if there is one. In some embodiments, a write mask is applied to this storage so that if the corresponding write mask (bit) is set, the storage occurs, and if the corresponding write mask (bit) is not set, the storage does not occur.

[0308] Fig.26A SIMD implementation for a power of 2 size according to an embodiment is shown, wherein the accumulator uses a size larger than the size of the input to the multiplier. Note that the source (to the multiplier) and accumulator values ​​can be signed values ​​or unsigned values. For an accumulator with 2 times the input size (in other words, the accumulator input value is set to a size that is at least 2 times the size of the packed data elements of the source), Table 2601 illustrates different configurations. For a source of byte (int8) size, the accumulator uses a word or half-precision floating point (HPFP) value of size 16 bits. For a source of word (int16) size, the accumulator uses a 32-bit integer or single-precision floating point (SPFP) value of size 32 bits. For a source of SPFP or 32-bit integer size, the accumulator uses a 64-bit integer or double-precision floating point (DPFP) value of size 64 bits.

[0309] For accumulators with 4x size (in other words, the accumulator input value is set to a size that is at least 4 times the size of the packed data elements of the source), table 2603 illustrates different configurations. For byte-sized sources, the accumulator uses 32-bit integers or single-precision floating point (SPFP) values ​​with a size of 32 bits. In some embodiments, for word-sized sources, the accumulator uses 64-bit integers or double-precision floating point (DPFP) values ​​with a size of 64 bits.

[0310] For an accumulator with 8x input size (in other words, the size of the accumulator input value is set to at least 8 times the size of the packed data elements of the source), table 2605 illustrates the configuration. For byte sized sources, the accumulator uses 64-bit integers.

[0311] In the above description, embodiments of the present invention have been described with reference to specific exemplary embodiments of the present invention. However, it will be apparent that various modifications and changes may be made to these embodiments without departing from the broader spirit and scope of the present invention as described in the appended claims. Therefore, the description and drawings should be regarded as illustrative rather than restrictive.

[0312] Embodiments of the present invention may include the various steps described above. These steps may be embodied in machine executable instructions that may be used to cause a general or special purpose processor to perform the steps. Alternatively, these steps may be performed by dedicated hardware components that contain hardwired logic for performing these steps, or by any combination of programmed computer components and custom hardware components.

[0313] As described herein, instructions may refer to a specific configuration of hardware, such as an application-specific integrated circuit (ASIC) configured to perform certain operations or have a predetermined function, or may refer to software instructions stored in a memory embodied in a non-transient computer-readable medium. Thus, the technology shown in the accompanying drawings can be implemented using code and data stored on one or more electronic devices (e.g., terminal stations, network elements, etc.) and executed on the one or more electronic devices. Such electronic devices store and transmit code and data (internally and / or through a network with other electronic devices) using a computer machine-readable medium, such as: a non-transient computer machine-readable storage medium (e.g., a disk; an optical disk; a random access memory; a read-only memory; a flash memory device; a phase change memory), and a transient computer machine-readable communication medium (e.g., an electrical, optical, acoustic or other form of propagation signal - such as a carrier wave, an infrared signal, a digital signal, etc.). In addition, such electronic devices typically include a collection of one or more processors coupled to one or more other components, such as one or more storage devices (non-transient machine-readable storage media), user input / output devices (e.g., keyboards, touch screens and / or displays), and network connections. The coupling of the set of processors to other components is typically through one or more buses and bridges (also referred to as bus controllers). The storage device and the signal carrying the network traffic represent one or more machine-readable storage media and machine-readable communication media, respectively. Thus, the storage device of a given electronic device typically stores code and / or data for execution on the set of one or more processors of the electronic device. Of course, one or more parts of the embodiments of the present invention can be implemented using different combinations of software, firmware and / or hardware. Throughout this specific embodiment, for explanation, numerous specific details are stated to provide a thorough understanding of the present invention. However, it is obvious to those skilled in the art that the present invention can be implemented without some of these specific details. In some instances, the known structures and functions are not described in detail to avoid obscuring the subject matter of the present invention. Therefore, the scope and spirit of the present invention should be judged according to the appended claims.

Claims

1. A processor, comprising: Cache, used to store data; as well as A plurality of cores coupled to the cache, a core of the plurality of cores comprising: An execution module, configured to execute one or more instructions to perform matrix multiplication on a first source matrix and a second source matrix to generate a result matrix, the execution module comprising: conversion hardware logic for converting the first plurality of data elements of the first source matrix and the second plurality of data elements of the second source matrix from a single precision floating point data format to a reduced precision floating point format, the reduced precision floating point format having fewer mantissa bits than the single precision floating point data format and the same number of exponent bits as the single precision floating point data format; and a plurality of multiply-accumulate circuits for performing a plurality of parallel fused multiply-add operations to multiply the first plurality of data elements in the reduced precision floating point format with corresponding ones of the second plurality of data elements in the reduced precision floating point format to generate a plurality of products, and to add the plurality of products to an accumulation value to generate single precision floating point data elements of the result matrix.

2. The processor of claim 1, wherein: The cache is shared among a plurality of the cores.

3. The processor of claim 2, further comprising: A plurality of first level caches, each first level cache being associated with a core of the plurality of cores.

4. The processor according to any one of claims 1 to 3, wherein: The one or more instructions include a first instruction including a first operand for identifying the first plurality of data elements and a second operand for identifying the second plurality of data elements.

5. The processor of claim 4, wherein: The first operand identifies the first plurality of data elements in a first one or more registers, and the second operand identifies the second plurality of data elements in a second one or more registers.

6. The processor of any one of claims 1 to 3, further comprising: An instruction fetching unit, configured to fetch the one or more instructions; A decoder for decoding the one or more instructions into a plurality of micro-operations; A scheduler is used to schedule the multiple micro-operations for execution by the execution module.

7. The processor of claim 6, further comprising: A memory controller is configured to couple the plurality of cores to a memory device.

8. A method comprising: loading, by a core of the plurality of cores, from a memory a first plurality of data elements of a first source matrix and a second plurality of data elements of a second source matrix; converting, by the core, the first plurality of data elements and the second plurality of data elements from a single precision floating point data format to a reduced precision floating point format, the reduced precision floating point format having fewer mantissa bits than the single precision floating point data format and the same number of exponent bits as the single precision floating point data format; as well as performing a plurality of parallel fused multiply-add operations on a plurality of multiply-accumulate circuits of the core to multiply the first plurality of data elements in the reduced precision floating point format with corresponding data elements of the second plurality of data elements in the reduced precision floating point format to generate a plurality of products; as well as The plurality of products are added to an accumulation value by the plurality of multiply-accumulate circuits to generate single-precision floating-point data elements of a result matrix.

9. The method of claim 8, wherein: The cache is shared between multiple cores.

10. The method of claim 9, further comprising: A plurality of first level caches, each first level cache being associated with a core of the plurality of cores.

11. The method according to any one of claims 8 to 10, wherein: The one or more instructions include a first instruction including a first operand for identifying the first plurality of data elements and a second operand for identifying the second plurality of data elements.

12. The method of claim 11, wherein: The first operand identifies the first plurality of data elements in a first one or more registers, and the second operand identifies the second plurality of data elements in a second one or more registers.

13. The method of any one of claims 8 to 10, further comprising: fetching the one or more instructions by an instruction fetch unit of the core; decoding, by a decoder of the core, the one or more instructions into a plurality of micro-operations; The plurality of micro-operations are scheduled by a scheduler of the core for execution by an execution module.

14. The method of claim 13, wherein: Loading includes: The memory is accessed via a memory control coupled to the plurality of cores.

15. A machine-readable medium having a program code stored thereon, which, when executed by a machine, causes the machine to perform the method according to any one of claims 8 to 14.

16. A system comprising means for performing the method according to any one of claims 8 to 14.

Citation Information

Patent Citations

  • Method and apparatus for performing a vector permute with an index and an immediate

    CN107003986A