Off-chip memory data read-write method and device and chip

By determining the data arrangement method and burst transmission length of high-bandwidth memory, it is blocked and processed, the read and write efficiency of off-chip memory is improved, and the problem of low read and write efficiency in the existing technology is solved. It is suitable for multi-core differentiation Construct the processor environment.

CN119003409APending Publication Date: 2024-11-22SHANGHAI BIREN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411206537.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

The low read and write efficiency of high-bandwidth memory makes it difficult to meet the bandwidth and capacity requirements of memory in the fields of high-performance computing, artificial intelligence, etc.

Method used

By determining the data arrangement method of off-chip memory, the burst transmission length between off-chip memory and on-chip registers is determined, and the off-chip memory is blocked, and the starting coordinates of each block are determined to realize the data Efficient transmission.

Benefits of technology

Improves the data transmission efficiency between on-chip registers and off-chip memory, reduces the complexity of data reading and writing, reduces the number of address transmissions and bus applications, and is suitable for different types of off-chip memory, avoiding the increase of on-chip register resources. need.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003409A_ABST
    Figure CN119003409A_ABST
Patent Text Reader

Abstract

The invention provides an off-chip memory data read-write method and device and a chip, and relates to the technical field of integrated circuits, and the method comprises the following steps: determining a data arrangement mode of an off-chip memory; based on the data arrangement mode, determining the burst length of data burst transmission between the off-chip memory and the on-chip register; partitioning the off-chip memory on the basis of the burst length, and determining a starting coordinate of each partition; and performing data transmission between each block of the off-chip memory and the on-chip register based on the burst length and the initial coordinate of each block. According to the method and the device provided by the invention, the data transmission efficiency between the on-chip register and the off-chip memory is improved, and the data read-write efficiency of the off-chip memory is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of integrated circuit technology, and in particular to a method, device and chip for reading and writing data in an off-chip memory. Background Art

[0002] With the advent of the big data era, traditional memory technology has been unable to meet the growing computing needs. In the fields of high-performance computing, artificial intelligence, data centers, and high-end games, the requirements for memory bandwidth and capacity are getting higher and higher. Against this background, High Bandwidth Memory (HBM) technology came into being.

[0003] As an off-chip memory, the data arrangement methods of different types of high-bandwidth memory are generally different. When data is transmitted between on-chip registers and high-bandwidth memory, it faces high read and write complexity, which makes the read and write efficiency of high-bandwidth memory low.

[0004] Therefore, how to improve the read and write efficiency of off-chip memory has become a technical problem that needs to be solved urgently in the industry. Summary of the invention

[0005] The present application provides a method, device and chip for reading and writing data in an off-chip memory, which are used to solve the technical problem of how to improve the reading and writing efficiency of the off-chip memory.

[0006] The present application provides a method for reading and writing data from an off-chip memory, comprising: Determine the data arrangement of off-chip memory; Based on the data arrangement mode, determining a burst length for performing a data burst transmission between the off-chip memory and the on-chip register; Divide the off-chip memory into blocks based on the burst length, and determine the starting coordinates of each block; Based on the burst length and the starting coordinates of each block, data is transmitted between each block of the off-chip memory and the on-chip register.

[0007] In some embodiments, determining the burst length of data burst transmission between the off-chip memory and the on-chip register based on the data arrangement mode includes: Based on the data arrangement mode, the storage unit size, data index direction and burst length supported by the off-chip memory in the case of data burst transmission are determined.

[0008] In some embodiments, dividing the off-chip memory into blocks based on the burst length and determining the starting coordinates of each block includes: Determining a current read / write area in the off-chip memory; The current read-write area is divided into blocks based on the storage unit size and the burst length, and a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block are determined.

[0009] In some embodiments, dividing the current read-write area into blocks based on the storage unit size and the burst length, and determining a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block includes: Determining that the off-chip memory supports data burst transmission of multiple burst lengths; Arrange the multiple burst lengths in descending order to generate a burst length list; Determine a maximum burst length in the burst length list, and determine a first block size based on the storage unit size and the maximum burst length; When the first block size is smaller than or equal to the size of the current read-write area, the current read-write area is divided into blocks based on the first block size, and a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block are determined.

[0010] In some embodiments, after determining the first block size based on the storage unit size and the maximum burst length, the method further includes: In the case where the first block size is larger than the size of the current read / write area, the current burst length is determined in descending order in the burst length list; the current burst length is smaller than the maximum burst length; Determining a second block size based on the storage unit size and the current burst length; The current read-write area is divided into blocks based on the second block size, and a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block are determined.

[0011] In some embodiments, the data transmission between each block of the off-chip memory and the on-chip register based on the burst length and the starting coordinates of each block includes: Determining a coordinate offset based on the storage unit size and the burst length; Based on the starting coordinates of each block, the coordinate offset and the data index direction, data is transmitted between each block in the off-chip memory and the on-chip register.

[0012] The present application provides an off-chip memory data reading and writing device, comprising: A first determination module is used to determine the data arrangement mode of the off-chip memory; A second determination module is used to determine the burst length of data burst transmission between the off-chip memory and the on-chip register based on the data arrangement mode; A data block module, used to block the off-chip memory based on the burst length and determine the starting coordinates of each block; The data transmission module is used for performing data transmission between each block of the off-chip memory and the on-chip register based on the burst length and the starting coordinates of each block.

[0013] The present application provides a chip, including an off-chip memory data reading and writing device and an on-chip register; The off-chip memory data reading and writing device is connected to the on-chip register and the off-chip memory, and is used to execute the off-chip memory data reading and writing method.

[0014] The present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the off-chip memory data reading and writing method when executing the computer program.

[0015] The present application provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the off-chip memory data reading and writing method is implemented.

[0016] The off-chip memory data reading and writing method, device and chip provided by the present application determine the data arrangement mode of the off-chip memory; determine the burst length of the data burst transmission between the off-chip memory and the on-chip register based on the data arrangement mode; divide the off-chip memory into blocks based on the burst length, and determine the starting coordinates of each block; based on the burst length and the starting coordinates of each block, data is transmitted between each block of the off-chip memory and the on-chip register; since data reading and writing is realized between the off-chip memory and the on-chip register through burst transmission, the number of address transmissions and the number of bus applications can be reduced, the data transmission efficiency between the on-chip register and the off-chip memory is improved, and the data reading and writing efficiency of the off-chip memory is improved; since the burst length for burst transmission is determined according to the data arrangement mode of the off-chip memory, it is suitable for reading and writing different types of off-chip memories, reducing the complexity of data reading and writing of the off-chip memory; and the amount of data transmitted continuously in a single burst transmission mode is the same, and the coordinate offset is also the same, which is irrelevant to the heterogeneous computing characteristics, and there is no need to increase the use of scalar registers in on-chip registers, which will not cause the resource usage of scalar registers in on-chip registers to be tight. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0018] In order to more clearly illustrate the technical solutions in the present application or 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 some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 It is a flowchart of the off-chip memory data reading and writing method provided by this application.

[0020] Figure 2 It is a schematic diagram of a single block provided by this application.

[0021] Figure 3 It is a schematic diagram of the current read-write area provided by this application.

[0022] Figure 4 It is a structural schematic diagram of the off-chip memory data reading and writing device provided by this application.

[0023] Figure 5 This is one of the schematic diagrams of the structure of the chip provided in this application.

[0024] Figure 6 This is the second structural schematic diagram of the chip provided in this application.

[0025] Figure 7 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first", "second" etc. in the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable in appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units or modules need not be limited to those steps or units or modules clearly listed, but may include other steps or units or modules that are not clearly listed or inherent to these processes, methods, products or equipment.

[0028] In the related art, when data is transmitted between on-chip registers and high-bandwidth memory, there is also the problem of on-chip resource limitations caused by multi-core heterogeneous processors. Multi-core heterogeneous processors integrate multiple different types of processing cores, and different computing cores have different heterogeneous computing characteristics when processing data, including data parallelism, model parallelism, input data size changes (dynamic shape), operator elimination in graph mode, etc. Each heterogeneous computing feature will increase the use of scalar registers in on-chip registers when reading and writing data. For example, when calculating coordinate offsets, two scalar registers will be applied, one scalar register is used to store the offset value, and the other scalar register is used to store the result of the offset plus the original coordinates, which makes the on-chip resources on the processor tight and affects the performance of the processor.

[0029] In order to solve the shortcomings of related technologies, Figure 1 is a flow chart of the off-chip memory data reading and writing method provided by this application, such as Figure 1 As shown, the method includes: Step 110: Determine the data arrangement mode of the off-chip memory.

[0030] Specifically, the execution subject of the off-chip memory data reading and writing method provided in the embodiment of the present application is an off-chip memory data reading and writing device. The device can be implemented by software, such as an off-chip memory data reading and writing program; it can also be a device that executes the off-chip memory data reading and writing method, such as various types of graphics processing units (GPUs) and general-purpose graphics processing units (GPGPUs), as well as mobile terminals, tablet computers, desktop computers or servers containing these processors.

[0031] Off-chip memory refers to memory that is set outside the processor chip, such as high-bandwidth memory (HBM). Data arrangement refers to the storage and organization of data in memory, which can directly affect the data reading and writing method and reading and writing efficiency. Data arrangement can include information such as memory alignment, byte alignment, address space and access mode.

[0032] It can communicate with the off-chip memory and obtain the data arrangement of the off-chip memory through data query.

[0033] Step 120: Determine the burst length of data burst transmission between the off-chip memory and the on-chip register based on the data arrangement mode.

[0034] Specifically, data burst transmission refers to a mode of data transmission between two devices, which can also be called data transmission in burst mode. Burst transmission refers to the way of continuous data transmission between adjacent storage units in the same row. Burst stage refers to the cycle of continuous transmission. Since one storage unit generally requires one cycle, the burst length can also refer to the number of storage units in a single continuous transmission. By transmitting multiple storage units as one unit (equivalent to one data block), the entire channel is dedicated to transmitting data from one data source, reducing the number of address transmissions and bus application times, and improving transmission efficiency. It can be understood that the higher the data transmission efficiency, the higher the read and write efficiency of the off-chip memory.

[0035] On-chip registers refer to registers set inside the processor chip. On-chip registers are usually used as a place for the processor to temporarily store data, including data to be processed or processed data. On-chip registers are the fastest storage components accessed by the processor, which can effectively reduce the number of times the processor accesses the memory, but due to the limitations of chip area and integration technology, the capacity of the registers is also the smallest.

[0036] When data bursts are transmitted between an off-chip memory and an on-chip register, the burst length may be determined according to the data arrangement of the off-chip memory.

[0037] Step 130: Divide the off-chip memory into blocks based on the burst length, and determine the starting coordinates of each block.

[0038] Specifically, the amount of data transmitted continuously in a single data burst transmission can be determined according to the burst length, thereby tiling the off-chip memory, and determining the starting coordinates of each block according to the tiling result. In the embodiment of the present application, the coordinates refer to the position coordinates of the address space, which can be divided into row coordinates and column coordinates. For example, (32, 64) means that the row coordinate is 32 and the column coordinate is 64.

[0039] It is understandable that the off-chip memory may be divided into blocks, either the entire off-chip memory or a portion of the read-write area in the off-chip memory.

[0040] For example, the size of the read / write area in the off-chip memory that needs to be used for data transmission is 64*128 (rows*columns), representing 8192 data. The starting coordinates of the data in the read / write area are (0, 0) and the ending coordinates are (64, 128). In data burst transmission, the size of a storage unit is 8*64 (rows*columns). Based on the burst length of 4, it can be determined that the size of the data for a single continuous transmission is 32*64 (rows*columns). The size of the read / write area can be divided into blocks to obtain 4 blocks, and the starting coordinates of each block are (0, 0), (0, 64), (32, 0) and (32, 64) respectively.

[0041] Step 140: Based on the burst length and the starting coordinates of each block, data is transmitted between each block of the off-chip memory and the on-chip register.

[0042] Specifically, according to the burst length and the starting coordinates of each block, the storage units contained in a block can be transferred as a whole between the off-chip memory and the on-chip register, thereby realizing the reading and writing of data in the off-chip memory, for example, reading the data to be processed in the off-chip memory to the on-chip register, or writing the processed data in the on-chip register to the off-chip memory.

[0043] The off-chip memory data reading and writing method provided in the embodiment of the present application determines the data arrangement mode of the off-chip memory; based on the data arrangement mode, determines the burst length of the data burst transmission between the off-chip memory and the on-chip register; divides the off-chip memory into blocks based on the burst length, and determines the starting coordinates of each block; based on the burst length and the starting coordinates of each block, transmits data between each block of the off-chip memory and the on-chip register; since the data reading and writing is realized between the off-chip memory and the on-chip register through burst transmission, the number of address transmissions and the number of bus applications can be reduced, the data transmission efficiency between the on-chip register and the off-chip memory is improved, and the data reading and writing efficiency of the off-chip memory is improved; since the burst length for burst transmission is determined according to the data arrangement mode of the off-chip memory, it is suitable for reading and writing different types of off-chip memories, reducing the complexity of data reading and writing of the off-chip memory; and the amount of data transmitted continuously in a single burst transmission mode is the same, and the coordinate offset is also the same, which is irrelevant to the heterogeneous computing characteristics, and there is no need to increase the use of scalar registers in on-chip registers, which will not cause the resource usage of scalar registers in on-chip registers to be tight.

[0044] It should be noted that each implementation method of the present application can be freely combined, the order can be changed, or it can be executed separately, and does not need to rely on or depend on a fixed execution order.

[0045] In some embodiments, determining a burst length for performing a data burst transmission between an off-chip memory and an on-chip register based on a data arrangement method includes: Based on the data arrangement, determine the storage unit size of the off-chip memory, the data index direction, and the burst length supported in the case of data burst transmission.

[0046] Specifically, a storage unit refers to a unit module for storing data in an off-chip memory. For example, in an off-chip memory, the size of a storage unit can be 8*64 (rows*columns), which means that 512 data can be stored. Each data is stored by a minimum storage unit. There are 512 minimum storage units in total, arranged in 8 rows and 64 columns. If each data is a bit, the minimum storage unit can be a bit memory or a register.

[0047] The data index direction refers to the direction of positioning access when reading and writing data in the off-chip memory. For example, the data index direction may include row first, column second, or column first, row second.

[0048] The off-chip memory can usually support multiple burst lengths in the case of data burst transmission. For example, the burst length can be 4, 2, and 1, which respectively means that the off-chip memory can support 4 storage units as a whole for transmission, 2 storage units as a whole for transmission, or 1 storage unit as a whole for transmission in the case of data burst transmission.

[0049] The storage unit size, data index direction and burst length supported in case of data burst transmission of the above off-chip memory can all be determined according to the data arrangement mode of the off-chip memory.

[0050] The off-chip memory data reading and writing method provided in the embodiment of the present application determines the storage unit size of the off-chip memory, the data index direction and the burst length supported in the case of data burst transmission according to the data arrangement method, which helps to realize the blocking of the off-chip memory, realize burst transmission between the off-chip memory and the on-chip register, and improves the data reading and writing efficiency of the off-chip memory.

[0051] In some embodiments, dividing the off-chip memory into blocks based on the burst length and determining the starting coordinates of each block includes: Determine the current read and write area in the off-chip memory; The current read-write area is divided into blocks based on the storage unit size and the burst length, and a plurality of blocks corresponding to the current read-write area and the starting coordinates of each block are determined.

[0052] Specifically, when the storage space in the off-chip memory is large, the off-chip memory can be divided into blocks to determine the current read / write area (real shape). The current read / write area refers to the memory space where the stored data to be processed needs to be read into the on-chip register or the processed data needs to be written into the on-chip register.

[0053] The size of a single block can be determined based on the storage unit size and the burst length. Figure 2 is a schematic diagram of a single block provided by this application, such as Figure 2 As shown, the storage unit size is 8*64, the burst length is 4, and the data index direction in the figure is row first and then column. Then, the index can be performed in the row direction to determine the size of a single block.

[0054] The current read-write area is divided into blocks according to the size of a single block, so that multiple blocks corresponding to the current read-write area and the starting coordinates of each block can be determined. Figure 3 is a schematic diagram of the current read-write area provided by this application, such as Figure 3 As shown in the figure, the size of the current read-write area is 64*128. The current read-write area is divided into four blocks according to the size of each block. The starting coordinates of the current read-write area are (0, 0) and the ending coordinates are (64, 128). After the division, the starting coordinates of each block are (0, 0), (0, 64), (32, 0) and (32, 64).

[0055] The off-chip memory data reading and writing method provided in the embodiment of the present application divides the current read and write area into blocks according to the storage unit size and the burst length, determines multiple blocks corresponding to the current read and write area and the starting coordinates of each block, which is conducive to burst transmission between the off-chip memory and the on-chip register, and improves the data reading and writing efficiency of the off-chip memory.

[0056] In some embodiments, dividing the current read / write area into blocks based on the storage unit size and the burst length, and determining a plurality of blocks corresponding to the current read / write area and the starting coordinates of each block include: Determine whether the off-chip memory supports data burst transfers of multiple burst lengths; Arrange multiple burst lengths in descending order to generate a burst length list; Determine a maximum burst length in the burst length list, and determine a first block size based on the storage unit size and the maximum burst length; When the first block size is smaller than or equal to the size of the current read-write area, the current read-write area is divided into blocks based on the first block size, and multiple blocks corresponding to the current read-write area and the starting coordinates of each block are determined.

[0057] Specifically, the off-chip memory may support data burst transmissions of multiple burst lengths, for example, a certain off-chip memory supports data burst transmissions of three burst lengths, namely 1, 2 and 4. The multiple burst lengths may be arranged in descending order to generate a burst length list, such as {4, 2, 1}.

[0058] In order to improve data transmission efficiency, the maximum burst length can be determined in the burst length list, and the first block size can be determined according to the storage unit size and the maximum burst length. The current read-write area is divided into blocks according to the first block size, and multiple blocks corresponding to the current read-write area and the starting coordinates of each block are determined.

[0059] For example, in the above embodiment, the size of the first block is 32*64, which means that during the data burst transmission, a maximum of 32*64 data can be transmitted at one time, which is 1 / 4 of the current read / write area (64*128).

[0060] The off-chip memory data reading and writing method provided in the embodiment of the present application determines the first block size according to the storage unit size and the maximum burst length, and divides the current read and write area into blocks based on the first block size, which can maximize the data transmission efficiency, reduce the number of data transmission times, and improve the data reading and writing efficiency of the off-chip memory.

[0061] In some embodiments, after determining the first block size based on the storage unit size and the maximum burst length, the method further includes: In the case where the first block size is larger than the current read / write area, the current burst length is determined in descending order in the burst length list; the current burst length is smaller than the maximum burst length; Determine a second block size based on the storage unit size and the current burst length; The current read-write area is divided into blocks based on the second block size, and a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block are determined.

[0062] Specifically, generally, when the off-chip memory is divided into blocks, each obtained read-write area supports data transmission of a maximum burst length by default, that is, each read-write area is larger than the first block size.

[0063] If the first block size is larger than the current read / write area, it means that the block size does not match the current read / write area. For example, if the data to be processed is read into the on-chip register, more useless data may be sent to the on-chip register, which makes the register resource of the on-chip register tight; if the processed data is written into the off-chip memory, excess memory space may be used, which wastes the memory space of the off-chip memory.

[0064] At this time, the current burst length can be determined in the burst length list in descending order. The current burst length is less than the maximum burst length. For example, in the above embodiment, if the first block size determined by the maximum burst length of 4 is larger than the current read-write area, then the burst length of 2 can be selected to determine the second block size. The current read-write area is divided into blocks according to the second block size, and multiple blocks corresponding to the current read-write area and the starting coordinates of each block are determined.

[0065] The off-chip memory data reading and writing method provided in the embodiment of the present application, when the first block size is larger than the current read and write area, determines the current burst length in the burst length list in descending order, determines the second block size according to the current burst length, and blocks the current read and write area according to the second block size, which can avoid occupying the register resources of the on-chip registers and avoid wasting the memory space of the off-chip memory.

[0066] In some embodiments, based on the burst length and the starting coordinates of each block, data transmission is performed between each block of the off-chip memory and the on-chip register, including: Based on the storage unit size and the burst length, a coordinate offset is determined; Based on the starting coordinates, coordinate offset and data index direction of each block, data is transferred between each block of the off-chip memory and the on-chip register.

[0067] Specifically, the coordinate offset is determined according to the storage unit size and the burst length. For example, in the above embodiment, the block size can be determined to be 32*64 according to the storage unit size 8*64 and the burst length 4, and the coordinate offset can be determined to be 32 for the row coordinate offset and 64 for the column coordinate offset.

[0068] Data is transmitted for each block according to the starting coordinates, coordinate offset and data index direction of each block. For example, in the above embodiment, the current read-write area is divided into 4 blocks. When data is transmitted, it needs to be transmitted 4 times. In each transmission, the starting coordinates of the blocks are (0, 0), (0, 64), (32, 0) and (32, 64). When calculating row coordinates, the row coordinate offset is 32; when calculating column coordinates, the column coordinate offset is 64. During transmission, the data index direction needs to be considered. Since the data index direction is row first and column second, the read-write direction of the block is first executed twice in the row direction and then twice in the column direction.

[0069] From the perspective of data reading and writing, the starting coordinates of the block each time the data is transmitted are determined by the block mode, and the coordinate offset and the starting coordinates of the block determine the ending coordinates of the block.

[0070] From the perspective of the use of scalar registers, both the coordinate offset and the starting coordinates need to use scalar registers. In the related art, due to the different characteristics of heterogeneous computing, each time an offset calculation is performed, a scalar register needs to be applied for storing the coordinate offset, but in the solution of the embodiment of the present application, the coordinate offsets are the same, which is independent of the heterogeneous computing characteristics. In multiple offset calculations, only one scalar register needs to be applied, and there is no need to increase the use of scalar registers in the on-chip registers.

[0071] The off-chip memory data reading and writing method provided in the embodiment of the present application performs data transmission between each block of the off-chip memory and the on-chip register according to the starting coordinates, coordinate offset and data index direction of each block. Since the amount of data transmitted in a single continuous transmission in the burst transmission mode is the same, the coordinate offset is also the same, and it is irrelevant to the heterogeneous computing characteristics, there is no need to increase the use of scalar registers in the on-chip registers, and will not cause resource tension in the scalar registers in the on-chip registers.

[0072] The device provided in the embodiment of the present application is described below. The device described below and the method described above can be referenced to each other.

[0073] Figure 4 is a schematic diagram of the structure of the off-chip memory data reading and writing device provided by the present application, such as Figure 4 As shown, the off-chip memory data reading and writing device includes: A first determination module 410 is used to determine the data arrangement mode of the off-chip memory; A second determination module 420, for determining a burst length for data burst transmission between an off-chip memory and an on-chip register based on a data arrangement mode; The data block module 430 is used to block the off-chip memory based on the burst length and determine the starting coordinates of each block; The data transmission module 440 is used to perform data transmission between each block of the off-chip memory and the on-chip register based on the burst length and the starting coordinates of each block.

[0074] The off-chip memory data reading and writing device provided by the embodiment of the present application determines the data arrangement mode of the off-chip memory; determines the burst length of the data burst transmission between the off-chip memory and the on-chip register based on the data arrangement mode; divides the off-chip memory into blocks based on the burst length, and determines the starting coordinates of each block; based on the burst length and the starting coordinates of each block, transmits data between each block of the off-chip memory and the on-chip register; since data reading and writing is realized between the off-chip memory and the on-chip register through burst transmission, the number of address transmissions and the number of bus applications can be reduced, the data transmission efficiency between the on-chip register and the off-chip memory is improved, and the data reading and writing efficiency of the off-chip memory is improved; since the burst length for burst transmission is determined according to the data arrangement mode of the off-chip memory, it is suitable for reading and writing different types of off-chip memories, reducing the complexity of data reading and writing of the off-chip memory; and the amount of data transmitted continuously in a single burst transmission mode is the same, and the coordinate offset is also the same, which is irrelevant to the heterogeneous computing characteristics, and there is no need to increase the use of scalar registers in on-chip registers, which will not cause the resource usage of scalar registers in on-chip registers to be tight.

[0075] In some embodiments, the second determination module is used to: Based on the data arrangement, determine the storage unit size of the off-chip memory, the data index direction, and the burst length supported in the case of data burst transmission.

[0076] In some embodiments, the data chunking module is used to: Determine the current read and write area in the off-chip memory; The current read-write area is divided into blocks based on the storage unit size and the burst length, and a plurality of blocks corresponding to the current read-write area and the starting coordinates of each block are determined.

[0077] In some embodiments, the data chunking module is used to: Determine whether the off-chip memory supports data burst transfers of multiple burst lengths; Arrange multiple burst lengths in descending order to generate a burst length list; Determine a maximum burst length in the burst length list, and determine a first block size based on the storage unit size and the maximum burst length; When the first block size is smaller than or equal to the size of the current read-write area, the current read-write area is divided into blocks based on the first block size, and multiple blocks corresponding to the current read-write area and the starting coordinates of each block are determined.

[0078] In some embodiments, the data chunking module is used to: In the case where the first block size is larger than the current read / write area, the current burst length is determined in descending order in the burst length list; the current burst length is smaller than the maximum burst length; Determine a second block size based on the storage unit size and the current burst length; The current read-write area is divided into blocks based on the second block size, and a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block are determined.

[0079] In some embodiments, the data transmission module is used to: Based on the storage unit size and the burst length, a coordinate offset is determined; Based on the starting coordinates, coordinate offset and data index direction of each block, data is transferred between each block of the off-chip memory and the on-chip register.

[0080] Figure 5 is one of the schematic diagrams of the structure of the chip provided in this application, such as Figure 5 As shown, the chip 500 includes an off-chip memory data reading and writing device 510 and an on-chip register 520; the off-chip memory data reading and writing device 510 is connected to the on-chip register 520 and the off-chip memory 600, and is used to execute the off-chip memory data reading and writing method in the above embodiment.

[0081] The chip provided in the embodiment of the present application includes an off-chip memory data reading and writing device, and can realize data reading and writing between the off-chip memory and the on-chip register through burst transmission, which can reduce the number of address transmission times and the number of bus application times, improve the data transmission efficiency between the on-chip register and the off-chip memory, and improve the data reading and writing efficiency of the off-chip memory; since the burst length of the burst transmission is determined according to the data arrangement method of the off-chip memory, it is suitable for reading and writing different types of off-chip memories, reducing the complexity of data reading and writing of the off-chip memory; and the amount of data transmitted continuously in a single burst transmission mode is the same, and the coordinate offset is also the same, which is irrelevant to the heterogeneous computing characteristics, and there is no need to increase the use of scalar registers in the on-chip registers, which will not cause the resource usage of the scalar registers in the on-chip registers to be tight.

[0082] Figure 6 This is the second schematic diagram of the structure of the chip provided by this application, such as Figure 6 As shown, the chip is a multi-core heterogeneous chip, including vector computing cores (Vector Core) and tensor computing cores (Tensor Core).

[0083] The vector computing core includes multiple computing units (CUs) that perform traditional scalar and vector operations. The tensor computing core acts as an AI computing accelerator to perform convolution operations or matrix multiplication.

[0084] Different computing cores exchange small blocks of data through register files, which have fast access speeds but relatively limited capacity.

[0085] The register stack is connected to the high-bandwidth memory (HBM) set outside the chip, and can execute the off-chip memory data reading and writing method in the above embodiment, read the data in the high-bandwidth memory for calculation by different computing cores, thereby improving the data processing efficiency of the chip.

[0086] Although different computing cores have different heterogeneous computing characteristics, the coordinate offset is the same during the reading and writing of off-chip memory, which is irrelevant to the heterogeneous computing characteristics. There is no need to increase the use of scalar registers in the on-chip registers, which will not cause resource tension in the scalar registers in the on-chip registers.

[0087] Figure 7 is a schematic diagram of the structure of the electronic device provided by this application, such as Figure 7 As shown, the electronic device may include: a processor (Processor) 710, a communication interface (Communications Interface) 720, a memory (Memory) 730 and a communication bus (Communications Bus) 740, wherein the processor 710, the communication interface 720, and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic command in the memory 730 to execute the method described in the above embodiment, for example: Determine the data arrangement mode of the off-chip memory; based on the data arrangement mode, determine the burst length of the data burst transmission between the off-chip memory and the on-chip register; divide the off-chip memory into blocks based on the burst length, and determine the starting coordinates of each block; based on the burst length and the starting coordinates of each block, perform data transmission between each block of the off-chip memory and the on-chip register.

[0088] In addition, the logical commands in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several commands to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.

[0089] The processor in the electronic device provided in the embodiment of the present application can call the logic instructions in the memory to implement the above method. Its specific implementation method is consistent with the implementation method of the aforementioned method and can achieve the same beneficial effects, which will not be repeated here.

[0090] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the methods provided in the above embodiments are implemented.

[0091] Its specific implementation is consistent with the aforementioned method implementation and can achieve the same beneficial effects, so it will not be repeated here.

[0092] An embodiment of the present application provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0093] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0094] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for reading and writing data from an off-chip memory, characterized in that: include: Determine the data arrangement of off-chip memory; Based on the data arrangement mode, determining a burst length for performing a data burst transmission between the off-chip memory and the on-chip register; Divide the off-chip memory into blocks based on the burst length, and determine the starting coordinates of each block; Based on the burst length and the starting coordinates of each block, data is transmitted between each block of the off-chip memory and the on-chip register.

2. The off-chip memory data reading and writing method according to claim 1, characterized in that: The step of determining a burst length of data burst transmission between the off-chip memory and the on-chip register based on the data arrangement mode includes: Based on the data arrangement mode, the storage unit size, data index direction and burst length supported by the off-chip memory in the case of data burst transmission are determined.

3. The off-chip memory data reading and writing method according to claim 2, characterized in that: The dividing the off-chip memory into blocks based on the burst length and determining the starting coordinates of each block includes: Determining a current read / write area in the off-chip memory; The current read-write area is divided into blocks based on the storage unit size and the burst length, and a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block are determined.

4. The off-chip memory data reading and writing method according to claim 3, characterized in that: The dividing the current read-write area into blocks based on the storage unit size and the burst length, and determining a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block, comprises: Determining that the off-chip memory supports data burst transmission of multiple burst lengths; Arrange the multiple burst lengths in descending order to generate a burst length list; Determine a maximum burst length in the burst length list, and determine a first block size based on the storage unit size and the maximum burst length; When the first block size is smaller than or equal to the size of the current read-write area, the current read-write area is divided into blocks based on the first block size, and a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block are determined.

5. The off-chip memory data reading and writing method according to claim 4, characterized in that: After determining the first block size based on the storage unit size and the maximum burst length, the method further includes: In the case where the first block size is larger than the size of the current read / write area, the current burst length is determined in descending order in the burst length list; the current burst length is smaller than the maximum burst length; Determining a second block size based on the storage unit size and the current burst length; The current read-write area is divided into blocks based on the second block size, and a plurality of blocks corresponding to the current read-write area and a starting coordinate of each block are determined.

6. The off-chip memory data reading and writing method according to claim 2, characterized in that: The data transmission between each block of the off-chip memory and the on-chip register based on the burst length and the starting coordinates of each block includes: Determining a coordinate offset based on the storage unit size and the burst length; Based on the starting coordinates of each block, the coordinate offset and the data index direction, data is transmitted between each block in the off-chip memory and the on-chip register.

7. An off-chip memory data reading and writing device, characterized in that: include: A first determination module is used to determine the data arrangement mode of the off-chip memory; A second determination module is used to determine the burst length of data burst transmission between the off-chip memory and the on-chip register based on the data arrangement mode; A data block module, used to block the off-chip memory based on the burst length and determine the starting coordinates of each block; The data transmission module is used for performing data transmission between each block of the off-chip memory and the on-chip register based on the burst length and the starting coordinates of each block.

8. A chip, characterized in that: It includes an off-chip memory data reading and writing device and an on-chip register; The off-chip memory data reading and writing device is connected to the on-chip register and the off-chip memory, and is used to execute the off-chip memory data reading and writing method according to any one of claims 1 to 6.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the off-chip memory data reading and writing method described in any one of claims 1 to 6 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for reading and writing data in an off-chip memory as claimed in any one of claims 1 to 6 is implemented.