A mask operation method for explicit independent mask registers in GPU

By introducing explicit independent mask registers and mask operation instructions into the graphics processor, the problem of poor management of a single implicit mask register is solved, and more efficient instruction processing and power consumption optimization are achieved.

CN112083954BActive Publication Date: 2024-09-06NANCHANG KANGJUN IND CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN201910512317.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-06-13
Publication Date
2024-09-06
Estimated Expiration
2039-06-13

AI Technical Summary

Technical Problem

In graphics processors, when there are many or nested conditional control statements, a single implicit mask register cannot effectively manage the mask, resulting in an increase in the number of instructions, extended latency, and increased power consumption.

Method used

Provides explicit independent mask registers. Each GPU hardware thread can access eight 128-bit wide independent mask registers. Mask reduction, expansion, logical operations and data movement are performed through instruction operations, and binary trees are used to process child and parent levels. Mask relationship, explicit mask register processing condition control, avoid mask coverage and recovery problems, and reduce data movement between registers.

Benefits of technology

The instruction issuance process is optimized to avoid invalid operand reading and execution pipeline operations, reducing the power consumption of the programmable processor core and improving performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112083954B
    Figure CN112083954B
Patent Text Reader

Abstract

The invention discloses a mask operation method of an explicit independent mask register in a GPU, which belongs to the technical field of image processing units and specifically is a mask operation method of an explicit independent mask register in a GPU. The method comprises the following steps: S1: each GPU hardware thread can access its own 8 independent mask registers with a width of 128 bits, which are recorded as $m0-$m7; the mask operation instructions of the explicit independent mask register in the GPU, each hardware thread in the GPU can access its own 8 independent mask registers with a width of 128 bits, and there are 4 groups of mask operation instructions available to users, which respectively realize reduction operations, expansion operations, logical operations and data movement between general vector registers on the mask registers, and the instructions can realize the generation of branch masks in conditional control and obtain mask values ​​at the same time, optimize the instruction emission process in the programmable core, avoid invalid operand reading and execution pipeline operations, and reduce programmable power consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing units, and in particular to a mask operation method of an explicit independent mask register in a GPU. Background Art

[0002] Modern graphics processors contain many programmable processor cores for executing shader code and graphics-specific hardware acceleration units. Initially, these processor cores were used to execute shader code in graphics applications, but later it was found that they could handle non-graphics computationally intensive applications well and developed into general-purpose graphics processors.

[0003] In graphics applications, the GPU has to process a huge number of vertices and fragments. It is impossible to write code for each of these objects separately, so the GPU programming model defines shaders for processing vertices and shaders for processing fragments. Users can describe the algorithms for processing vertices and fragments in the shader. A similar method is used for GPGPU applications. A huge number of processing objects are defined in the programming model. These objects are called work items. Users will specify a kernel to describe how to process these work items.

[0004] The graphics processor combines multiple vertices or kernel work items into threads, and executes the corresponding shader program and kernel program in a single instruction multiple data manner. When conditional control codes appear in the program, one way to solve this problem in the SIMD implementation is to use an execution mask to control the output of the execution result. Only when the value in the corresponding bit in the mask is 0x1, the corresponding destination operand will be rewritten. In order to save the encoding space of the GPU instruction word, a single implicit mask register is often used in the graphics processor. When there are many conditional control statements in the shader or kernel code or they are nested, a single implicit mask register ($exec) cannot change the mask register of the current instruction, resulting in frequent movement of data between the implicit mask register and the general register. This not only increases the number of program instructions and the execution latency of the program, but also increases the power consumption of the programmable processor core due to the additional reading and writing between registers. Summary of the invention

[0005] The object of the present invention is to provide a mask operation method of an explicit independent mask register in a GPU, so as to solve the problem that a graphics processor proposed in the above background technology combines multiple vertices or kernel work items into threads, executes corresponding shader programs and kernel programs in a single instruction multiple data manner, and when a conditional control code appears in the program, a method of SIMD implementation to solve this problem is to use an execution mask to control the output of the execution result, and only when the value in the corresponding bit in the mask is 0x1, the corresponding destination operand will be rewritten. In order to save the encoding space of the GPU instruction word, a single implicit mask register is often used in the graphics processor to implement it. When there are many conditional control statements in the shader or kernel code or they are nested, a single implicit mask register ($exec) cannot change the mask register of the current instruction, resulting in frequent movement of data between the implicit mask register and the general register. In this way, not only the number of instructions of the program is increased, the execution delay of the program is increased, but also the additional reading and writing between registers will increase the power consumption of the programmable processor core.

[0006] To achieve the above object, the present invention provides the following technical solution: a mask operation method of an explicit independent mask register in a GPU, comprising the following steps:

[0007] S1: Each GPU hardware thread can access its own 8 128-bit wide independent mask registers, denoted as $m0~$m7;

[0008] S2: The data in $m0 defaults to the execution mask of the GPU hardware thread instruction, and the execution mask of the current instruction can be specified by changing the mask address field MSA of the instruction in the program code;

[0009] S3: Use instructions to implement reduction operations, expansion operations, logical operations and data movement between general vector registers on mask registers. The corresponding mask registers need to be specified, while the nearest parent mask register is retained, and the child-parent mask relationship is processed in a binary tree manner;

[0010] S4: when the number of mask registers used exceeds 8, the mask operands not used temporarily are stored in the general vector registers through move instructions, and are obtained from the general vector registers when needed;

[0011] S5: using the vector execution unit to implement the mask reduction operation, completing the general and explicit reading of the mask reduction, avoiding the instruction issuance overhead, and the user decides whether to add the reduction operation after analyzing the application;

[0012] S6: When the mask register is explicitly used to process conditional control, the later conditional codes are stored in the mask register, and the mask of the instruction sequence of the true branch and the conditional codes of the instruction sequence of the false branch are generated. The explicit mask avoids the problem of a single mask being overwritten and restored after being overwritten, and reduces the data movement between the vector general register and the mask register.

[0013] Preferably, the 128-bit mask and vector execution unit are organized in a SIMD16 parallel manner, and one mask register can cover eight executions of the vector unit.

[0014] Preferably, when a vector instruction of the vector unit is issued, it is determined whether the mask register of the instruction is all zero. If it is all zero, it indicates that the instruction will not have any valid output, and the operation reading and execution of the corresponding instruction can be avoided.

[0015] Preferably, the width of SIMD16 needs to be reduced, and when the reduction result is not zero, operands need to be read and instructions need to be issued, so that the mask processing of SIMD16 can be completed.

[0016] Preferably, the masked reduction instruction can further avoid inefficient reduction operations before instruction issuance after user analysis, so that the reduction can definitely play the aforementioned performance and power consumption optimization role.

[0017] Compared with the prior art, the invention has the following beneficial effects: the explicit independent mask register and mask operation instruction in the GPU propose a class of instructions for explicit independent mask register and mask operation register implemented in the graphics processor, each hardware thread in the GPU can access its own 8 128-bit independent mask registers, which are recorded as $m0-$m7, wherein the data in $m0 defaults to the execution mask of the GPU hardware thread instruction, and the execution mask of the current instruction can also be specified by changing the mask address field MSA of the instruction, and there are 4 groups of mask operation instructions available to the user, which respectively implement reduction operation, expansion operation, logical operation and data movement between general vector registers on the mask register, and the instructions can realize the generation of branch masks in conditional control and obtain mask values ​​at the same time, optimize the instruction issuance process in the programmable core, avoid invalid operand reading and execution pipeline operation, and reduce programmable power consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 Schematic diagram of an implicit unit mask register of the present invention;

[0019] Figure 2 A schematic diagram of a programmable processor core according to the first reduction of the present invention;

[0020] Figure 3 A schematic diagram of a programmable processor core according to the second reduction of the present invention;

[0021] Figure 4 It is a schematic diagram of the launching process of the present invention. DETAILED DESCRIPTION

[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0023] The present invention provides a technical solution: a mask operation method of an explicit independent mask register in a GPU, comprising the following steps:

[0024] A mask operation method for an explicit independent mask register in a GPU comprises the following steps:

[0025] S1: Each GPU hardware thread can access its own 8 128-bit wide independent mask registers, denoted as $m0~$m7;

[0026] S2: The data in $m0 defaults to the execution mask of the GPU hardware thread instruction. The execution mask of the current instruction can be specified by changing the mask address field MSA of the instruction in the program code;

[0027] S3: Use instructions to implement reduction operations, expansion operations, logical operations and data movement between general vector registers on mask registers. The corresponding mask registers need to be specified, while the nearest parent mask register is retained, and the child-parent mask relationship is processed in a binary tree manner;

[0028] S4: When the number of mask registers used exceeds 8, the mask operands not used temporarily are stored in the general vector general registers through the move instruction, and are obtained from the general vector registers when needed;

[0029] S5: Use the vector execution unit to implement the mask reduction operation, complete the general and explicit reading of the mask reduction, and avoid the instruction issuance overhead. After analyzing the application, the user decides whether to add the reduction operation;

[0030] S6: When the explicit mask register processes conditional control, the later conditional code is stored in the mask register, and the mask of the instruction sequence of the true branch and the conditional code of the instruction sequence of the false branch are generated. The explicit mask avoids the problem of a single mask being overwritten and restored after being overwritten, and reduces the data movement between the vector general register and the mask register;

[0031] Among them, the 128-bit mask and vector execution unit are organized in the parallel mode of SIMD16. One mask register can cover the execution of 8 vector units. When the vector instruction of the vector unit is issued, it is determined whether the mask register of the instruction is all zero. If it is all zero, it indicates that the instruction will not have any valid output, and the operation reading and execution of the corresponding instruction can be avoided. The width of SIMD16 needs to be reduced. When the reduction result is not zero, the operands need to be read and the instruction is issued, so that the mask processing of SIMD16 can be completed. The mask reduction instruction can further avoid the inefficient reduction operation before the instruction is issued after user analysis, so that the reduction can definitely play the aforementioned performance and power consumption optimization role.

[0032] In specific use, when the explicit mask register processes conditional control, the relatively late condition code is stored in the mask register, and then the mask of the instruction sequence of the true branch and the condition code of the false branch instruction sequence are generated according to the AND and clear logic operations. Compared with the implicit single mask register, the programmable processor core of the present invention adds an independent mask register and a mask reduction-guided instruction emission unit. For the 128-bit mask $m c The vector execution unit is organized according to the parallelism of SIMD16. A mask register can cover the execution of 8 vector units, reducing the pressure of instruction fetching. When a vector instruction is issued, it will first determine whether the mask register of the instruction is all zero. If it is all zero, it means that the instruction will not have any valid output. In this way, the source operation reading and execution of the corresponding instruction can be avoided. In order to avoid data dependency, the dependency flag should also be cleared. When part of the mask is all zero, the result of the reduction operation cannot be reflected. In this way, the mask needs to be reduced according to the width of 16 bits. When the current 16-bit reduction result is not zero, it is necessary to read the operand and issue the instruction, otherwise it will be processed according to the normal instruction issuance process until all SIMD16 masks covered by the mask are processed and the instruction issuance is completed.

[0033] Although the present invention has been described above with reference to the embodiments, various modifications may be made thereto and parts thereof may be replaced with equivalents without departing from the scope of the present invention. In particular, as long as there is no structural conflict, the various features in the embodiments disclosed by the present invention may be used in combination with each other in any manner, and the fact that these combinations are not exhaustively described in this specification is only for the sake of omitting space and saving resources. Therefore, the present invention is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.

Claims

1. A mask operation method for an explicit independent mask register in a GPU, characterized in that: The following steps are involved: S1: Each GPU hardware thread accesses its own 8 128-bit wide independent mask registers, denoted as $m0~$m7; S2: The data in $m0 defaults to the execution mask of the GPU hardware thread instruction, and the execution mask of the current instruction is specified by changing the mask address field MSA of the instruction in the program code; S3: Use instructions to implement reduction operations, expansion operations, logical operations and data movement between general vector registers on mask registers. The corresponding mask registers need to be specified, while the nearest parent mask register is retained, and the child-parent mask relationship is processed in a binary tree manner; S4: when the number of mask registers used exceeds 8, the temporarily unused mask operands are stored in the general vector register through a move instruction, and are retrieved from the general vector register when needed; S5: using the vector execution unit to implement the mask reduction operation, completing the general and explicit reading of the mask reduction, avoiding the instruction issuance overhead, and the user decides whether to add the reduction operation after analyzing the application; S6: When the mask register is explicitly used to process conditional control, the later conditional codes are stored in the mask register, and the mask of the instruction sequence of the true branch and the conditional codes of the instruction sequence of the false branch are generated. The explicit mask avoids the problem of a single mask being overwritten and restored after being overwritten, and reduces the data movement between the general vector register and the mask register.

2. The mask operation method of an explicit independent mask register in a GPU according to claim 1, characterized in that: The 128-bit mask and vector execution unit are organized in a SIMD16 parallel manner, and one mask register covers eight executions of the vector unit.

3. The mask operation method of an explicit independent mask register in a GPU according to claim 2, characterized in that: When the vector unit issues a vector instruction, it determines whether the mask register of the instruction is all zero. If it is all zero, it indicates that the instruction will not have any valid output, and the operation reading and execution of the corresponding instruction can be avoided.

4. The mask operation method of an explicit independent mask register in a GPU according to claim 2, characterized in that: The width of the SIMD16 needs to be reduced, and when the reduction result is not zero, the operand needs to be read and the instruction needs to be issued, so that the mask processing of SIMD16 can be completed.

5. The mask operation method of an explicit independent mask register in a GPU according to claim 2, characterized in that: The masked reduce instruction further avoids inefficient reduction operations before instruction issuance after user analysis.

Citation Information

Cited By

  • Mask operation method for explicit independent mask register in GPU

    WO2020249052A1