Data transport method, device and processor
By judging the superboundary area of the data to be transferred and generating an overall transport request, the problem of unreasonable splitting of data transport instructions is solved, and the hardware utilization and memory bandwidth utilization of the computing unit are improved.
Patent Information
- Application Number
- CN202510743416.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-06-05
AI Technical Summary
In the prior art, the splitting of the handling instructions during data transfer is unreasonable, resulting in low hardware utilization of the computing unit.
By obtaining the shape, starting coordinate and actual size of the data to be transferred, we judge whether it exceeds the original data boundary, generate a target superboundary transport request, and transfer the superboundary area as a whole.
It simplifies complex hyperboundary handling operations, reduces the overhead of multiple requests, and improves memory bandwidth and hardware utilization of computing units.
Smart Images

Figure CN120255825B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence chip technology, and in particular to a data transfer method, device, and processor. Background Art
[0002] In general computing, especially applications involving large-scale data processing (such as artificial intelligence reasoning and image processing), computing units frequently need to load or store data from high-bandwidth memory (HBM), often organized in multidimensional form. Different data transfer methods used in related technologies can affect the hardware utilization of computing units, necessitating a new data transfer method. Summary of the Invention
[0003] The present application provides a data transfer method, device and processor, which solve the technical problem of unreasonable splitting of transfer instructions during data transfer in related technologies, and achieve the technical effect of improving the hardware utilization of computing units.
[0004] In order to achieve the above objectives, the main technical solutions adopted in this application include:
[0005] In a first aspect, an embodiment of the present application provides a data transfer method, the method comprising:
[0006] Obtaining the shape and size of the data to be transported, the starting coordinates of the data to be transported in a preset coordinate system, and the actual size corresponding to the original data in the data storage device; wherein the preset coordinate system is a coordinate system constructed based on the original data;
[0007] If it is determined based on the shape size, the starting coordinates, and the actual size that the data to be transferred exceeds the original data boundary in a first dimension, determining a target out-of-bounds region of the data to be transferred in the first dimension; wherein the first dimension is a higher dimension adjacent to the second dimension having discontinuous addresses, and the target out-of-bounds region is a continuous region where the data to be transferred completely exceeds the original data boundary in the first dimension;
[0008] A corresponding target out-of-bounds transfer request is generated according to the target out-of-bounds area, so as to transfer data in at least a portion of the target out-of-bounds area as a whole through the target out-of-bounds transfer request.
[0009] Optionally, the shape and size and the starting coordinates are included in a transport instruction for transporting the data to be transported; and generating a corresponding target out-of-bounds transport request according to the target out-of-bounds area includes:
[0010] In combination with the target out-of-bounds area, the transport instruction is split in the first dimension to obtain a target out-of-bounds transport request for the target out-of-bounds area.
[0011] Optionally, the step of splitting the transport instruction in the first dimension in combination with the target out-of-bounds area to obtain a target out-of-bounds transport request for the target out-of-bounds area includes:
[0012] Determine a preset out-of-bounds form corresponding to the target out-of-bounds area;
[0013] The transport instruction is split in the first dimension using an instruction splitting method corresponding to the preset out-of-bounds form to obtain the target out-of-bounds transport request.
[0014] Optionally, the number of the target out-of-bounds area is one, and the target out-of-bounds area corresponds to a first out-of-bounds form; and the step of splitting the transport instruction along the first dimension using the instruction splitting method corresponding to the preset out-of-bounds form to obtain the target out-of-bounds transport request includes:
[0015] The first instruction splitting method corresponding to the first out-of-bounds form is adopted to split the transfer instruction in the first dimension to obtain a target out-of-bounds transfer request for the target out-of-bounds area; wherein, the target out-of-bounds area is treated as a whole for data transfer through the target out-of-bounds transfer request.
[0016] Optionally, the data to be transported is transported in a discontinuous manner, and the size of the data to be transported in the second dimension is recorded as a second size;
[0017] The size of the target out-of-bounds area in the first dimension is equal to the absolute value of the starting coordinate in the first dimension;
[0018] The size of the target out-of-bounds area in the second dimension is equal to the second size.
[0019] Optionally, the data to be transported is transported continuously, and the size of the data to be transported in the second dimension is recorded as a second size;
[0020] The number of pixels corresponding to the target out-of-bounds area is equal to the sum of the first product and the first difference; wherein, the first product is equal to the product of the second size and the second difference, the second difference is equal to the difference between the absolute value of the starting coordinate in the first dimension and 1, and the first difference is equal to the second size minus the value of the starting coordinate in the second dimension.
[0021] Optionally, there are multiple target out-of-bounds areas, and the multiple target out-of-bounds areas correspond to a second out-of-bounds form; and the step of splitting the transport instruction along the first dimension using the instruction splitting method corresponding to the preset out-of-bounds form to obtain the target out-of-bounds transport request includes:
[0022] The second instruction splitting method corresponding to the second out-of-bounds form is adopted to split the transport instruction in the first dimension to obtain a target out-of-bounds transport request corresponding to each of the multiple target out-of-bounds areas; wherein, data is transported as a whole for each corresponding target out-of-bounds area through a target out-of-bounds transport request corresponding to each target out-of-bounds area.
[0023] Optionally, the data to be transported is transported in a discontinuous manner, the multiple target out-of-bounds areas include a first out-of-bounds area and a second out-of-bounds area, the size of the data to be transported in the first dimension is recorded as a first size, the size of the data to be transported in the second dimension is recorded as a second size; and the size of the original data in the first dimension is recorded as a third size.
[0024] The size of the first out-of-bounds region in the first dimension is equal to the absolute value of the starting coordinate in the first dimension, and the size of the first out-of-bounds region in the second dimension is equal to the second size;
[0025] The size of the second out-of-bounds area in the first dimension is equal to the sum of the first size and the value of the starting coordinate in the first dimension minus the third difference of the third size, and the size of the second out-of-bounds area in the second dimension is equal to the second size.
[0026] Optionally, the data to be transported is transported continuously, the multiple target out-of-bounds areas include a first out-of-bounds area and a second out-of-bounds area, the size of the data to be transported in the first dimension is recorded as a first size, the size of the data to be transported in the second dimension is recorded as a second size; and the size of the original data in the first dimension is recorded as a third size.
[0027] The number of pixels corresponding to the first out-of-bounds area is equal to the sum of a first product and a first difference; wherein the first product is equal to the product of the second size and the second difference, the second difference is equal to the difference between the absolute value of the starting coordinate in the first dimension and 1, and the first difference is equal to the second size minus the value of the starting coordinate in the second dimension;
[0028] The number of pixels corresponding to the second out-of-bounds area is equal to the number of pixels remaining to be transferred when the data is transferred to the third size.
[0029] Optionally, the method further includes: if it is determined based on the shape size, the starting coordinates and the actual size that the data to be moved exceeds the original data boundary in each data dimension, generating an overall move request to move the data to be moved as a whole through the overall move request.
[0030] In a second aspect, an embodiment of the present application provides a data handling device, the device comprising:
[0031] A size acquisition module, configured to acquire the shape and size of the data to be transported, the starting coordinates of the data to be transported in a preset coordinate system, and the actual size corresponding to the original data in the data storage device; wherein the preset coordinate system is a coordinate system constructed based on the original data;
[0032] an out-of-bounds determination module, configured to, if it is determined based on the shape size, the starting coordinates, and the actual size that the data to be transferred exceeds the original data boundary in a first dimension, determine a target out-of-bounds region for the data to be transferred in the first dimension; wherein the first dimension is a higher dimension adjacent to the second dimension having discontinuous addresses, and the target out-of-bounds region is a continuous region in which the data to be transferred completely exceeds the original data boundary in the first dimension;
[0033] The data transport module is configured to generate a corresponding target out-of-bounds transport request according to the target out-of-bounds area, so as to carry out data transport on at least a portion of the target out-of-bounds area as a whole through the target out-of-bounds transport request.
[0034] In a third aspect, an embodiment of the present application provides a processor, which includes a logic circuit and a power supply circuit, wherein the power supply circuit is used to supply power to the logic circuit, and the logic circuit is used to execute the steps of any of the methods described above.
[0035] In a fourth aspect, an embodiment of the present application provides a chip, which includes the processor as described above.
[0036] In an embodiment of the present application, a judgment is made based on the shape and size of the data to be transported, the starting coordinates of the data to be transported in a preset coordinate system, and the actual size corresponding to the original data in the data storage device. If it is determined that the data to be transported exceeds the boundary of the original data in the first dimension, the target out-of-bounds area of the data to be transported in the first dimension is determined, and a corresponding target out-of-bounds transport request is generated according to the target out-of-bounds area, so that the target out-of-bounds area is transported as a whole through the target out-of-bounds transport request, thereby simplifying complex out-of-bounds transport operations into efficient overall operations, reducing the overhead of multiple requests, thereby improving memory bandwidth utilization, and further improving computing unit hardware utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the specific implementation methods or the description of the prior art. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0038] Figure 1 A schematic diagram of splitting transport instructions in the related art provided in an embodiment of the present application;
[0039] Figure 2 A flowchart of a data transfer method according to an embodiment of the present invention;
[0040] Figure 3 A schematic diagram of the size relationship between the data to be transported and the original data provided in an embodiment of the present application;
[0041] Figure 4 A schematic diagram of a tensor to be processed in a continuous transport mode provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of a tensor to be processed in a non-continuous transport mode provided in an embodiment of the present application;
[0043] Figure 6 A flowchart of a data transfer method according to an embodiment of the present invention;
[0044] Figure 7 A schematic diagram of an over-bound OOB provided in an embodiment of the present application;
[0045] Figure 8 A schematic diagram of the OOB provided in an embodiment of the present application;
[0046] Figure 9 A schematic diagram of bidirectional out-of-bounds OOB provided in an embodiment of the present application;
[0047] Figure 10 A schematic diagram of the size relationship between the image to be transported and the original image provided in an embodiment of the present application;
[0048] Figure 11 A schematic diagram of the framework of the data handling device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] To make the purpose, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions 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 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 those skilled in the art without making creative efforts shall fall within the scope of protection of this application.
[0050] With the rapid development of fields like artificial intelligence and high-performance computing, the demand for efficient data transfer in High-Bandwidth Memory (HBM) is increasing. Loading or storing data can also be collectively referred to as copying data. General computing operations (such as matrix operations) typically require large amounts of data, which is typically stored in memory, such as HBM. To perform general computing operations, data must be loaded from memory (a load operation) into the cache, and to obtain computational results, data must be stored from the cache back into memory (a store operation). The way data is transferred between cache and memory affects memory access bandwidth, which in turn affects the hardware utilization of the compute unit.
[0051] In the data transfer operation in the related art, the transfer instruction (or copy instruction) is split into multiple different copy requests. The principle of splitting is that the data corresponding to each copy request is either completely located in the HBM or not located in the HBM. For example, see Figure 1 Taking the example of loading a two-dimensional image from the HBM into a buffer, the image to be transferred 102 extends beyond the boundaries of the original image 104. Since the image 102 is discontinuous in the w dimension, the copy instruction is split along the w dimension based on the size relationship between the image 102 to be transferred and the original image 104. For example, the copy instruction is split into copy requests req1, req2, ..., reqn-1, reqn. By splitting the copy instruction along the w dimension, multiple copy requests (req1, req2, ..., reqn-1, reqn) are generated to load the image 102 to be transferred. By sending these multiple copy requests sequentially, the data returned by each copy request is written to the buffer.
[0052] It should be noted that continuity in a certain data dimension (denoted as X) requires meeting three conditions: 1) it is continuous in the adjacent lower dimension of data dimension X; 2) the starting coordinate of the data to be moved in the preset coordinate system determined by the original data is equal to 0; 3) the size of the data to be moved in data dimension X is equal to the size of the original data in data dimension X.
[0053] The image to be transferred 102 has an out-of-bounds region 106 in the h dimension. If the related art of splitting the copy instruction in the w dimension is used for the out-of-bounds region 106 , multiple requests are required for the out-of-bounds region 106 .
[0054] After analysis, it was found that because the out-of-bounds region 106 is continuous in the h dimension, using multiple requests to process it would result in unreasonable copy request splitting. Therefore, out-of-bounds (OOB) pre-processing can be performed on the out-of-bounds region 106, and a single copy request can be used to process the entire out-of-bounds region 106. Using a single copy request to process the out-of-bounds region 106 can reduce the number of requests and improve the hardware utilization of the computing unit.
[0055] The above is an exemplary explanation using a two-dimensional image as an example. It is understandable that tensor data can be stored in HBM. In the embodiment of the present application, the data to be transported or the original data can be tensor data in any data storage format, and the data storage format of the tensor data can be NDHWC or Among them, the data dimension N represents the batch size (batchsize), that is, the number of data samples captured in one training, the data dimension D represents the depth, the data dimension H represents the height of the input data, the data dimension W represents the width of the input data, and the data dimension C represents the number of channels.
[0056] According to an embodiment of the present application, an embodiment of a data transfer method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0057] In this embodiment, a method for transferring data to be transferred is provided, which can be used in a hardware accelerator. The hardware accelerator can be an integrated circuit module capable of accelerating the calculation and transfer of multidimensional data. For example, the hardware accelerator can be a computing device such as a graphics processing unit (GPU) or a general-purpose graphics processing unit (GPGPU), or it can be a tensor memory accelerator (TMA) in a computing device. Figure 2 This is a flow chart of the data handling method according to an embodiment of the present application. Figure 2 , the method comprises the following steps:
[0058] S110 , obtaining the shape and size of the data to be transported, the starting coordinates of the data to be transported in a preset coordinate system, and the actual size corresponding to the original data in the data storage.
[0059] The preset coordinate system is a coordinate system constructed based on the original data. The preset coordinate system includes coordinate axes corresponding to each data dimension of the original data. The starting coordinates may be the starting position of the data to be transferred in the preset coordinate system. The data storage device may be a memory unit for storing the original data; for example, the data storage device may be a high-bandwidth memory (HBM). The shape and size of the data to be transferred may be the size of the data to be transferred in each data dimension. The actual size of the original data in the data storage device may be the size of the original data in each data dimension in the data storage device.
[0060] In one example, if the original data is a 2D image (actual size W0 × H0), the shape and size of the data to be transferred can be W1 × H1, where W0 represents the width of the 2D image and H0 represents the height of the 2D image. W1 represents the width of the rectangular area to be copied, and H1 represents the height of the rectangular area to be copied.
[0061] In another example, the original data may be tensor data, and the original data may have multiple batches, and each batch may have multiple tensor data in the depth dimension. Figure 3 , Figure 3 The solid cube in the figure represents an element. The original data can be tensor data composed of multiple solid cubes. C, W, and H represent three coordinate axes respectively. Row is the coordinate value on the data dimension H, col is the coordinate value on the data dimension W, and c is the coordinate value on the data dimension C. The data dimension H represents the height of the input data, the data dimension W represents the width of the input data, and the data dimension C represents the number of channels. Figure 3 The element 202 located at the upper left corner of the tensor data is the origin of the coordinate system determined based on the original tensor, and the coordinates of the element 202 in the tensor data are: c=0, row=0 and col=0. Figure 3 The dotted box 204 is the data to be transferred, which includes not only some elements of the original data (solid small cubes), but also the dotted small cubes outside the edge of the original data. The dotted small cubes can be obtained by filling operations, and their values can be equal to 0.
[0062] In this embodiment, for subsequent out-of-bounds preprocessing operations, out-of-bounds determination is required for both the data to be transferred and the original data. Therefore, basic parameters are provided by obtaining the shape and size of the data to be transferred, the starting coordinates of the data to be transferred in a preset coordinate system, and the actual size of the original data in the data storage.
[0063] S120: If it is determined based on the shape size, the starting coordinates, and the actual size that the data to be transferred exceeds the original data boundary in the first dimension, a target out-of-bounds area of the data to be transferred in the first dimension is determined.
[0064] The first dimension is the adjacent higher dimension of the second dimension where the address is discontinuous. It is understood that the addresses are continuous in the adjacent lower dimension of the second dimension. The target out-of-bounds region is the continuous region where the data to be transferred completely exceeds the boundary of the original data in the first dimension. For example, if the first dimension is the data dimension H, the data to be transferred exceeds the boundary in the data dimension H, and the starting coordinate h_corrd_b of the data to be transferred in the data dimension H is equal to -10, then the target out-of-bounds region is the continuous region from the coordinate value -10 to the coordinate value 0 in the data dimension H.
[0065] In one example, the data storage format of the original data can be NDHWC. If the second dimension is data dimension W and the first dimension is data dimension H; or if the second dimension is data dimension H and the first dimension is data dimension D, it can be understood that if other data storage formats are used, the first and second dimensions can be deduced by analogy. For example, if the second dimension is data dimension W and the first dimension is data dimension H, the addresses on data dimension C are continuous (can be loaded continuously), and the addresses on data dimension W are discontinuous (cannot be loaded continuously), then the adjacent high dimension of data dimension W (data dimension H) can be turned to for out-of-bounds preprocessing. For another example, if the second dimension is data dimension H and the first dimension is data dimension D, the addresses on data dimension W are continuous (can be loaded continuously), and the addresses on data dimension H are discontinuous (cannot be loaded continuously), then the adjacent high dimension of data dimension H (data dimension D) can be turned to for out-of-bounds preprocessing.
[0066] In this embodiment, the shape size, starting coordinates, and actual size can be compared to determine whether the data to be transferred exceeds the bounds in a certain data dimension. If it exceeds the bounds in a certain data dimension, the target out-of-bounds area of the data to be transferred in that data dimension is determined.
[0067] Specifically, if the value of the starting coordinate in the second dimension is less than zero, it can be determined that the data is discontinuous in the second dimension, and further based on the shape and size of the data to be transported and the actual size of the original data, it can be determined whether the adjacent high dimension (first dimension) of the second dimension is out of bounds. If it is determined that the data to be transported exceeds the boundary of the original data in the first dimension, the target out-of-bounds area of the data to be transported in the first dimension can be determined based on the starting coordinates of the data to be transported in the first dimension. It is also possible to calculate based on the starting coordinates of the data to be transported in the first dimension, the size of the data to be transported in the first dimension, and the size of the original data in the first dimension to obtain the target out-of-bounds area of the data to be transported in the adjacent high dimension. For example, please continue to refer to Figure 3 The target out-of-bounds area of the data to be transferred in the data dimension H is the upper area in the dotted box 204 that exceeds the original data boundary in the data dimension H.
[0068] S130 : Generate a corresponding target out-of-bounds transfer request according to the target out-of-bounds area, so as to transfer data in at least a portion of the target out-of-bounds area as a whole through the target out-of-bounds transfer request.
[0069] Specifically, the amount of data to be transported corresponding to the target out-of-bounds transport request is determined based on the coordinates and size of the target out-of-bounds area, thereby generating a target out-of-bounds transport request. In one example, the target out-of-bounds area is treated as a whole. For example, if the target out-of-bounds area spans 10 rows in data dimension H, a target out-of-bounds transport request is generated to transport these 10 rows of data. For another example, if the number of pixels corresponding to the target out-of-bounds area is N, a target out-of-bounds transport request is generated to transport these N pixels. In another example, the target out-of-bounds area is divided. For example, if the target out-of-bounds area spans 10 rows in data dimension H, the target out-of-bounds area is divided into two sub-areas (a first sub-area and a second sub-area) in data dimension H. A target out-of-bounds transport request is generated for the first sub-area to transport the row data corresponding to the first sub-area, and a target out-of-bounds transport request is generated for the second sub-area to transport the row data corresponding to the second sub-area.
[0070] In the above embodiment, a judgment is made based on the shape and size of the data to be transported, the starting coordinates of the data to be transported in a preset coordinate system, and the actual size corresponding to the original data in the data storage device. If it is determined that the data to be transported exceeds the boundary of the original data in the first dimension, the target out-of-bounds area of the data to be transported in the first dimension is determined, and a corresponding target out-of-bounds transport request is generated based on the target out-of-bounds area, so that the target out-of-bounds area is transported as a whole through the target out-of-bounds transport request, thereby simplifying the complex out-of-bounds transport operation into an efficient overall operation, reducing the overhead of multiple requests, thereby improving the memory bandwidth utilization, and further improving the computing unit hardware utilization.
[0071] In some embodiments, the shape, size, and starting coordinates are included in a transport instruction for transporting the data to be transported. In step S130, generating a corresponding target out-of-bounds transport request based on the target out-of-bounds area may include: splitting the transport instruction along a first dimension based on the target out-of-bounds area to obtain a target out-of-bounds transport request for the target out-of-bounds area.
[0072] A transfer instruction can be a load instruction that loads the data to be transferred from the HBM into the cache, or a store instruction that stores the data to be transferred from the cache into the HBM. The transfer instruction includes the shape and size of the data to be transferred and the starting coordinates of the data to be transferred. Taking a two-dimensional image as an example, the shape and size of the data to be transferred can be expressed as (w_copy, h_copy); where w_copy is the size of the data to be transferred in data dimension W, and h_copy is the size of the data to be transferred in data dimension H. The shape and size of the data to be transferred can be expressed as (left_bound, right_bound, up_bound, down_bound); where left_bound and right_bound are the two boundaries of the data to be transferred in data dimension W, and up_bound and down_bound are the two boundaries of the data to be transferred in data dimension H.
[0073] In some cases, because corresponding target out-of-bounds transfer requests need to be generated for different target out-of-bounds areas, after determining the target out-of-bounds area, the transfer instruction is split based on the characteristics of the target out-of-bounds area, resulting in multiple requests, including the target out-of-bounds transfer request for the target out-of-bounds area. For example, the transfer instruction can be split based on the spatial relationship between the target out-of-bounds area and the original data, resulting in target out-of-bounds transfer requests corresponding to the target out-of-bounds area and normal transfer requests corresponding to the normal area. For another example, the transfer instruction can be split based on the number of target out-of-bounds areas, resulting in target out-of-bounds transfer requests corresponding to each target out-of-bounds area and normal transfer requests corresponding to the normal area. For another example, to determine whether the data to be transferred uses a continuous copy (consecutive copy) or a non-consecutive copy (non-consecutive copy) method, the transfer instruction is split based on the determination result and the out-of-bounds type corresponding to the target out-of-bounds area, resulting in target out-of-bounds transfer requests corresponding to the target out-of-bounds area and normal transfer requests corresponding to the normal area.
[0074] It should be noted that the continuous transport method refers to a method of transporting multiple consecutive pixels in the original data according to the number of pixels included in the data to be transported. For example, in the first type of calculation scenario, the number of pixels is specified in the transport instruction to continuously transport the corresponding multiple pixels. The first type of calculation scenario can be at least one of natural language processing, signal processing, image processing, etc. using convolution operations. Among them, the original data and the data to be transported can be tensor data, the original data is recorded as the original tensor, and the data to be transported is recorded as the tensor to be processed. Figure 4As shown, the starting point of the original tensor is represented as (C=0, W=0, H=0), for example, to indicate the position of the original tensor in the storage space. For example, the starting point of the tensor to be processed in the coordinate system determined by the original tensor is represented as (C=0, W=3, H=0), that is, the tensor to be processed is obtained from the third pixel in the first row of the original tensor. For example, the number of pixels included in the tensor to be processed is determined in the transfer instruction copy_pixel_num; according to Figure 4 As shown by the dotted arrow in the middle, starting from the starting point (C=0, W=3, H=0), pixels are loaded from the storage space where the original tensor is located until the number of pixels obtained reaches the number of pixels copy_pixel_num included in the tensor to be processed.
[0075] The non-continuous transport method refers to a method of transporting the data blocks in the original data as a whole according to the size of the data to be transported in each dimension. For example, in the second type of computing situation, the size of each dimension is specified in the transport instruction to transport the corresponding data block as a whole. The second type of computing situation can be at least one of computer graphics, encryption algorithms, linear system solving, etc. using matrix multiplication. The original data and the data to be transported can be tensor data, the original data is recorded as the original tensor, and the data to be transported is recorded as the tensor to be processed. Figure 5 As shown, the tensor to be processed is moved as a whole from the original tensor. The moving instruction can indicate the starting point of the original tensor to be loaded (C=0, W=0, H=0), the starting point of the tensor to be processed in the coordinate system of the original tensor (C=0, W=3, H=0), and the size of the tensor to be processed in each dimension. Figure 5 The tensor to be processed is a cuboid determined by the above starting point and the size of each dimension.
[0076] In the above embodiment, the target out-of-bounds transfer request can be understood as a request specifically used to transfer the target out-of-bounds area obtained by splitting the transfer instruction. The target out-of-bounds transfer request for the target out-of-bounds area is obtained by splitting the transfer instruction. The target out-of-bounds transfer request corresponds to the continuous data block corresponding to the out-of-bounds area on the first dimension. It is taken as a whole so that the overall transfer of the target out-of-bounds area can be achieved through a single request, reducing the number of fragmented access requests and improving memory bandwidth utilization and hardware computing efficiency.
[0077] In some embodiments, see Figure 6 , combined with the target out-of-bounds area, the transport instruction is split in the first dimension to obtain the target out-of-bounds transport request for the target out-of-bounds area, including:
[0078] S310: Determine a preset out-of-bounds form corresponding to the target out-of-bounds area.
[0079] The preset out-of-bounds form can be a predefined out-of-bounds region type, which is used to describe the specific situation where the data to be transferred exceeds the original data boundary in a certain data dimension. Specifically, by analyzing the coordinate range of the target out-of-bounds region and the positional relationship between the original data boundary, it is classified into a preset out-of-bounds form. For example, taking a two-dimensional image as an example, the preset out-of-bounds form can be Figure 7 The upper bound shown in can also be Figure 8 The lower super bound shown in can also be Figure 9 The two-way overrun shown in . A two-way overrun can be understood as the data being transferred simultaneously exceeding the upper and lower bounds of the original data. By providing a pre-set overrun form, a clear rule selection basis is provided for subsequent splitting, improving the efficiency of splitting transfer instructions.
[0080] S320: Split the transport instruction in the first dimension using an instruction splitting method corresponding to a preset out-of-bounds form to obtain a target out-of-bounds transport request.
[0081] The instruction splitting method may be a method that uses corresponding rules to split the transport instruction into multiple requests based on the type of pre-set out-of-bounds form. Specifically, since different pre-set out-of-bounds forms correspond to different instruction splitting methods, after determining the pre-set out-of-bounds form, the instruction splitting method corresponding to the pre-set out-of-bounds form can be determined. This instruction splitting method is then used to split the transport instruction along a first dimension, resulting in multiple requests, including a target out-of-bounds transport request. For example, using a two-dimensional image as an example, if the pre-set out-of-bounds form is an upper out-of-bounds region, the image to be transported can be divided into an upper out-of-bounds region and a normal region. The instruction splitting method corresponding to the upper out-of-bounds region is used to split the transport instruction along data dimension H, resulting in a target out-of-bounds transport request corresponding to the upper out-of-bounds region and a normal transport request corresponding to the normal region. If the pre-set out-of-bounds form is a lower out-of-bounds region, the image to be transported can be divided into a normal region and a lower out-of-bounds region. The instruction splitting method corresponding to the lower out-of-bounds region is used to split the transport instruction along data dimension H, resulting in a normal transport request corresponding to the normal region and a target out-of-bounds transport request corresponding to the lower out-of-bounds region. It should be noted that in the embodiment of the present application, the normal area is discontinuous in the data dimension W and needs to be split in the data dimension W to obtain the normal transfer request corresponding to the normal area. This splitting method is the same as the copy instruction splitting method in the related art.
[0082] In some embodiments, the number of target out-of-bounds regions is one, and the target out-of-bounds region corresponds to a first out-of-bounds form. Using an instruction splitting method corresponding to the preset out-of-bounds form, splitting the transfer instruction along a first dimension to obtain a target out-of-bounds transfer request may include: using a first instruction splitting method corresponding to the first out-of-bounds form, splitting the transfer instruction along the first dimension to obtain a target out-of-bounds transfer request for the target out-of-bounds region; wherein data is transferred from the target out-of-bounds region as a whole using the target out-of-bounds transfer request.
[0083] Specifically, a correspondence between the first out-of-bounds form and the first instruction splitting method is pre-established. After determining the first out-of-bounds form, the transport instruction can be split along the first dimension using the first instruction splitting method to obtain multiple requests, including the target out-of-bounds transport request.
[0084] In this embodiment, there is only one target out-of-bounds region. Combined with the instructions for splitting and moving the target out-of-bounds region, a single target out-of-bounds move request is generated for the target out-of-bounds region, thereby enabling the continuous data blocks corresponding to the target out-of-bounds region to be moved as a whole. This single request enables the entire target out-of-bounds region to be moved, reducing the number of fragmented access requests and improving memory bandwidth utilization and hardware computing efficiency.
[0085] In some embodiments, the data to be transported is transported discontinuously, and the size of the data to be transported in the second dimension is recorded as the second size; the size of the target out-of-bounds area in the first dimension is equal to the absolute value of the starting coordinate in the first dimension; the size of the target out-of-bounds area in the second dimension is equal to the second size.
[0086] For example, please refer to Figure 7 , the second dimension can be the data dimension W, and the first dimension can be the data dimension H. The starting coordinates of the data to be moved are marked as (w_coord_b, h_coord_b). The size of the data to be moved in the data dimension H is recorded as h_copy, the size of the data to be moved in the data dimension W is recorded as w_copy, the actual size of the original data in the data dimension H is recorded as h_tensor, and the actual size of the original data in the data dimension W is recorded as w_tensor. There is an upper out-of-bounds OOB in the data dimension H. The area between row=0 and row=h_coord_b in the data dimension H exceeds the boundary of the original data. The area between row=0 and row=h_coord_b can be treated as a whole to issue a target out-of-bounds move request. The size of the target out-of-bounds area in the first dimension is equal to |h_coord_b|; the size of the target out-of-bounds area in the second dimension is equal to w_copy.
[0087] In this example, the target out-of-bounds transfer request size is the product of the size of the target out-of-bounds area in the first dimension and the size of the target out-of-bounds area in the second dimension, that is, |h_coord_b|×w_copy.
[0088] It should be noted that the first instruction splitting method is used to split the transfer instruction along the first dimension, resulting in multiple requests, including a normal transfer request corresponding to the normal portion. After processing the target out-of-bounds transfer request, the normal transfer request begins processing, and h_coord_b in the normal transfer request is updated to 0.
[0089] In some embodiments, the data to be transported is transported continuously, and the size of the data to be transported in the second dimension is recorded as the second size; the number of pixels corresponding to the target out-of-bounds area is equal to the sum of the first product and the first difference; wherein the first product is equal to the product of the second size and the second difference, the second difference is equal to the difference between the absolute value of the starting coordinate in the first dimension and 1, and the first difference is equal to the second size minus the value of the starting coordinate in the second dimension.
[0090] Regardless of whether the data to be transported is transported continuously or discontinuously, the size of the target out-of-bounds area in the first dimension is equal to |h_coord_b|; the size of the target out-of-bounds area in the second dimension is equal to w_copy.
[0091] For example, please refer to Figure 7 In continuous transport mode, the number of pixels in the first row of the target out-of-bounds region in data dimension H is equal to the size of the target out-of-bounds region in data dimension W, w_copy, minus the value of the starting coordinate in the second dimension, w_coord_b, that is, w_copy - w_coord_b. The total number of pixels in all rows of data dimension H other than the first row is equal to the first product of (|h_coord_b| - 1) and w_copy.
[0092] In this example, the target out-of-bounds transfer request size is the number of pixels corresponding to the target out-of-bounds area, which is equal to (|h_coord_b|-1)×w_copy+(w_copy-w_coord_b).
[0093] It should be noted that the first instruction splitting method is used to split the transfer instruction along the first dimension, resulting in multiple requests, including a normal transfer request corresponding to the normal portion. After processing the target out-of-bounds transfer request, the normal transfer request begins processing. The copy_pixel_num in the normal transfer request is updated to the difference between the copy_pixel_num in the transfer instruction and the number of pixels corresponding to the target out-of-bounds area.
[0094] In some embodiments, there are multiple target out-of-bounds regions, and the multiple target out-of-bounds regions correspond to a second out-of-bounds form. Using an instruction splitting method corresponding to the preset out-of-bounds form, splitting the transfer instruction along a first dimension to obtain a target out-of-bounds transfer request may include: using a second instruction splitting method corresponding to the second out-of-bounds form, splitting the transfer instruction along the first dimension to obtain a target out-of-bounds transfer request corresponding to each of the multiple target out-of-bounds regions; wherein, data is transferred for each corresponding target out-of-bounds region as a whole using the target out-of-bounds transfer request corresponding to each target out-of-bounds region.
[0095] Specifically, a correspondence between the second out-of-bounds form and the second instruction splitting method is pre-established. After determining the second out-of-bounds form, the transfer instruction can be split along the first dimension using the second instruction splitting method to obtain multiple requests, including a target out-of-bounds transfer request corresponding to each target out-of-bounds area.
[0096] In this embodiment, there are multiple target out-of-bounds regions. Split transfer instructions for these multiple target out-of-bounds regions are combined to generate a target out-of-bounds transfer request for each target out-of-bounds region, thereby enabling the transfer of the contiguous data blocks corresponding to each target out-of-bounds region as a whole. This allows for the transfer of the entire target out-of-bounds region through a single request, reducing the number of fragmented access requests and improving memory bandwidth utilization and hardware computing efficiency.
[0097] In some embodiments, the data to be transferred is transferred discontinuously, and the multiple target out-of-bounds areas include a first out-of-bounds area and a second out-of-bounds area. The size of the data to be transferred in the first dimension is recorded as the first size, and the size of the data to be transferred in the second dimension is recorded as the second size; the size of the original data in the first dimension is recorded as the third size. The size of the first out-of-bounds area in the first dimension is equal to the absolute value of the starting coordinate in the first dimension, and the size of the first out-of-bounds area in the second dimension is equal to the second size. The size of the second out-of-bounds area in the first dimension is equal to the sum of the first size and the value of the starting coordinate in the first dimension minus the third difference of the third size, and the size of the second out-of-bounds area in the second dimension is equal to the second size.
[0098] For example, please refer to Figure 9The second dimension can be the data dimension W, and the first dimension can be the data dimension H. The starting coordinates of the data to be moved are denoted by (w_coord_b, h_coord_b). The size of the data to be moved in data dimension H is denoted by h_copy, the size of the data to be moved in data dimension W is denoted by w_copy, the actual size of the original data in data dimension H is denoted by h_tensor, and the actual size of the original data in data dimension W is denoted by w_tensor. There are upper out-of-bounds (OOB) and lower out-of-bounds (OOB) regions in data dimension H (the first out-of-bounds region) and lower out-of-bounds (the second out-of-bounds region).
[0099] For the first out-of-bounds region, the region between row = 0 and row = h_coord_b in data dimension H exceeds the original data boundary. A target out-of-bounds transfer request can be issued for the entire out-of-bounds region. The size of the first out-of-bounds region in the first dimension is equal to |h_coord_b|; the size of the first out-of-bounds region in the second dimension is equal to w_copy.
[0100] In this example, the target out-of-bounds transfer request size of the first out-of-bounds area is the product of the size of the first out-of-bounds area in the first dimension and the size of the first out-of-bounds area in the second dimension, ie, |h_coord_b|×w_copy.
[0101] It should be noted that the second instruction splitting method is used to split the transfer instruction along the first dimension, resulting in multiple requests, including the normal transfer request corresponding to the normal portion. After processing the target out-of-bounds transfer request for the first out-of-bounds region, processing of the normal transfer request begins. The h_coord_b in the normal transfer request is updated to 0, and the normal transfer request is executed until the h_tensor is reached. At this point, processing of the second out-of-bounds region begins.
[0102] For the second out-of-bounds region, after processing the normal transfer request, the target out-of-bounds transfer request for the second out-of-bounds region begins processing. In data dimension H, the second out-of-bounds region between row = h_tensor and row = h_coord_b + h_copy exceeds the original data boundary. A single target out-of-bounds transfer request can be issued for the second out-of-bounds region as a whole. The size of the second out-of-bounds region in the first dimension is equal to h_coord_b + h_copy - h_tensor; the size of the second out-of-bounds region in the second dimension is equal to w_copy.
[0103] In this example, the target out-of-bounds transfer request size of the second out-of-bounds area is the product of the size of the second out-of-bounds area in the first dimension and the size of the second out-of-bounds area in the second dimension, ie, (h_coord_b+h_copy-h_tensor)×w_copy.
[0104] In some embodiments, the data to be transferred is transferred continuously, and the multiple target out-of-bounds regions include a first out-of-bounds region and a second out-of-bounds region. The size of the data to be transferred in the first dimension is recorded as the first size, and the size of the data to be transferred in the second dimension is recorded as the second size; the size of the original data in the first dimension is recorded as the third size. The number of pixels corresponding to the first out-of-bounds region is equal to the sum of the first product and the first difference; wherein the first product is equal to the product of the second size and the second difference, the second difference is equal to the difference between the absolute value of the starting coordinate in the first dimension and 1, and the first difference is equal to the second size minus the value of the starting coordinate in the second dimension; the number of pixels corresponding to the second out-of-bounds region is equal to the number of pixels to be transferred remaining after the data is transferred to the third size.
[0105] Regardless of whether the data is moved continuously or discontinuously, the size of the first out-of-bounds region in the first dimension (data dimension H) is equal to |h_coord_b|; the size of the first out-of-bounds region in the second dimension (data dimension W) is equal to w_copy. The actual size of the original data in data dimension H is denoted as h_tensor, and the actual size of the original data in data dimension W is denoted as w_tensor. In data dimension H, there are upper out-of-bounds regions (first out-of-bounds regions) and lower out-of-bounds regions (second out-of-bounds regions).
[0106] For example, please refer to Figure 9 In continuous transport mode, for the first out-of-bounds region, the number of pixels in the first row of data dimension H equals the size of the first out-of-bounds region in data dimension W, w_copy, minus the value of the starting coordinate in the second dimension, w_coord_b, i.e., w_copy - w_coord_b. The total number of pixels in all rows of data dimension H other than the first row equals the first product of (|h_coord_b| - 1) and w_copy.
[0107] In this example, the target out-of-bounds transfer request size of the first out-of-bounds area is equal to the number of pixels corresponding to the first out-of-bounds area, which is equal to (|h_coord_b|-1)×w_copy+(w_copy-w_coord_b).
[0108] It should be noted that the second instruction splitting method is used to split the transfer instruction along the first dimension, resulting in multiple requests, including a normal transfer request corresponding to the normal portion. After processing the target out-of-bounds transfer request for the first out-of-bounds region, processing of the normal transfer request begins. The copy_pixel_num in the normal transfer request is updated to the difference between the copy_pixel_num in the transfer instruction and the number of pixels corresponding to the target out-of-bounds region. The normal transfer request is executed until it reaches h_tensor. At this point, processing of the second out-of-bounds region begins.
[0109] It should be noted that, in the continuous transfer mode, the number of remaining pixels to be transferred (remain_copy_pixel_num) can be calculated.
[0110] For the second out-of-bounds region, since it is about to exceed h_tensor, the lower out-of-bounds OOB processing (second out-of-bounds region) is performed. Specifically, the number of pixels in the second out-of-bounds region is equal to the number of pixels left to be transferred when the data is transferred to h_tensor, that is, remain_copy_pixel_num.
[0111] In this example, the target out-of-bounds transfer request size of the second out-of-bounds area is equal to the number of pixels corresponding to the second out-of-bounds area and is equal to remain_copy_pixel_num.
[0112] It can be understood that if the number of target out-of-bounds areas is one and there is a lower out-of-bounds OOB on the data dimension H, the processing method of the lower out-of-bounds OOB is similar to the processing method of the second out-of-bounds area in the above embodiment, and will not be repeated here.
[0113] In some embodiments, the data transfer method may further include: if it is determined based on the shape size, starting coordinates and actual size that the data to be transferred exceeds the original data boundary in each data dimension, generating an overall transfer request to transfer the data to be transferred as a whole through the overall transfer request.
[0114] A block move request is generated when the data to be moved exceeds the bounds in all dimensions. This request is used to move the entire block of data as a single entity. For example, if the data to be moved exceeds the original data boundaries in all three dimensions, a single block move request is generated to move the entire data, rather than splitting it into multiple requests.
[0115] Specifically, by comparing the starting coordinates, shape and size of the data to be moved with the actual size of the original data, we can determine whether the data to be moved exceeds the boundaries of the original data in all data dimensions. If all of them exceed the boundaries, a whole move request is generated to cover the entire data to be moved. Taking a two-dimensional image as an example, please refer to Figure 10 , the image to be transported 102 exceeds the original image 104 in both data dimension W and data dimension H.
[0116] In the above embodiment, in the extreme scenario where all data dimensions are out of bounds, an overall transfer request is generated for the data to be transferred, which effectively simplifies the operation logic of the extreme scenario, reduces the complexity of the data transfer operation, and improves the utilization of hardware resources.
[0117] See also Figure 11 In an embodiment of the present application, a data handling device 500 is also provided. The data handling device 500 includes:
[0118] The size acquisition module 510 is used to acquire the shape and size of the data to be transported, the starting coordinates of the data to be transported in a preset coordinate system, and the actual size of the original data in the data storage device; wherein the preset coordinate system is a coordinate system constructed based on the original data;
[0119] An out-of-bounds determination module 520 is configured to determine a target out-of-bounds region of the data to be transferred in the first dimension if it is determined based on the shape size, starting coordinates, and actual size that the data to be transferred exceeds the original data boundary in the first dimension; wherein the first dimension is a higher dimension adjacent to the second dimension where the address is discontinuous, and the target out-of-bounds region is a continuous region where the data to be transferred completely exceeds the original data boundary in the first dimension;
[0120] The data transfer module 530 is configured to generate a corresponding target out-of-bounds transfer request according to the target out-of-bounds area, so as to transfer data in at least a portion of the target out-of-bounds area as a whole through the target out-of-bounds transfer request.
[0121] An embodiment of the present application also provides a processor, which includes a logic circuit and a power supply circuit, wherein the power supply circuit is used to supply power to the logic circuit, and the logic circuit is used to execute the steps of the method in any of the above embodiments.
[0122] An embodiment of the present application also provides a chip, which includes the processor in the above embodiment.
[0123] The further functional description of each of the above modules is the same as that of the corresponding embodiment above and is not repeated here. The implementation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0124] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or physical devices, or by products having certain functions. For ease of description, the above devices are described separately by function in various units. Of course, when implementing this application, the functions of each unit may be implemented in the same or multiple software and / or hardware components.
[0125] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods or apparatuses. Therefore, the present application may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware.
[0126] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0127] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0128] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0129] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
[0130] Although the embodiments of the present application have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present application, and such modifications and variations shall fall within the scope defined by the appended claims.
Claims
1. A data transport method, characterized in that: The method comprises: Obtaining the shape and size of the data to be transported, the starting coordinates of the data to be transported in a preset coordinate system, and the actual size corresponding to the original data in the data storage device; wherein the preset coordinate system is a coordinate system constructed based on the original data; If it is determined based on the shape size, the starting coordinates, and the actual size that the data to be transferred exceeds the original data boundary in a first dimension, determining a target out-of-bounds region of the data to be transferred in the first dimension; wherein the first dimension is a higher dimension adjacent to the second dimension having discontinuous addresses, and the target out-of-bounds region is a continuous region where the data to be transferred completely exceeds the original data boundary in the first dimension; A corresponding target out-of-bounds transfer request is generated according to the target out-of-bounds area, so as to transfer data in at least a portion of the target out-of-bounds area as a whole through the target out-of-bounds transfer request.
2. The method according to claim 1, characterized in that The shape and size and the starting coordinates are included in a transport instruction for transporting the data to be transported; and generating a corresponding target out-of-bounds transport request according to the target out-of-bounds area includes: In combination with the target out-of-bounds area, the transport instruction is split in the first dimension to obtain a target out-of-bounds transport request for the target out-of-bounds area.
3. The method according to claim 2, characterized in that The step of splitting the transport instruction in the first dimension in combination with the target out-of-bounds area to obtain a target out-of-bounds transport request for the target out-of-bounds area includes: Determine a preset out-of-bounds form corresponding to the target out-of-bounds area; The transport instruction is split in the first dimension using an instruction splitting method corresponding to the preset out-of-bounds form to obtain the target out-of-bounds transport request.
4. The method according to claim 3, characterized in that The number of the target out-of-bounds regions is one, and the target out-of-bounds region corresponds to a first out-of-bounds form; and the instruction splitting method corresponding to the preset out-of-bounds form is adopted to split the transport instruction in the first dimension to obtain the target out-of-bounds transport request, including: The first instruction splitting method corresponding to the first out-of-bounds form is adopted to split the transfer instruction in the first dimension to obtain a target out-of-bounds transfer request for the target out-of-bounds area; wherein, the target out-of-bounds area is treated as a whole for data transfer through the target out-of-bounds transfer request.
5. The method according to claim 4, characterized in that The data to be transported is transported in a discontinuous manner, and the size of the data to be transported in the second dimension is recorded as a second size; The size of the target out-of-bounds area in the first dimension is equal to the absolute value of the starting coordinate in the first dimension; The size of the target out-of-bounds area in the second dimension is equal to the second size.
6. The method according to claim 4, characterized in that The data to be transported is transported in a continuous manner, and the size of the data to be transported in the second dimension is recorded as a second size; The number of pixels corresponding to the target out-of-bounds area is equal to the sum of the first product and the first difference; wherein, the first product is equal to the product of the second size and the second difference, the second difference is equal to the difference between the absolute value of the starting coordinate in the first dimension and 1, and the first difference is equal to the second size minus the value of the starting coordinate in the second dimension.
7. The method according to claim 3, characterized in that There are multiple target out-of-bounds areas, and the multiple target out-of-bounds areas correspond to the second out-of-bounds form; and the instruction splitting method corresponding to the preset out-of-bounds form is adopted to split the transport instruction in the first dimension to obtain the target out-of-bounds transport request, including: The second instruction splitting method corresponding to the second out-of-bounds form is adopted to split the transport instruction in the first dimension to obtain a target out-of-bounds transport request corresponding to each of the multiple target out-of-bounds areas; wherein, data is transported as a whole for each corresponding target out-of-bounds area through a target out-of-bounds transport request corresponding to each target out-of-bounds area.
8. The method according to claim 7, characterized in that The data to be transported is transported in a discontinuous manner, the multiple target out-of-bounds areas include a first out-of-bounds area and a second out-of-bounds area, the size of the data to be transported in the first dimension is recorded as a first size, the size of the data to be transported in the second dimension is recorded as a second size; and the size of the original data in the first dimension is recorded as a third size; The size of the first out-of-bounds region in the first dimension is equal to the absolute value of the starting coordinate in the first dimension, and the size of the first out-of-bounds region in the second dimension is equal to the second size; The size of the second out-of-bounds area in the first dimension is equal to the sum of the first size and the value of the starting coordinate in the first dimension minus the third difference of the third size, and the size of the second out-of-bounds area in the second dimension is equal to the second size.
9. The method according to claim 7, characterized in that The data to be transported is transported continuously, the multiple target out-of-bounds areas include a first out-of-bounds area and a second out-of-bounds area, the size of the data to be transported in the first dimension is recorded as a first size, the size of the data to be transported in the second dimension is recorded as a second size; and the size of the original data in the first dimension is recorded as a third size; The number of pixels corresponding to the first out-of-bounds area is equal to the sum of a first product and a first difference; wherein the first product is equal to the product of the second size and the second difference, the second difference is equal to the difference between the absolute value of the starting coordinate in the first dimension and 1, and the first difference is equal to the second size minus the value of the starting coordinate in the second dimension; The number of pixels corresponding to the second out-of-bounds area is equal to the number of pixels remaining to be transferred when the data is transferred to the third size.
10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: If it is determined based on the shape size, the starting coordinates and the actual size that the data to be moved exceeds the original data boundary in each data dimension, a whole move request is generated to move the data to be moved as a whole through the whole move request.
11. A data transport device, characterized in that: The device comprises: A size acquisition module, configured to acquire the shape and size of the data to be transported, the starting coordinates of the data to be transported in a preset coordinate system, and the actual size corresponding to the original data in the data storage device; wherein the preset coordinate system is a coordinate system constructed based on the original data; an out-of-bounds determination module, configured to, if it is determined based on the shape size, the starting coordinates, and the actual size that the data to be transferred exceeds the original data boundary in a first dimension, determine a target out-of-bounds region for the data to be transferred in the first dimension; wherein the first dimension is a higher dimension adjacent to the second dimension having discontinuous addresses, and the target out-of-bounds region is a continuous region in which the data to be transferred completely exceeds the original data boundary in the first dimension; The data transport module is configured to generate a corresponding target out-of-bounds transport request according to the target out-of-bounds area, so as to carry out data transport on at least a portion of the target out-of-bounds area as a whole through the target out-of-bounds transport request.
12. A processor, characterized in that: The processor includes a logic circuit and a power supply circuit, where the power supply circuit is used to supply power to the logic circuit. The logic circuit is used to execute the steps of the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Execution method and device for memory handling operator and storage medium
CN118193410A
Tensor memory carrying method and device, storage medium and program product
CN118567580A