Data processing method, processor, computer equipment and storage medium
By obtaining the current fill instruction and its mask vector, determining and processing the types and values of the target vector elements, the problem of inefficient mask processing in the prior art is solved, and the ability to efficiently process multiple data is realized.
Patent Information
- Application Number
- CN202311768594.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-20
- Publication Date
- 2025-06-20
AI Technical Summary
In scenarios involving processing data based on masks, the prior art usually uses scalar instruction processing, resulting in inefficient data processing and inability to effectively process multiple data at the same time.
By obtaining the current fill instruction and its corresponding mask vector, determining the element type of the target vector element, and determining the value of the non-mask type element based on the value of the mask type element, thereby achieving simultaneous processing of multiple data.
This method significantly improves data processing efficiency and can process multiple data more efficiently than scalar instruction processing methods.
Smart Images

Figure CN120179288A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies, and particularly to a data transmission method, a processor, a computer device, and a storage medium. Background Art
[0002] In fields such as science, finance, vision, and multimedia applications, the execution of the same processing operations for a large number of data items is involved. For the processing of large-scale data, scalar instructions usually need to load data multiple times, while vector instructions can support the processing of multiple data at a time, realizing parallel data processing and improving the working efficiency of the processor. Therefore, optimizing large and complex programs using vector instructions is an important direction.
[0003] However, when dealing with data based on a mask, due to the complex processing logic, the prior art usually still uses scalar instructions for processing, reducing the data processing efficiency. Therefore, how to process multiple data simultaneously in the scenario of processing data based on a mask, and thus improve the data processing efficiency, has become one of the technical problems that need to be urgently solved by those skilled in the art. Summary of the Invention
[0004] In view of this, this application is committed to providing a data processing method, a processor, a computer device, and a storage medium, which can process multiple data simultaneously in the scenario of processing data based on a mask, and helps to improve the data processing efficiency.
[0005] In a first aspect, this application provides a data processing method, including:
[0006] Obtaining a current fill instruction and a mask vector corresponding to the current fill instruction;
[0007] Wherein, the current fill instruction includes a current source vector and a target vector, the current source vector includes a plurality of current source vector elements, the target vector includes a plurality of target vector elements, and the current source vector elements and the target vector elements correspond to each other one by one;
[0008] Determining the element type of each of the target vector elements according to the mask vector, where the element type includes a mask type and a non-mask type;
[0009] Taking the element value of the current source vector element corresponding to the mask type target vector element as the element value of the mask type target vector element;
[0010] Determining the element value of the non-mask type target vector element at least according to the element value of the mask type target vector element.
[0011] In an optional implementation manner, the determining the element value of the non-mask type target vector element at least according to the element value of the mask type target vector element includes:
[0012] Determine the filling direction corresponding to the current filling instruction, where the filling direction is used to indicate the processing order of the target vector elements;
[0013] If the first target vector element of the target vector in the filling direction is of the mask type, determine the element value of the non-mask type target vector element according to the element value of the mask type target vector element;
[0014] If the first target vector element of the target vector in the filling direction is of the non-mask type, obtain the target scalar value and determine the element value of the non-mask type target vector element according to the target scalar value and the element value of the mask type target vector element.
[0015] In an alternative embodiment, the current filling instruction includes a direction indication field, and the direction indication field includes a first field value or a second field value;
[0016] Determining the filling direction corresponding to the current filling instruction includes:
[0017] If the direction indication field includes the first field value, determine that the filling direction corresponding to the current filling instruction is the first direction, and the first direction is the direction in which the numbers of the target registers increase from small to large, and the target registers are used to store the element values of the target vector elements;
[0018] If the direction indication field includes the second field value, determine that the filling direction corresponding to the current filling instruction is the second direction, and the second direction is the direction in which the numbers of the target registers decrease from large to small.
[0019] In an alternative embodiment, the filling direction includes the first direction;
[0020] The process of determining whether any target vector element is the first target vector element of the target vector in the filling direction includes:
[0021] Determine that the target vector element corresponding to the smallest target register number among the target vector elements is the first target vector element of the target vector.
[0022] In an alternative embodiment, the filling direction includes the second direction;
[0023] The process of determining whether any target vector element is the first target vector element of the target vector in the filling direction includes:
[0024] Determine that the target vector element corresponding to the largest target register number among the target vector elements is the first target vector element of the target vector.
[0025] In an alternative embodiment, determining the element value of the non-masked target vector element based on the element value of the masked target vector element includes:
[0026] Determining the target masked target vector element corresponding to the target non-masked target vector element;
[0027] Wherein, the target non-masked target vector element is any one of the non-masked target vector elements, and the target masked target vector element is the masked target vector element closest to the target non-masked target vector element in the opposite direction of the filling direction;
[0028] Determining the element value of the target masked target vector element as the element value of the target non-masked target vector element.
[0029] In an alternative embodiment, the data to be processed corresponding to the current source vector is carried by multiple source vectors, and any one of the source vectors is processed by a corresponding filling instruction;
[0030] Obtaining the target scalar value includes:
[0031] Determining whether the current filling instruction is the first filling instruction for processing the data to be processed;
[0032] If the current filling instruction is the first filling instruction for processing the data to be processed, determining the preset scalar value as the target scalar value;
[0033] If the current filling instruction is not the first filling instruction for processing the data to be processed, determining the target scalar value according to the previous source vector, where the previous source vector is the source vector processed by the previous filling instruction of the current filling instruction.
[0034] In an alternative embodiment, the filling directions of the filling instructions for processing the data to be processed are the same;
[0035] Determining the target scalar value according to the previous source vector includes:
[0036] Determining the element value of the last source vector element of the previous source vector in the filling direction as the target scalar value.
[0037] In an alternative embodiment, the mask vector includes a plurality of mask vector elements, and the mask vector elements correspond one-to-one with the target vector elements, and the mask vector elements include a first element value or a second element value;
[0038] Determining the element type of each target vector element according to the mask vector includes:
[0039] If the element value of the target mask vector element is the first element value, determine that the element type of the target vector element corresponding to the target mask vector element is a masked type, where the target mask vector element is any one of the mask vector elements;
[0040] If the element value of the target mask vector element is the second element value, determine that the element type of the target vector element corresponding to the target mask vector element is a non-masked type.
[0041] In a second aspect, the present application provides a processor configured to execute the data processing method according to any one of the first aspects of the present application.
[0042] In a third aspect, the present application provides a computer device including the processor according to the second aspect of the present application.
[0043] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, and when the computer program is executed, it implements the data processing method according to any one of the first aspects of the present application.
[0044] Based on the above content, through the data processing method provided by the present application, first obtain a current filling instruction and a mask vector corresponding to the current filling instruction, where the current filling instruction includes a current source vector and a target vector, the current source vector includes a plurality of current source vector elements, the target vector includes a plurality of target vector elements, and the current source vector elements and the target vector elements correspond one by one. Further, determine the element type of each target vector element according to the mask vector, use the element value of the current source vector element corresponding to the masked target vector element as the element value of the masked target vector element, and determine the element value of the non-masked target vector element at least according to the element value of the masked target vector element. The data processing method provided by the present invention can process multiple data (i.e., the element values of vector elements) simultaneously based on a mask. Compared with the method of using scalar instructions for data processing in the prior art, this method can significantly improve the data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0046] Figure 1 It is a flowchart of a data processing method provided by an embodiment of the present invention.
[0047] Figure 2It is a schematic flowchart of another data processing method provided by an embodiment of the present invention.
[0048] Figure 3 It is a schematic flowchart of yet another data processing method provided by an embodiment of the present invention.
[0049] Figures 4a to 4c It is a schematic diagram of the process of data processing in the first direction provided by an embodiment of the present invention.
[0050] Figure 5 It is a schematic flowchart of yet another data processing method provided by an embodiment of the present invention.
[0051] Figures 6a to 6c It is a schematic diagram of the process of data processing in the second direction provided by an embodiment of the present invention.
[0052] Figure 7 It is a block diagram of the structure of a computer device provided by an embodiment of the present invention. Detailed implementation manners
[0053] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0054] The data processing method provided by the present invention is applied to an electronic device. The electronic device may be a microcontroller such as a processor or a system-on-chip, or may also be a computer device, such as a laptop computer, a PC (personal computer), a tablet computer, etc., which has data processing capabilities and can run different application software; referring to Figure 1 , the data processing method provided by the embodiment of the present invention may include:
[0055] S100. Obtain a current filling instruction and a mask vector corresponding to the current filling instruction.
[0056] In practical applications, the amount of data to be processed may be very large, and it is often difficult to complete the processing with a single filling instruction. In such a case, multiple filling instructions are required to process the data to be processed. Based on this, the current filling instruction mentioned in this embodiment may be any one of the multiple filling instructions for processing the data to be processed that is currently being executed. Of course, if only one filling instruction is required to process the data to be processed, the current filling instruction mentioned in this embodiment refers to the filling instruction currently being executed for the data to be processed.
[0057] The fill instruction carries a variety of information, including but not limited to the source vector and the target vector. For other information carried in the fill instruction, it will be introduced in the subsequent content in combination with the execution process of the data processing method, and will not be elaborated here for the time being. Based on this, the current fill instruction carries the current source vector and the target vector. It should be noted that for the convenience of introducing the execution process of the data processing method, this application defines the source vector included in the current fill instruction as the current source vector. Of course, the target vector in the current fill instruction can also be referred to as the current target vector.
[0058] Specifically, the current source vector includes multiple current source vector elements. It can be understood that the element value of any current source vector element is a data in the data to be processed. The current source vector includes multiple current source vector elements, that is, it carries multiple data in the data to be processed. Further, the target vector also includes multiple target vector elements. The number of target vector elements is the same as the number of current source vector elements. More importantly, the current source vector elements and the target vector elements have a one-to-one correspondence relationship, and the subsequent process of determining the element value of the target vector element will be realized based on this correspondence relationship.
[0059] Further, in the application scenario of processing the data to be processed based on the mask, each fill instruction corresponds to a mask vector. This mask vector is used to indicate the element type of each target vector element in the aforementioned target vector, that is, to indicate whether the target vector element belongs to the masked target vector element or the non-masked target vector element. As for the generation process of the mask vector corresponding to the current fill instruction, it can be implemented with reference to the related art, and the present invention does not limit this.
[0060] In a possible implementation manner, the fill instruction may further include a mask vector applicable field. This mask vector applicable field is used to indicate whether to use the mask vector for data processing. Specifically, the mask vector applicable field includes a first field value or a second field value. When the mask vector applicable field includes the first field value, it indicates that the mask vector is applicable for data filling. On the contrary, when the mask vector applicable field includes the second field value, it indicates that the mask vector is not applicable for data filling. Of course, in the data processing method provided in this application, the mask vector applicable field in the mask instruction should all include the first field value.
[0061] S110. Determine the element type of each target vector element according to the mask vector.
[0062] In a possible implementation manner, the mask vector includes multiple mask vector elements. The number of mask vector elements is the same as the number of target vector elements in the current fill instruction, and the mask vector elements and the target vector elements are in one-to-one correspondence.
[0063] In practical applications, the elements of the mask vector include a first element value or a second element value. Based on this, each mask vector element in the mask vector is used as a target mask vector element respectively. If the element value of the target mask vector element is the first element value, it is determined that the element type of the target vector element corresponding to the target mask vector element is a masked type. On the contrary, if the element value of the target mask vector element is the second element value, it is determined that the element type of the target vector element corresponding to the target mask vector element is a non-masked type.
[0064] S120. Use the element value of the current source vector element corresponding to the masked target vector element as the element value of the masked target vector element.
[0065] The data processing method provided by this application preferentially performs filling processing on masked target vector elements. As mentioned above, there is a one-to-one correspondence between the current source vector elements and the target vector elements. After determining the masked target vector elements, the element value of the current source vector element corresponding to the masked target vector element can be used as the element value of the masked target vector element.
[0066] In a possible implementation manner, multiple register groups are provided in the electronic device that executes the data processing method provided in this embodiment, including a source vector register group, a target vector register group, a mask vector register group, etc. The electronic device stores the element values of each vector element in the foregoing vectors through the register groups. Based on this, in this step, the element value of the masked target vector element can be stored through the target vector register group.
[0067] It can be understood that any of the foregoing register groups includes multiple registers. The number of registers is the same as the number of vector elements included in the vector corresponding to the register group. More importantly, there is also a one-to-one correspondence between the registers and the vector elements. For example, for the target vector, the target vector register group includes target vector registers with the same number as the target vector elements, and the target vector registers are in one-to-one correspondence with the target vector elements. Based on this, after using the element value of the current source vector element corresponding to the masked target vector element as the element value of the masked target vector element, the element value of the current source vector element can be stored in the target vector register corresponding to the masked target vector element.
[0068] In a possible implementation manner, each register in any register group can be numbered. This is not only conducive to establishing a one-to-one correspondence between the registers and the vector elements, but also can be used to determine the element value of the non-masked target vector element in subsequent steps. This process will be elaborated in detail in the subsequent content and will not be described in detail here.
[0069] S130. Determine the element values of the vector elements of the non-masked target based at least on the element values of the vector elements of the masked target.
[0070] Combined with Figure 2 As shown, the specific implementation process of determining the element values of the vector elements of the non-masked target may include the following steps.
[0071] S1301. Determine the filling direction corresponding to the current filling instruction.
[0072] The filling direction can indicate the processing order of the target vector elements. Combining with the actual data processing requirements, there are two possible filling directions, that is, the filling direction corresponding to the current filling instruction can be the first direction or the second direction. As mentioned above, the element values of the target vector elements can be stored in each target vector register in the target vector register group, and each target vector register corresponds to a unique register number. Based on this, the direction from the smallest to the largest register number of the target vector register is defined as the first direction. Correspondingly, the direction from the largest to the smallest register number of the target register is defined as the second direction. In subsequent other embodiments, this definition is followed.
[0073] Based on the above definition of the filling direction, the current filling instruction further includes a direction indication field, and this direction indication field includes a first field value or a second field value. In practical applications, if the direction indication field includes the first field value, it is determined that the filling direction corresponding to the current filling instruction is the first direction. On the contrary, if the direction indication field includes the second field value, it is determined that the filling direction corresponding to the current filling instruction is the second direction.
[0074] If the filling direction is different, the specific filling process of the target vector will also be different, which will be illustrated with specific examples in the following content and will not be elaborated here for the time being.
[0075] S1302. Determine whether the first target vector element of the target vector in the filling direction is a non-masked type. If not, execute S1303. If so, execute S1304.
[0076] After determining the filling direction corresponding to the current filling instruction, determine whether the first target vector element of the target vector in the filling direction is a non-masked type. If not, fill the vector elements according to S1303. If so, fill the vector elements according to S1304.
[0077] The reason for performing this judgment step is as follows: For example, the data to be processed is carried by 32 vector elements, and the 32 vector elements are divided into four source vectors, that is, one source vector includes 8 source vector elements. When filling the current target vector in the filling direction, if the non-mask type target vector element is the first target vector element in the filling direction, then its element value must not be derived from the current source vector. Therefore, it is necessary to determine the source of the element value of the first target vector element based on the judgment result.
[0078] In a possible implementation manner, it is possible to directly judge the element type of the first target vector element of the target vector in the filling direction, and further determine the filling method of other target vector elements according to the judgment result. In another possible implementation manner, since the types of all target vector elements have been determined in the foregoing steps, based on this, when performing this step, for all non-mask type target vector elements, it can be judged in turn whether each non-mask type target vector element is the first target vector element in the filling direction, and the purpose of this step can also be achieved.
[0079] As for the method of judging whether any target vector element is the first target vector element in the filling direction, it will be specifically elaborated in the subsequent content and will not be elaborated here for the time being.
[0080] S1303. Determine the element values of the non-mask type target vector elements according to the element values of the mask type target vector elements.
[0081] In the case where the first target vector element of the target vector in the filling direction is a mask type target vector element, determine the element values of each non-mask type target vector element according to the element values of the mask type target vector elements. Specifically, each non-mask type target vector element is respectively used as the target non-mask type target vector element, and the mask type target vector element that is in the opposite direction of the filling direction and closest to the target non-mask target vector element is used as the target mask type target vector element. Combining the foregoing content, it can be known that the element value of the target mask type target vector element has been determined in S120. Based on this, the element value of the target mask type target vector element corresponding to the target non-mask type target vector element can be used as the element value of the target non-mask type target vector element.
[0082] S1304. Obtain the target scalar value and determine the element values of the non-mask type target vector elements according to the target scalar value and the element values of the mask type target vector elements.
[0083] In the case where the first target vector element of the target vector in the filling direction is a non-mask type target vector element, it is necessary to first obtain the target scalar value.
[0084] In practical applications, there are two possible sources for the target scalar value. Continuing with the previous example, the data to be processed is carried by multiple source vectors, and each source vector is processed by a corresponding filling instruction. Of course, the filling directions corresponding to the respective filling instructions are the same. When executing the current filling instruction, first determine whether the current filling instruction is the first filling instruction for processing the data to be processed. If the current filling instruction is the first filling instruction for processing the data to be processed, it means that the electronic device has not obtained any data to be processed before the current filling instruction. In this case, the present method uses the preset scalar value as the target scalar value.
[0085] In another case, if the current filling instruction is not the first filling instruction for processing the data to be processed, it means that the electronic device has obtained some of the data to be processed. In this case, the present method determines the target scalar value according to the previous source vector, where the previous source vector is the source vector processed by the previous filling instruction of the current filling instruction. Specifically, the element value of the last source vector element in the filling direction in the previous source vector is determined as the target scalar value.
[0086] Further, in the case where the first target vector element of the target vector is a non-masked target vector element, the non-masked target vector element can be divided into two parts. The first part is the first target vector element and at least the non-masked target vector elements adjacent to the first target vector element (there is no masked target vector element between the non-masked target vector element and the first target vector element), and the second part is the remaining non-masked target vector elements excluding the first part among all the non-masked target vector elements.
[0087] For the first part, the target scalar value is used as the element value of each non-masked target vector element inside the first part. For each non-masked target vector element in the second part, its element value can be determined with reference to the relevant content of the foregoing S1303, which will not be repeated here.
[0088] So far, the element values of each target vector element in the target vector have been determined, and the data filling from the source vector to the target vector has been completed. For the specific implementation processes of S1303 and S1304, more specific examples will be presented in the subsequent content, and will not be further elaborated here.
[0089] In summary, through the data processing method provided by the present invention, multiple data (i.e., the element values of vector elements) can be processed simultaneously based on a mask. Compared with the method of using scalar instructions for data processing in the prior art, the present method can significantly improve the data processing efficiency.
[0090] Next, specific examples are combined to introduce in detail the data processing processes for two cases where the filling direction is the first direction and the filling direction is the second direction.
[0091] See Figure 3 , Figure 3 which is a schematic flowchart of a data processing method when the filling direction is the first direction. The flowchart of the data processing method provided in this embodiment includes the following steps.
[0092] S200. Obtain the current filling instruction and the mask vector corresponding to the current filling instruction.
[0093] In a possible implementation manner, S200 can be implemented with reference to the relevant content of S100 in the embodiment shown in Figure 1 and will not be repeated here.
[0094] Combined with Figure 4a shown, the current filling instruction includes the current source vector vs2 and the target vector vd, the mask vector is represented as vm, and the element values of each vector element in the current source vector and the mask vector are as Figure 4a shown. Further, the target scalar rs1 is also shown in FIG. 4, and the target scalar value is x.
[0095] S210. Determine the element type of each target vector element according to the mask vector.
[0096] Combined with Figure 4a shown, each mask vector element in the mask vector corresponds to each target vector element in the target vector. Among them, the target vector element corresponding to the mask vector element with an element value of 1 is the masked target vector element, and the target vector element corresponding to the mask vector element with an element value of 0 is the non-masked target vector element. According to the element values of each mask vector element in the mask vector, the element type of the target vector element corresponding to each mask vector element can be determined.
[0097] As for the specific implementation process of S210, reference can be made to the relevant content of S110 in the embodiment shown in the foregoing Figure 1 and will not be repeated here.
[0098] S220. Use the element value of the current source vector element corresponding to the masked target vector element as the element value of the masked target vector element.
[0099] Combined with Figure 4b shown, after determining the element type of each target vector element, the element value of the current source vector element corresponding to the masked target vector element can be used as the element value of the corresponding masked target vector element. Based on Figure 4bThe schematic diagram of the vector structure shown, the element type of the third target vector element from left to right in the target vector vd is a mask type. This target vector element corresponds to the third source vector element from left to right in the current source vector vs2. Therefore, the element value c of the source vector element is used as the element value of the corresponding target vector element. The element values of the remaining target vector elements are processed in the same way. For specific details, please refer to the foregoing content and Figure 4b as shown, and will not be listed one by one here.
[0100] S230. Determine the filling direction corresponding to the current filling instruction, and the filling direction is the first direction.
[0101] In a possible implementation manner, S230 can refer to Figure 2 the relevant content of S1301 in the embodiment shown, and will not be repeated here. It should be noted that in this embodiment, the filling direction corresponding to the current filling instruction is the first direction.
[0102] S240. Determine that the target vector element corresponding to the smallest target register number among all target vector elements is the first target vector element of the target vector.
[0103] As mentioned above, the electronic device stores the element values of each target vector element in the target vector through the target vector register group, and each target vector register in the target vector register group corresponds to a unique number. Based on this, it can be judged whether each target vector element is the first target vector element in the first direction in the target vector by the number of the target vector register. Based on the foregoing content, it can be known that the first direction is the direction in which the numbers of the target registers increase from small to large. Therefore, it can be determined that the target vector element corresponding to the smallest target register number among all target vector elements is the first target vector element of the target vector.
[0104] Combined with Figure 4a as shown, the target vector elements in the target vector are arranged from left to right. Correspondingly, the numbers of the target registers should also increase from left to right in sequence. The first direction is the direction from left to right. On this premise, the leftmost first target vector element in the target vector vd is the first target vector element in the first direction.
[0105] S250. Judge whether the first target vector element is a mask type target vector element. If so, execute S260; if not, execute S270.
[0106] It can be understood that the element types of each target vector element in the target vector have been determined through the foregoing S210. Therefore, in this step, the element type of the first target vector element can be directly determined based on the result of S210. Of course, it is also possible to refer to the foregoing content to determine the element type of the first target vector element according to the mask vector again, which is also feasible and is also within the scope of protection of the present invention.
[0107] Combined with Figure 4b As shown, in this embodiment, the first target vector element in the target vector vd is a non-mask type target vector element.
[0108] S260. Determine the element value of the non-mask type target vector element according to the element value of the mask type target vector element.
[0109] In a possible implementation manner, S260 can be implemented with reference to the relevant content of S1303 in the embodiment shown in Figure 2 and will not be repeated here.
[0110] S270. Obtain the target scalar value and determine the element value of the non-mask type target vector element according to the target scalar value and the element value of the mask type target vector element.
[0111] Combined with Figure 4c As shown, the first target vector element of the target vector register vd is non-mask type. At the same time, the second target vector element in the first direction is also non-mask type. Therefore, the first target vector element and the second target vector element can be divided into the first part, and at the same time, the remaining non-mask type target vector elements are divided into the second part.
[0112] Based on this, the target scalar value is stored in the scalar register rs1, the target scalar value x is directly used as the element value of each non-mask type target vector element in the first part, and the element value of each non-mask type target vector element in the second part is determined according to the relevant content of the foregoing S1303.
[0113] For other relevant content for implementing this step, reference can be made to the foregoing embodiments and will not be repeated here.
[0114] See Figure 5 , Figure 5 which is a schematic flowchart of the data processing method when the filling direction is the second direction. The flowchart of the data processing method provided in this embodiment includes the following steps.
[0115] S300. Obtain the current filling instruction and the mask vector corresponding to the current filling instruction.
[0116] In a possible implementation manner, S300 can be implemented with reference to Figure 1The relevant content of S100 in the illustrated embodiment is implemented and will not be repeated here.
[0117] Combined with Figure 6a as shown, the current fill instruction includes the current source vector vs2 and the target vector vd, the mask vector is denoted as vm, and the element values of each vector element in the current source vector and the mask vector are as Figure 6a shown. Further, the target scalar rs1 is also shown in FIG. 6, and the target scalar value is x.
[0118] S310. Determine the element type of each target vector element according to the mask vector.
[0119] Combined with Figure 6a shown, each mask vector element in the mask vector corresponds one-to-one with each target vector element in the target vector. Among them, the target vector element corresponding to the mask vector element with an element value of 1 is a masked target vector element, and the target vector element corresponding to the mask vector element with an element value of 0 is a non-masked target vector element. According to the element values of each mask vector element in the mask vector, the element type of the target vector element corresponding to each mask vector element can be determined.
[0120] As for the specific implementation process of S310, reference can be made to the relevant content of S110 in the foregoing Figure 1 illustrated embodiment and will not be repeated here.
[0121] S320. Use the element value of the current source vector element corresponding to the masked target vector element as the element value of the masked target vector element.
[0122] Combined with Figure 6b shown, after determining the element type of each target vector element, the element value of the current source vector element corresponding to the masked target vector element can be used as the element value of the corresponding masked target vector element. Based on Figure 6b the vector structure schematic shown, the element type of the second target vector element from right to left in the target vector vd is a masked type, and this target vector element corresponds to the second source vector element from right to left in the current source vector vs2. Therefore, the element value p of the source vector element is used as the element value of the corresponding target vector element. The element values of the remaining target vector elements are processed in the same way. For details, reference can be made to the foregoing content and Figure 6b shown, and will not be listed one by one here.
[0123] S330. Determine the fill direction corresponding to the current fill instruction, and the fill direction is the second direction.
[0124] In a possible implementation manner, S330 can refer to Figure 2The implementation of the relevant content of S1301 in the illustrated embodiment will not be repeated here. It should be noted that in this embodiment, the filling direction corresponding to the current filling instruction is the first direction.
[0125] S340. Determine that the target vector element corresponding to the largest target register number among the target vector elements is the first target vector element of the target vector.
[0126] As described above, the electronic device stores the element values of each target vector element in the target vector through the target vector register group, and each target vector register in the target vector register group corresponds to a unique number. Based on this, it can be determined whether each target vector element is the first target vector element in the second direction in the target vector by the number of the target vector register. Based on the foregoing content, it can be known that the second direction is the direction in which the numbers of the target registers decrease from large to small. Therefore, it can be determined that the target vector element corresponding to the largest target register number among the target vector elements is the first target vector element of the target vector.
[0127] Combined with Figure 6a As shown, the target vector elements in the target vector are arranged from left to right. Correspondingly, the numbers of the target registers should also increase sequentially from left to right. The second direction is the direction from right to left. On this premise, the rightmost first target vector element in the target vector vd is the first target vector element in the second direction.
[0128] S350. Determine whether the first target vector element is a masked target vector element. If so, execute S360; if not, execute S370.
[0129] It can be understood that after S310 has determined the element types of each target vector element in the target vector, therefore, in this step, the element type of the first target vector element can be directly determined through the result of S310. Of course, it is also possible to determine the element type of the first target vector element again according to the mask vector with reference to the foregoing content, which is also feasible and also falls within the scope of protection of the present invention.
[0130] Combined with Figure 6b As shown, in this embodiment, the first target vector element in the target vector vd is a non-masked target vector element.
[0131] S360. Determine the element value of the non-masked target vector element according to the element value of the masked target vector element.
[0132] In a possible implementation manner, S360 can refer to Figure 2 the relevant content of S1303 in the illustrated embodiment and will not be repeated here.
[0133] S370. Obtain a target scalar value and determine the element values of the non-masked target vector elements according to the target scalar value and the element values of the masked target vector elements.
[0134] Combine Figure 6c As shown, the first target vector element of the target vector register vd is non-masked, and the second target vector element adjacent to it is a masked target vector element. Therefore, the first target vector element can be divided into a first part, and at the same time, the remaining non-masked target vector elements can be divided into a second part.
[0135] Based on this, store the target scalar value in the scalar register rs1, directly use the target scalar value x as the element value of the only non-masked target vector element in the first part, and determine the element values of the non-masked target vector elements in the second part according to the relevant content of the foregoing S1303.
[0136] For other relevant content for implementing this step, reference can be made to the foregoing embodiments, and details will not be repeated here.
[0137] Furthermore, the present invention also provides a processor configured to execute the data processing method provided in any of the foregoing embodiments.
[0138] Next, with reference to Figure 7 to describe the computer device provided in the embodiments of the present invention. The computer device provided in this embodiment may include: at least one processor 100, at least one communication interface 200, at least one memory 300, and at least one communication bus 400;
[0139] In the embodiments of the present invention, the number of the processor 100, the communication interface 200, the memory 300, and the communication bus 400 is at least one, and the processor 100, the communication interface 200, and the memory 300 communicate with each other through the communication bus 400; obviously, Figure 7 the communication connection schematic diagram of the processor 100, the communication interface 200, the memory 300, and the communication bus 400 shown is only optional;
[0140] Optionally, the communication interface 200 may be an interface of a communication module, such as an interface of a GSM module; the processor 100 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0141] The memory 300 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.
[0142] Among them, the processor 100 is specifically configured to execute the application program in the memory to implement the steps of the data processing method described above.
[0143] In some embodiments, the present embodiment further provides a computer-readable storage medium, such as a floppy disk, an optical disc, a hard disk, a flash memory, a USB flash drive, an SD (Secure Digital Memory Card) card, an MMC (Multimedia Card) card, etc. One or more instructions for implementing the above steps are stored in the computer-readable storage medium. When the one or more instructions are executed by one or more processors, the processors execute the data processing method described above. For the relevant specific implementation, please refer to the foregoing description and will not be elaborated here.
[0144] In addition to the above methods and devices, the embodiments of the present application may also be a computer program product, which includes computer program instructions. When the computer program instructions are run by a processor, the processor executes the steps in the data processing methods according to various embodiments of the present application described in the above content of this specification.
[0145] The computer program product can be written in any combination of one or more programming languages to write program code for performing the operations of the embodiments of the present application. The programming languages include object-oriented programming languages, such as Java, C++, etc., and also include conventional procedural programming languages, such as the "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, executed as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or a computer device.
[0146] Those skilled in the art can understand that the content disclosed in the present disclosure can have various variations and improvements. For example, the various devices or components described above can be implemented by hardware, or by software, firmware, or some or all of the combinations of the three.
[0147] In addition, although the present disclosure makes various references to certain units in the systems according to the embodiments of the present disclosure, however, any number of different units can be used and run on the client and / or the computer device. The units are only illustrative, and different aspects of the system and method can use different units.
[0148] Flowcharts are used in the present disclosure to illustrate the steps of the methods according to the embodiments of the present disclosure. It should be understood that the preceding or subsequent steps do not necessarily need to be carried out precisely in sequence. On the contrary, they can be carried out in reverse order or various steps can be processed simultaneously. Also, other operations can be added to these processes.
[0149] Those of ordinary skill in the art can understand that all or part of the steps in the above methods can be completed by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, etc. Optionally, all or part of the steps of the above embodiments can also be implemented using one or more integrated circuits. Correspondingly, each module / unit in the above embodiments can be implemented in the form of hardware or in the form of a software functional module. The present disclosure is not limited to any specific form of combination of hardware and software.
[0150] Unless otherwise defined, all terms used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the present disclosure pertains. It should also be understood that terms such as those defined in a general dictionary should be interpreted as having a meaning consistent with their meaning in the context of the relevant art, and should not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
[0151] The above is an illustration of the present disclosure and should not be considered a limitation thereof. Although several exemplary embodiments of the present disclosure have been described, those skilled in the art will readily understand that many modifications can be made to the exemplary embodiments without departing from the novel teachings and advantages of the present disclosure. Accordingly, all such modifications are intended to be included within the scope of the present disclosure as defined by the claims. It should be understood that the above is an illustration of the present disclosure and should not be considered limited to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are intended to be included within the scope of the appended claims. The present disclosure is defined by the claims and their equivalents.
Claims
1. A data processing method, characterized in that, including: obtaining a current filling instruction and a mask vector corresponding to the current filling instruction; wherein, the current filling instruction includes a current source vector and a target vector, the current source vector includes a plurality of current source vector elements, the target vector includes a plurality of target vector elements, and the current source vector elements and the target vector elements correspond to each other one by one; determining an element type of each of the target vector elements according to the mask vector, the element type including a masked type and a non-masked type; using the element value of the current source vector element corresponding to the masked target vector element as the element value of the masked target vector element; determining the element value of the non-masked target vector element at least according to the element value of the masked target vector element.
2. The method according to claim 1, characterized in that, The determining the element value of the non-masked target vector element at least according to the element value of the masked target vector element includes: determining a filling direction corresponding to the current filling instruction, the filling direction being used to indicate a processing order of the target vector elements; if the first target vector element of the target vector in the filling direction is of the masked type, determining the element value of the non-masked target vector element according to the element value of the masked target vector element; if the first target vector element of the target vector in the filling direction is of the non-masked type, obtaining a target scalar value and determining the element value of the non-masked target vector element according to the target scalar value and the element value of the masked target vector element.
3. The method according to claim 2, characterized in that, The current filling instruction includes a direction indication field, and the direction indication field includes a first field value or a second field value; determining the filling direction corresponding to the current filling instruction includes: if the direction indication field includes the first field value, determining that the filling direction corresponding to the current filling instruction is a first direction, the first direction being a direction in which the numbers of the target registers increase from small to large, and the target registers being used to store the element values of the target vector elements; if the direction indication field includes the second field value, determining that the filling direction corresponding to the current filling instruction is a second direction, the second direction being a direction in which the numbers of the target registers decrease from large to small.
4. The method according to claim 3, characterized in that, The filling direction includes the first direction; The process of determining whether any target vector element is the first target vector element of the target vector in the filling direction includes: determining that the target vector element corresponding to the smallest target register number among the target vector elements is the first target vector element of the target vector.
5. The method according to claim 3, characterized in that, The filling direction includes the second direction; The process of determining whether any target vector element is the first target vector element of the target vector in the filling direction includes: determining that the target vector element corresponding to the largest target register number among the target vector elements is the first target vector element of the target vector.
6. The method according to claim 2, characterized in that, The determining the element value of the non-masked target vector element according to the element value of the masked target vector element includes: determining a target masked target vector element corresponding to a target non-masked target vector element; Among them, the target non-masked target vector element is any one of the non-masked target vector elements, and the target masked target vector element is the masked target vector element closest to the target non-masked target vector element in the opposite direction of the filling direction; Determine that the element value of the target masked target vector element is the element value of the target non-masked target vector element.
7. The method according to claim 2, characterized in that, The data to be processed corresponding to the current source vector is carried by multiple source vectors, and any one of the source vectors is processed by a corresponding filling instruction; The obtaining the target scalar value includes: Judge whether the current filling instruction is the first filling instruction for processing the data to be processed; If the current filling instruction is the first filling instruction for processing the data to be processed, determine the preset scalar value as the target scalar value; If the current filling instruction is not the first filling instruction for processing the data to be processed, determine the target scalar value according to the previous source vector, where the previous source vector is the source vector processed by the previous filling instruction of the current filling instruction.
8. The method according to claim 7, characterized in that, The filling directions of the filling instructions for processing the data to be processed are the same; The determining the target scalar value according to the previous source vector includes: Determine that the element value of the last source vector element of the previous source vector in the filling direction is the target scalar value.
9. The method according to claim 1, wherein, The mask vector includes a plurality of mask vector elements, and the mask vector elements correspond to the target vector elements one by one. The mask vector elements include a first element value or a second element value; Determining the element type of each of the target vector elements according to the mask vector includes: If the element value of the target mask vector element is the first element value, determine that the element type of the target vector element corresponding to the target mask vector element is a masked type, and the target mask vector element is any one of the mask vector elements; If the element value of the target mask vector element is the second element value, determine that the element type of the target vector element corresponding to the target mask vector element is a non-masked type.
10. A processor, wherein, Configured to execute the data processing method according to any one of claims 1-9.
11. A computer device, wherein, Includes a processor according to claim 10.
12. A computer-readable storage medium, wherein, Stores a computer program, and when the computer program is executed, it implements the data processing method according to any one of claims 1-9.