Data transfer method, processor and computing device for fast register
The cache data is combined by the cache controller, and the data blocks are combined and transported according to the storage rules of the fast register, which solves the problem of frequent occupation of the fast register access interface and improves the operating efficiency and bandwidth utilization of the processor.
Patent Information
- Application Number
- CN202410718840.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-05
AI Technical Summary
During the data transfer process of existing processors, the fast register access interface is frequently occupied, resulting in low processor operating efficiency, waste of bandwidth, and increased power consumption.
The cache data is combined by the cache controller, and the data blocks are combined according to the storage rules of thread data in the fast register to form a complete data combination and then moved to the fast register, thereby reducing the occupation of the fast register access interface.
It improves the operating efficiency of the processor, makes full use of the bandwidth of fast registers, reduces the power consumption of data transfer, and reduces the occupation of fast register access interfaces.
Smart Images

Figure CN118295707B
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of processor technology, and more specifically, to a data transfer method for a fast register, a processor, and a computing device. Background Art
[0002] With the development of AI training, reasoning, scientific computing and other general computing scenarios, higher requirements are placed on the computing power, processing efficiency, bandwidth and other aspects of processor chips. How to provide high-performance general computing devices in terms of software and hardware has become an important research direction. Summary of the invention
[0003] The embodiments of the present disclosure provide a data transfer method, a processor, and a computing device for a fast register, which are used to reduce the occupancy of a fast register access interface during data transfer and improve the operating efficiency of the processor.
[0004] According to one aspect of the present disclosure, a data transfer method for a fast register is provided. The data transfer method for a fast register according to an embodiment of the present disclosure includes: reading cache data corresponding to a cache address of a cache controller; combining the read cache data according to a storage rule of thread data in a fast register, so that the combined data includes data blocks of M threads among N threads of a processor, wherein M and N are integers greater than 1, and M is not greater than N; and transferring the combined data to a fast register.
[0005] According to some embodiments of the present disclosure, cache data corresponding to a cache address of a cache controller includes one or more continuous data blocks corresponding to at least one thread among N threads, wherein combining the read cache data according to the storage rule of thread data in a fast register includes: for one or more continuous data blocks corresponding to at least one thread among the N threads, combining data blocks with the same fast register storage address into the same group of data, and combining data blocks with different fast register storage addresses into different groups of data.
[0006] According to some embodiments of the present disclosure, moving the combined data to the fast register includes: in response to determining that the same group of data includes data blocks of M threads among N threads, moving the same group of data to the fast register.
[0007] According to some embodiments of the present disclosure, reading cache data corresponding to a cache address of a cache controller and combining the read cache data according to a storage rule of thread data in a fast register includes: reading first cache data corresponding to a first cache address of the cache controller, wherein the first cache data includes one or more continuous data blocks corresponding to at least one thread among N threads, and combining one or more data blocks with a first fast register address from the first cache data; and in a case where the combined data does not include data blocks of M threads among N threads, continuing to read second cache data corresponding to a second cache address of the cache controller, and combining one or more data blocks with the first fast register address from the second cache data, until it is determined that the combined data includes data blocks of M threads among N threads.
[0008] According to some embodiments of the present disclosure, cache data corresponding to a cache address of a cache controller is read, and the read cache data is combined according to a storage rule for thread data in a fast register, including: reading P rows of cache data corresponding to P cache addresses of the cache controller respectively, wherein P is an integer greater than 1; and storing the P rows of cache data into a storage unit of the cache controller according to the storage rule for thread data in the fast register, wherein data blocks having the same fast register storage address are stored in the same row of the storage unit, and data blocks having different fast register storage addresses are stored in different rows of the storage unit.
[0009] According to some embodiments of the present disclosure, moving the combined data to the fast register includes: moving the data in the storage unit to the fast register row by row.
[0010] According to some embodiments of the present disclosure, the data transfer method for fast registers further includes: reading data from an off-chip memory of the processor to a cache controller.
[0011] According to another aspect of the present disclosure, a processor is also provided. According to some embodiments of the present disclosure, the processor includes a computing unit and a cache controller, the computing unit includes a fast register, and the cache controller is configured with a combination unit, wherein the combination unit of the cache controller is configured to: read cache data corresponding to the cache address of the cache controller; combine the read cache data according to the storage rule of thread data in the fast register, so that the combined data includes data blocks of M threads among N threads of the processor, wherein M and N are integers greater than 1, and M is not greater than N; and move the combined data to the fast register.
[0012] According to some embodiments of the present disclosure, cache data corresponding to a cache address of a cache controller includes one or more continuous data blocks corresponding to at least one thread among N threads, wherein a combination unit combines the read cache data according to a storage rule of thread data in a fast register, including: for one or more continuous data blocks corresponding to at least one thread among the N threads, combining data blocks with the same fast register storage address into the same group of data, and combining data blocks with different fast register storage addresses into different groups of data.
[0013] According to some embodiments of the present disclosure, the combining unit moving the combined data to the fast register comprises: in response to determining that the same group of data includes data blocks of M threads among N threads, moving the same group of data to the fast register.
[0014] According to some embodiments of the present disclosure, a combination unit reads cache data corresponding to a cache address of a cache controller, and combines the read cache data according to a storage rule of thread data in a fast register, including: reading first cache data corresponding to a first cache address of the cache controller, wherein the first cache data includes one or more continuous data blocks corresponding to at least one thread among N threads, and combining one or more data blocks with a first fast register address from the first cache data; and in a case where the combined data does not include data blocks of M threads among N threads, continuing to read second cache data corresponding to a second cache address of the cache controller, and combining one or more data blocks with the first fast register address from the second cache data, until it is determined that the combined data includes data blocks of M threads among N threads.
[0015] According to some embodiments of the present disclosure, a storage unit is further configured for the cache controller, and the combination unit reads cache data corresponding to the cache address of the cache controller, and combines the read cache data according to the storage rule of thread data in the fast register, including: reading P rows of cache data corresponding to P cache addresses of the cache controller respectively, wherein P is an integer greater than 1; and storing the P rows of cache data to the storage unit according to the storage rule of thread data in the fast register, wherein data blocks with the same fast register storage address are stored in the same row of the storage unit, and data blocks with different fast register storage addresses are stored in different rows of the storage unit.
[0016] According to some embodiments of the present disclosure, the combining unit moving the combined data to the fast register comprises: moving the data in the storage unit to the fast register row by row.
[0017] According to some embodiments of the present disclosure, the processor further includes an off-chip memory, wherein the cache controller reads data from the off-chip memory to the cache controller.
[0018] According to some embodiments of the present disclosure, the cache controller is one of the following: an L1 level cache; an L2 level cache; and a cache accelerator, wherein the cache accelerator includes a memory access controller.
[0019] According to another aspect of the present disclosure, a computing device is provided. According to an embodiment of the present disclosure, the computing device includes a computing unit, a cache controller, and a memory, wherein a computer readable code is stored in the memory, and when the computer readable code is executed by the cache controller, the cache controller executes the data transfer method for a fast register as described above.
[0020] By utilizing the data transfer method, processor, and computing device for the fast register provided by the embodiments of the present disclosure, it is possible to combine the data to be transmitted to the fast register according to the storage rules of the thread data in the fast register, so that the combined data includes data blocks of multiple threads of the processor, and then transfer the combined data to the fast register, thereby reducing the occupancy of the fast register memory access interface by data transfer and improving the operating efficiency of the processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 A schematic diagram showing the storage method of thread data in fast registers is shown;
[0023] Figure 2 A schematic diagram showing the storage method of thread data in a cache controller is shown;
[0024] Figure 3 A schematic flow chart of a method for transferring data of a fast register according to some embodiments of the present disclosure is shown;
[0025] Figure 4 Another schematic flow chart of a method for transferring data of a fast register according to some embodiments of the present disclosure is shown;
[0026] Figure 5 A schematic diagram showing data transfer from a cache controller to a fast register in the related art is shown;
[0027] Figure 6 A schematic diagram showing data transfer from a cache controller to a fast register according to some embodiments of the present disclosure is shown;
[0028] Figure 7 A schematic block diagram of a processor according to some embodiments of the present disclosure is shown;
[0029] Figure 8 Another schematic block diagram of a processor according to some embodiments of the present disclosure is shown;
[0030] Fig. 9 A schematic block diagram of a computing device according to some embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0031] The technical solutions in the embodiments of the present disclosure will be described clearly and completely below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0032] In addition, unless the context clearly indicates an exception, the words "a", "an", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The words "first", "second" and similar words used in this disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "include" or "comprise" mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
[0033] Flowcharts are used in this disclosure to illustrate the steps of the method according to the embodiments of the present disclosure. It should be understood that the preceding or following steps are not necessarily performed precisely in order. On the contrary, various steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes.
[0034] It is to be understood that the professional terms, nouns and the like involved in this document have meanings well known to those skilled in the art.
[0035] With the development of more general computing scenarios such as artificial intelligence, higher requirements are placed on the computing power, processing efficiency, bandwidth, etc. of processor chips. How to provide high-performance general computing devices in terms of software and hardware has become an important research direction.
[0036] The present disclosure provides a data transfer method, processor, and computing device for a fast register, which can realize combining data to be transmitted to the fast register according to the storage rules of thread data in the fast register, so that the combined data includes data blocks of multiple threads of the processor, and then the combined data is transferred to the fast register, thereby reducing the occupancy of the fast register memory access interface by data transfer and improving the operating efficiency of the processor.
[0037] One or more processors may be configured in an electronic device. As an example, the processor may refer to a graphics processing unit (GPU), which may also be called a display core, a visual processor, a display chip, etc. It is a processor that is specifically used to perform image and graphics related operations in a device. The GPU can reduce the graphics card's dependence on the central processing unit (CPU) and perform some of the work originally performed by the CPU. The processor may be configured with multiple computing units (computing units), or they may also be called computing cores, for performing computing processes such as vector computing.
[0038] As an example, the processor mentioned in the present disclosure can be implemented as the above-mentioned graphics processor GPU, for example, for implementing specialized image processing. In addition, the processor can also be implemented in other forms, such as general-purpose computing on graphics processing units (GPGPU), neural network processing unit (NPU), tensor processing unit (TPU), etc., which are not listed one by one here.
[0039] Generally, a processor is configured with a multi-level storage structure, for example, it may include on-chip memory and off-chip memory. The on-chip memory may include fast registers located inside the computing unit and a multi-level cache architecture located outside the computing unit. The fast registers located inside the computing unit have the fastest access speed but small storage space, and the off-chip memory located outside the chip (such as dynamic random access memory (DRAM)) has the largest storage space and the longest access delay. The cache is in the middle in terms of access speed and storage space. It can read data in the off-chip memory in advance based on the processor's access rules to save the processor's data access time.
[0040] As an example, the fast registers inside the computing unit can be implemented as a register file or an on-chip high-speed static random access memory (SRAM). In order to support multi-threaded operation, the storage space of the fast registers can be divided according to the maximum number of threads supported by the processor, that is, each thread corresponds to an independent storage space, and the amount of storage data corresponding to each thread may be different. The thread word length can be 8 bits / 16 bits / 32 bits / 64 bits, depending on the size of the effective word length that the processor can process per physical cycle.
[0041] Figure 1 A schematic diagram showing how thread data is stored in fast registers is shown. Figure 1 In the example, four threads of a processor are used. It is understood that the number of threads of a processor is not limited to this. Figure 1 In the figure, T1 represents thread 1, T2 represents thread 2, T3 represents thread 3, T4 represents thread 4, addr1, addr2 and addrn represent different fast register storage addresses, and T1_ele1 represents data block 1 (element 1) of thread 1, T1_ele2 represents data block 2 of thread 1, and so on.
[0042] refer to Figure 1 , the thread data is arranged vertically in the fast register, that is, the data blocks 1 to n corresponding to thread 1 are stored at the addresses of addr1-addrn, and so on. With this storage method, the processor can use one address to read the data of multiple threads at a time to perform calculations simultaneously, thereby improving the multi-thread processing capability of the processor. For example, using addr1, the processor can read the data block 1 of each thread from thread 1 to thread 4 at a time.
[0043] Generally, the processor uses a cache controller to transfer data to a fast register, and thus, the efficiency of the cache controller in transferring data will affect the operating rate of the processor. As an example, the cache controller can be implemented as an L1 cache or an L2 cache of the above-mentioned multi-level cache architecture, that is, the data is transferred to the fast register via the L1 cache or the L2 cache. In addition, the cache controller can also be implemented as a dedicated cache accelerator, for example, the cache accelerator can be a memory access controller (memory access accelerator). The present disclosure does not limit the specific implementation form of the above-mentioned cache controller.
[0044] Figure 2 FIG. 4 shows a schematic diagram of how thread data is stored in a cache controller. Figure 2As shown, a cache address Addr1 can store data of different threads and can include one or more continuous data blocks of the same thread. This is due to the general protocol of the cache controller reading data from the off-chip memory. In this way, the data throughput of the bus can be improved and the data reading efficiency can be improved.
[0045] Compare Figure 1 and Figure 2 It can be seen that the thread data is stored differently in the cache controller and the fast register. When the cache controller transfers data to the fast register, since the fast register can only receive data corresponding to one address at a time (i.e., receive data corresponding to the fast register storage address addr1 at a time), the cache controller needs to transfer two different data blocks of a thread to the fast register twice. For example, the cache controller will Figure 2 The two data blocks T3_ele1 and T3_ele2 of the T3 thread shown in the figure need to be moved to the fast register twice, that is, once to move the data block T3_ele1 to the fast register storage address addr1, and another time to move the data block T3_ele2 to the fast register storage address addr2, that is, the access interface of the fast register needs to be occupied twice.
[0046] Therefore, due to the different storage methods of the above-mentioned thread data in the cache controller and the fast register, the cache controller cannot fully utilize the bandwidth when transferring data to the fast register, and the effective data actually transferred at a single time is small, resulting in bandwidth waste, affecting the operating efficiency of the processor, and increasing the power consumption of data transfer. In addition, when the cache controller transfers fragmented data blocks to the fast register, the access interface of the fast register will be frequently occupied, which will reduce the time for other resources in the processor to access the fast register and affect the efficiency of the processor in processing other transactions.
[0047] In response to the defects existing in the process of transferring data from the above-mentioned cache controller to the fast register, the present disclosure proposes to use the cache controller to splice out one or more complete fast register entries as much as possible before transferring data to the fast register, and then the cache controller sends the spliced entries to the fast register, thereby improving the efficiency of transferring data to the fast register, making full use of the interface bandwidth, reducing the occupancy of the access interface to the fast register, reducing the power consumption of data transfer and improving the processing efficiency of the processor.
[0048] According to one aspect of the present disclosure, a method for transferring data for a fast register is provided. Specifically, Figure 3 A schematic flow chart of a method for transferring data of a fast register according to some embodiments of the present disclosure is shown. Figure 3The data handling method provided by the present disclosure is described in detail.
[0049] like Figure 3 As shown, the data handling method according to the embodiment of the present disclosure includes steps S101 to S103. First, in step S101, cache data corresponding to the cache address of the cache controller is read.
[0050] According to the cache controller of the embodiment of the present disclosure, the cache controller can be implemented as the L1 cache or L2 cache of the above-mentioned multi-level cache architecture, that is, the data is moved to the fast register via the L1 cache or L2 cache. In addition, the cache controller can also be implemented as a special cache accelerator, for example, it can be the above-mentioned memory access controller. The present disclosure does not limit the specific implementation form of the above-mentioned cache controller. For the convenience of description, the following description takes the L1 cache as a specific example of the cache controller, that is, the data is moved from the L1 cache to the fast register.
[0051] It is understood that the data stored in the cache controller may be referred to as cache data, and the cache data of a cache address may include one or more continuous data blocks corresponding to at least one thread among the multiple threads of the processor. Figure 2 It shows how the data of different threads are stored in the cache controller. According to some embodiments of the present disclosure, before performing the above step S101, the data transfer method may also include: reading data from the off-chip memory of the processor to the cache controller. That is, the L1 level cache can read one or more continuous data blocks belonging to different threads from the off-chip storage at one time, and store them at a cache address such as Addr1. In general, the data in the off-chip memory is first transmitted to the cache controller, and then transferred from the cache controller to the fast register for direct use by the computing unit of the processor.
[0052] Next, in step S102, the read cache data is combined according to the storage rules of thread data in the fast register, so that the combined data includes data blocks of M threads among the N threads of the processor, where M and N are integers greater than 1, and M is not greater than N. In step S103, the combined data is moved to the fast register. As an example, N can be set to 3, 4 or more, and M can be set to be equal to N, or it can be set to be less than N, such as equal to N-1, etc., which is not limited here.
[0053] For example, the method according to the embodiment of the present disclosure may first read cache data corresponding to one or more cache addresses of the cache controller, and then store the cache data in the fast register according to the storage rules of the thread data (such as Figure 1As shown in the figure, the read cache data is combined so that the combined data includes a data block of each of the four threads (i.e., N=M=4), for example, data block 1 (T1_ele1, T2_ele1, T3_ele1, and T4_ele1) of the four threads corresponding to the fast register storage address addr1. Since the combined data corresponds to the same fast register storage address addr1, the cache controller can move the combined data to the fast register at one time, thereby improving data moving efficiency.
[0054] In order to avoid the above-mentioned shortcomings caused by the different storage methods of the thread data in the cache controller and the fast register, the data handling method disclosed in the present invention proposes to combine the read cache data according to the storage rules of the thread data in the fast register, so that the combined data includes data blocks of multiple threads of the processor. That is, before the data is handled, the data of different threads of the cache controller are reorganized according to the arrangement method of the fast controller, and then the reorganized data is handled, so that as many data blocks as possible are transmitted through one data handling.
[0055] According to some embodiments of the present disclosure, cache data corresponding to a cache address of a cache controller includes one or more continuous data blocks corresponding to at least one thread among N threads, which can refer to Figure 2 Further, according to an embodiment of the present disclosure, combining the read cache data according to the storage rule of thread data in the fast register includes: for one or more continuous data blocks corresponding to at least one thread among N threads, combining data blocks with the same fast register storage address into the same group of data, and combining data blocks with different fast register storage addresses into different groups of data; and in response to determining that the same group of data includes data blocks of M threads among N threads, moving the same group of data to the fast register.
[0056] Taking N=M=4 as an example, a group of combined data includes data blocks of each of the four threads and has the same fast register storage address, for example, addr1, so that the same group of combined data can be moved to the fast register together.
[0057] According to some embodiments of the present disclosure, reading cache data corresponding to a cache address of a cache controller and combining the read cache data according to a storage rule of thread data in a fast register includes: reading first cache data corresponding to a first cache address of the cache controller, wherein the first cache data includes one or more continuous data blocks corresponding to at least one thread among N threads, and combining one or more data blocks with a first fast register address from the first cache data; and in a case where the combined data does not include data blocks of M threads among N threads, continuing to read second cache data corresponding to a second cache address of the cache controller, and combining one or more data blocks with the first fast register address from the second cache data, until it is determined that the combined data includes data blocks of M threads among N threads.
[0058] by Figure 1 and Figure 2 Taking the data block storage situation shown in the figure as an example, in some cases, only reading the cache data of Addr1 of the cache controller may not be enough to combine and obtain the data blocks of the four threads corresponding to addr1. For example, Figure 2 The Addr1 shown in does not include the data block T2_ele1 of thread 2. In this case, the cache data such as Addr2 of the cache controller can be further read, and if it is determined that a set of data obtained based on the combination of Addr1 and Addr2 includes the data blocks of each thread of the four threads corresponding to the same fast register storage address addr1, that is, T1_ele1, T2_ele1, T3_ele1 and T4_ele1, the combined data can be moved to the fast register together.
[0059] It is understandable that in the implementation according to the embodiment of the present disclosure, the specific values of N and M and the number of rows of cache data read when combining can be pre-set according to actual application requirements, scenarios, etc., and the two can be used in conjunction. In addition, the above values can also be set dynamically, which is not limited here.
[0060] As an example, N and M can be set to the same value, such as 4, and sent to the fast register only when the combined data includes the data blocks of each of the four threads. As another example, N and M can be set to different values, such as N=4, M=3, and sent to the fast register when the combined data includes the data blocks of three of the four threads. As another example, the value of M may not be affected by the number of rows of cache data read when combining, that is, multiple rows of cache data are read until the combined data includes the data blocks of M of the N threads and is sent to the fast register. As another example, the value of M may be affected by the number of rows of cache data read for combination. For example, two rows of cache data may be combined at a time. The combination is first performed based on Addr1, and a determination is made as to whether the combined data includes data blocks of M threads out of N threads (for example, M is set to 4). If not, the data of Addr1 is continued to be read for combination. In this case, the combined data is sent to the fast register even if the data of only three threads out of N threads is included. This implementation method may avoid the long waiting time for reading more rows of cache data to implement the data combination process.
[0061] According to some embodiments of the present disclosure, in the process of combining data, a storage unit can also be configured for the cache controller to realize combining the read cache data according to the storage rules of the thread data in the fast register. In these embodiments, reading the cache data corresponding to the cache address of the cache controller, and combining the read cache data according to the storage rules of the thread data in the fast register can include: reading P rows of cache data corresponding to P cache addresses of the cache controller respectively, wherein P is an integer greater than 1; and storing P rows of cache data in the storage unit of the cache controller according to the storage rules of the thread data in the fast register, wherein data blocks with the same fast register storage address are stored in the same row of the storage unit, and data blocks with different fast register storage addresses are stored in different rows of the storage unit. As an example, P can be set to a value equal to 2 or 3, which is not limited here. Further, according to the data handling method of the embodiment of the present disclosure, the data in the storage unit can be moved to the fast register row by row, because the data blocks with the same fast register storage address are stored in the same row of the storage unit.
[0062] As an example, Figure 4 Another schematic flow chart of a method for transferring data of a fast register according to some embodiments of the present disclosure is shown.
[0063] refer to Figure 4According to some embodiments of the present disclosure, a data transfer method for a fast register may include steps S201-S204. First, in step S201, data is read from an off-chip memory of a processor to a cache controller. For example, data in the off-chip memory is read to cache addresses such as Addr1 and Addr2 as cache data to improve the throughput of a bus. The cache data corresponding to a cache address of the cache controller may include one or more continuous data blocks of at least one thread among multiple threads. For example, different data blocks of four threads may be read at one time, and for a certain thread, one or more continuous data blocks of the thread may be included.
[0064] Next, in step S202, P rows of cache data corresponding to P cache addresses of the cache controller are read respectively. For example, P is set to be equal to 2, that is, the cache data of cache addresses Addr1 and Addr2 are read respectively. In step S203, the P rows of cache data are stored in the storage unit of the cache controller according to the storage rules of thread data in the fast register, wherein data blocks with the same fast register storage address are stored in the same row of the storage unit, and data blocks with different fast register storage addresses are stored in different rows of the storage unit. In these implementations, the data processing bandwidth is increased for the above-mentioned data combination process, so that the cache controller can be used to store the read data as follows: Figure 1 The thread data is arranged in a storage rule in the fast register, which can further improve the data transfer efficiency on the basis of reducing the occupation of the fast register interface. Next, in step S204, the data in the storage unit is transferred to the fast register row by row.
[0065] In order to explain in more detail the implementation process of the data transfer method for fast registers according to the embodiment of the present disclosure and reflect the improvement effect of the method of the present disclosure on data transfer, the following describes Figure 5-Figure 6 Specific examples shown.
[0066] Figure 5 A schematic diagram showing data transfer from a cache controller to a fast register in the related art is shown. Figure 6 A schematic diagram showing data transfer from a cache controller to a fast register according to some embodiments of the present disclosure is shown.
[0067] Since thread data is stored differently in the cache controller and the fast register, and when the cache controller transfers data to the fast register, the fast register can only receive data from one address at a time, two different data blocks (corresponding to different fast register addresses) of a thread must be transferred from the cache controller to the fast register twice. Figure 5As shown, after reading the data of Addr1, the cache controller does not combine the read data, but directly moves it to the fast register according to the clock cycle.
[0068] In this case, if Figure 5 As shown, in clock cycle C1, the data block corresponding to the fast register address addr1 in Addr1 is moved to the fast register, namely T4_ele1 and T3_ele1; in clock cycle C2, the data block corresponding to the fast register address addr2 in Addr1 is moved to the fast register, namely T3_ele2 and T1_ele2; in clock cycle C3, the data block corresponding to the fast register address addr3 in Addr1 is moved to the fast register, namely T1_ele3.
[0069] In addition, during clock cycle C3, the cache controller can continue to read the cache data of Addr2, and the cache controller can read data and move data to the fast register simultaneously. Then, in clock cycle C4, the data block corresponding to the fast register address addr1 in Addr2 is moved to the fast register, namely T2_ele1 and T1_ele1; in clock cycle C5, the data block corresponding to the fast register address addr2 in Addr2 is moved to the fast register, namely T4_ele2 and T2_ele2; and in clock cycle C6, the data block corresponding to the fast register address addr3 in Addr2 is moved to the fast register, namely T4_ele3, T3_ele3 and T2_ele3. Therefore, in order to Figure 5 The two lines of cache data (Addr1 and Addr2) shown above are moved to the fast register. The cache controller requires a total of 6 clock cycles and occupies the fast register interface 6 times. The data granularity is small each time, which wastes bandwidth resources and occupies the fast register access interface for a long time, affecting the processing efficiency of the processor.
[0070] In comparison, the method according to the embodiment of the present disclosure proposes that before data movement, the read cache data is first combined according to the storage rules of the thread data in the fast register, and then the combined data is moved, so that as many data blocks as possible can be transmitted through one data movement to reduce the occupancy of the fast register interface.
[0071] like Figure 6As shown, according to some embodiments of the present disclosure, for two lines of cache data of Addr1 and Addr2, first, in clock cycle C1, the cache data of Addr1 is read and stored in the storage unit of the cache controller according to the storage rule of thread data in the fast register, that is, the data of the cache controller is reorganized according to the storage rule of thread data in the fast register; then, in clock cycle C2, the cache data of Addr2 is further read and stored in the storage unit of the cache controller according to the storage rule of thread data in the fast register. Figure 6 Since an additional storage unit for data combination is added, it is possible to more quickly combine data blocks of different threads according to the storage rules of thread data in the fast register.
[0072] Then, at the same time of clock cycle C2, the first row of data in the storage unit is moved to the fast register, that is, T4_ele1, T3_ele1, T2_ele1 and T1_ele1 are moved to addr1 of the fast register at one time; at clock cycle C3, the second row of data in the storage unit is moved to the fast register, that is, T4_ele2, T3_ele2, T2_ele2 and T1_ele2 are moved to addr2 of the fast register at one time; finally, at clock cycle C4, the third row of data in the storage unit is moved to the fast register, that is, T4_ele3, T3_ele3, T2_ele3 and T1_ele3 are moved to addr3 of the fast register at one time. It can be understood that at the same time of clock cycle C4, the cache data of the next row can also be read, for example, the data of Addr3 is read, and the cache data is stored in the storage unit of the cache controller according to the storage rules of the thread data in the fast register, and so on, which will not be repeated here.
[0073] exist Figure 6 In the implementation method according to the embodiment of the present disclosure shown, the same is true for transport and Figure 5 To cache two lines of data (Addr1 and Addr2) with the same data content, a total of four clock cycles are required. Furthermore, only three fast register interfaces need to be occupied, that is, three data transfer processes are performed. The data granularity of each transfer is large, and the bandwidth resources are fully utilized, which reduces the occupancy of the fast register access interface, is beneficial to improving data transfer efficiency, and is beneficial to improving the operating efficiency of the processor.
[0074] for Figure 5 and Figure 6In the case of 2 lines of cache data shown, without increasing the storage unit, it takes a total of 6 clock cycles to split the cache data of Addr1 and Addr2 into 3 fast register data. However, due to the step of combining the read cache data according to the storage rules of thread data in the fast register according to the embodiment of the present disclosure, the final transfer to the fast register only requires 3 fast register interfaces, which effectively reduces the occupancy of the fast register interface and is beneficial to improving the processing efficiency of the processor.
[0075] By utilizing the data transfer method for the fast register provided in the embodiment of the present disclosure, it is possible to combine the data to be sent to the fast register according to the storage rules of the thread data in the fast register, so that the combined data includes data blocks of multiple threads of the processor, and then transfer the combined data to the fast register, thereby reducing the occupancy of the fast register memory access interface and improving the processing efficiency of the processor.
[0076] According to another aspect of the present disclosure, a processor is also provided. Figure 7 A schematic block diagram of a processor according to some embodiments of the present disclosure is shown.
[0077] like Figure 7 As shown, the processor 1000 according to the embodiment of the present disclosure may include a computing unit 1010 and a cache controller 1020, the computing unit 1010 may include a fast register 1011 inside, and the cache controller is configured with a combination unit 1021. According to the embodiment of the present disclosure, the combination unit 1021 of the cache controller may be configured to: read cache data corresponding to the cache address of the cache controller; combine the read cache data according to the storage rule of thread data in the fast register, so that the combined data includes data blocks of M threads among the N threads of the processor, wherein M and N are integers greater than 1, and M is not greater than N; and move the combined data to the fast register.
[0078] As an example, the processor 1000 may be a high-performance processing chip for processing big data such as neural networks, for example, the aforementioned GPU, GPGPU, etc., which is not limited here. It is understandable that the processor 1000 may also include other components for implementing computing functions.
[0079] The processor uses a cache controller to transfer data to a fast register. According to some embodiments of the present disclosure, the cache controller may be one of the following: an L1 cache, an L2 cache, or a cache accelerator. As an example, the cache accelerator may be a memory access controller. It is understood that the present disclosure does not limit the specific implementation form of the cache controller.
[0080] According to some embodiments of the present disclosure, the processor 1000 may further include an off-chip memory, wherein the cache controller reads data from the off-chip memory to the cache controller.
[0081] According to some embodiments of the present disclosure, cache data corresponding to a cache address of a cache controller includes one or more continuous data blocks corresponding to at least one thread among N threads, wherein the combination unit 1021 combines the read cache data according to the storage rule of thread data in the fast register, including: for one or more continuous data blocks corresponding to at least one thread among the N threads, combining data blocks with the same fast register storage address into the same group of data, and combining data blocks with different fast register storage addresses into different groups of data.
[0082] According to some embodiments of the present disclosure, the combining unit 1021 moves the combined data to the fast register, including: in response to determining that the same group of data includes data blocks of M threads among N threads, moving the same group of data to the fast register.
[0083] According to some embodiments of the present disclosure, the combination unit 1021 reads cache data corresponding to a cache address of a cache controller, and combines the read cache data according to a storage rule of thread data in a fast register, including: reading first cache data corresponding to a first cache address of the cache controller, wherein the first cache data includes one or more continuous data blocks corresponding to at least one thread among N threads, and combining one or more data blocks with a first fast register address from the first cache data; and in a case where the combined data does not include data blocks of M threads among N threads, continuing to read second cache data corresponding to a second cache address of the cache controller, and combining one or more data blocks with a first fast register address from the second cache data, until it is determined that the combined data includes data blocks of M threads among N threads.
[0084] According to some embodiments of the present disclosure, a storage unit is further configured for the cache controller, and the combination unit 1021 reads cache data corresponding to the cache address of the cache controller, and combines the read cache data according to the storage rule of thread data in the fast register, including: reading P rows of cache data corresponding to P cache addresses of the cache controller respectively, where P is an integer greater than 1; and storing M rows of cache data to the storage unit according to the storage rule of thread data in the fast register, wherein data blocks with the same fast register storage address are stored in the same row of the storage unit, and data blocks with different fast register storage addresses are stored in different rows of the storage unit.
[0085] According to some embodiments of the present disclosure, the combining unit 1021 moves the combined data to the fast register, including: moving the data in the storage unit to the fast register row by row.
[0086] The processor according to the embodiment of the present disclosure can implement the specific execution process of functions such as data processing and transmission. In addition, the processor according to the embodiment of the present disclosure can specifically implement the steps of the data transfer method for fast registers according to some embodiments of the present disclosure described above in conjunction with the accompanying drawings, which will not be repeated here. The processor using the embodiment of the present disclosure can perform a similar data transfer process and achieve similar technical effects.
[0087] Figure 8 Another schematic block diagram of a processor according to some embodiments of the present disclosure is shown. Figure 8 The processor shown also includes an off-chip memory 1040. In addition, the cache controller in the processor 1000 is implemented as an L1 level cache 1030, which is configured with a combination unit 1031 and a storage unit 1032 for implementing the solution according to the embodiment of the present disclosure to move cache data to the fast register 1011.
[0088] like Figure 8 As shown, according to some embodiments of the present disclosure, the L1 cache 1030 first reads the data of the off-chip memory 1040 into the L1 cache 1030. As an example, the data can be read directly from the off-chip memory 1040 to the L1 cache 1030. As another example, the data can also be read to the L1 cache 1030 via other components, for example, via the L2 cache, which will not be repeated here. Next, the combination unit 1031 of the L1 cache 1030 reads the cache data and stores the cache data to the storage unit 1032 according to the storage rules of the thread data in the fast register, wherein data blocks with the same fast register storage address are stored in the same row of the storage unit 1032, and data blocks with different fast register storage addresses are stored in different rows of the storage unit 1032. Then, the L1 cache moves the data in the storage unit 1031 to the fast register 1011 row by row. The processor 1000 can implement the above data moving process in combination with the above for Figure 6 The description will not be repeated here.
[0089] According to yet another aspect of the present disclosure, a computing device is provided. Fig. 9 A schematic block diagram of a computing device according to some embodiments of the present disclosure is shown.
[0090] like Fig. 9As shown, the computing device 2000 may include a computing unit 2010, a cache controller 2020, and a memory 2030. The memory stores a computer-readable code, which, when executed by the cache controller, enables the cache controller to perform the steps of the data handling method described above.
[0091] The computing device 2000 may also perform various actions and processes according to the programs stored in the memory 2030. Specifically, the computing device 2000 may be the aforementioned GPU, or any conventional processor, etc.
[0092] The memory 2030 may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. It should be noted that the memory described herein may be any suitable type of memory. As an example, by executing the computer-readable code in the memory 2030, the cache controller in the computing device can implement the steps of the data handling method described above in conjunction with the accompanying drawings.
[0093] The embodiments of the present disclosure provide a data transfer method, a processor, and a computing device for a fast register, which are used to reduce the occupancy of a fast register access interface and improve the operating efficiency of the processor.
[0094] By utilizing the data transfer method, processor, and computing device for the fast register provided by the embodiments of the present disclosure, it is possible to combine the data to be sent to the fast register according to the storage rules of the thread data in the fast register, so that the combined data includes data blocks of multiple threads of the processor, and then transfer the combined data to the fast register, thereby reducing the occupancy of the fast register memory access interface and improving the processing efficiency of the processor.
[0095] Those skilled in the art will appreciate that the contents disclosed in this disclosure may be subject to various modifications and improvements. For example, the various devices or components described above may be implemented by hardware, or by software, firmware, or a combination of some or all of the three.
[0096] In addition, although the present disclosure makes various references to certain units in a computing device or computing apparatus according to an embodiment of the present disclosure, any number of different units may be used and run on a client and / or server. The units are merely illustrative, and different aspects of the method, computing device, or computing apparatus may use different units.
[0097] Those skilled in the art will appreciate that all or part of the steps in the above method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk. Optionally, all or part of the steps in the above embodiment can also be implemented using one or more integrated circuits. Accordingly, each module / unit in the above embodiment can be implemented in the form of hardware or in the form of a software functional module. The present disclosure is not limited to any particular form of combination of hardware and software.
[0098] Unless otherwise defined, all terms used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the present disclosure belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology, and should not be interpreted in an idealized or highly formal sense, unless explicitly defined as such herein.
[0099] The above is an explanation of the present disclosure and should not be considered as a limitation thereof. Although several exemplary embodiments of the present disclosure are described, it will be readily understood by those skilled in the art that many modifications may be made to the exemplary embodiments without departing from the novel teachings and advantages of the present disclosure. Therefore, all such modifications are intended to be included within the scope of the present disclosure as defined in the claims. It should be understood that the above is an explanation of the present disclosure and should not be considered to be limited to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are intended to be included within the scope of the appended claims. The present disclosure is defined by the claims and their equivalents.
Claims
1. A method for data transfer of a fast register, It is characterized in that The method comprises: Reading cache data corresponding to a cache address of a cache controller; Combining the read cache data according to the storage rule of thread data in the fast register, so that the combined data includes data blocks of M threads among N threads of the processor, where M and N are integers greater than 1, and M is not greater than N; and Moving the combined data to the fast register; The step of reading cache data corresponding to a cache address of a cache controller and combining the read cache data according to a storage rule of thread data in the fast register comprises: Reading first cache data corresponding to a first cache address of the cache controller, wherein the first cache data includes one or more continuous data blocks corresponding to at least one of the N threads, and combining one or more data blocks having a first fast register address from the first cache data; and in a case where the combined data does not include data blocks of M of the N threads, continuing to read second cache data corresponding to a second cache address of the cache controller, and combining one or more data blocks having the first fast register address from the second cache data, until it is determined that the combined data includes data blocks of M of the N threads; or Respectively read P rows of cache data corresponding to P cache addresses of the cache controller, wherein P is an integer greater than 1; and store the P rows of cache data into a storage unit of the cache controller according to a storage rule of thread data in the fast register, wherein data blocks with the same fast register storage address are stored in the same row of the storage unit, and data blocks with different fast register storage addresses are stored in different rows of the storage unit.
2. The method according to claim 1, It is characterized in that The cache data corresponding to a cache address of the cache controller includes one or more continuous data blocks corresponding to at least one thread among the N threads, wherein the combining the read cache data according to the storage rule of the thread data in the fast register includes: For one or more continuous data blocks corresponding to at least one of the N threads, data blocks with the same fast register storage address are combined into the same group of data, and data blocks with different fast register storage addresses are combined into different groups of data.
3. The method according to claim 2, It is characterized in that The moving the combined data to the fast register comprises: In response to determining that the same set of data includes data blocks of M threads among the N threads, the same set of data is moved to the fast register.
4. The method according to claim 1, It is characterized in that The moving the combined data to the fast register comprises: The data in the storage unit is moved row by row to the fast register.
5. The method according to claim 1, It is characterized in that The method further comprises: Data is read from the off-chip memory of the processor to the cache controller.
6. A processor, It is characterized in that The processor includes a computing unit and a cache controller, wherein the computing unit includes a fast register, and the cache controller is configured with a combination unit, wherein the combination unit of the cache controller is configured as follows: Reading cache data corresponding to a cache address of the cache controller; Combining the read cache data according to the storage rule of thread data in the fast register, so that the combined data includes data blocks of M threads among the N threads of the processor, where M and N are integers greater than 1, and M is not greater than N; and Moving the combined data to the fast register; The step of reading cache data corresponding to a cache address of a cache controller and combining the read cache data according to a storage rule of thread data in the fast register comprises: Reading first cache data corresponding to a first cache address of the cache controller, wherein the first cache data includes one or more continuous data blocks corresponding to at least one of the N threads, and combining one or more data blocks having a first fast register address from the first cache data; and in a case where the combined data does not include data blocks of M of the N threads, continuing to read second cache data corresponding to a second cache address of the cache controller, and combining one or more data blocks having the first fast register address from the second cache data, until it is determined that the combined data includes data blocks of M of the N threads; or Respectively read P rows of cache data corresponding to P cache addresses of the cache controller, wherein P is an integer greater than 1; and store the P rows of cache data into a storage unit of the cache controller according to a storage rule of thread data in the fast register, wherein data blocks with the same fast register storage address are stored in the same row of the storage unit, and data blocks with different fast register storage addresses are stored in different rows of the storage unit.
7. The processor according to claim 6, It is characterized in that The cache data corresponding to a cache address of the cache controller includes one or more continuous data blocks corresponding to at least one thread among the N threads, wherein the combining unit combines the read cache data according to the storage rule of the thread data in the fast register, including: For one or more continuous data blocks corresponding to at least one of the N threads, data blocks with the same fast register storage address are combined into the same group of data, and data blocks with different fast register storage addresses are combined into different groups of data.
8. The processor according to claim 7, It is characterized in that The combining unit moves the combined data to the fast register, including: In response to determining that the same set of data includes data blocks of M threads among the N threads, the same set of data is moved to the fast register.
9. The processor according to claim 6, It is characterized in that The combining unit moves the combined data to the fast register, including: The data in the storage unit is moved row by row to the fast register.
10. The processor according to claim 6, It is characterized in that The processor further includes an off-chip memory, wherein the cache controller reads data from the off-chip memory to the cache controller.
11. A processor according to any one of claims 6 to 10, It is characterized in that The cache controller is one of the following: L1 cache; L2 cache; and A cache accelerator, wherein the cache accelerator comprises a memory access controller.
12. A computing device, It is characterized in that The computing device comprises a computing unit, a cache controller and a memory, wherein the memory stores a computer-readable code, and when the computer-readable code is executed by the cache controller, the cache controller executes the steps of the method according to any one of claims 1 to 5.
