A GPU occlusion query TLM device and operation method based on SystemC

Through the SystemC-based GPU occlusion query TLM device, the collaborative work of the fragment processing unit and the command processor is used to solve the tedious in-depth testing problem in the traditional hardware design verification process, achieve rapid simulation and verification, and improve the efficiency of GPU design.

CN112581576BActive Publication Date: 2024-09-17西安翔腾微电子科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011404132.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-05
Publication Date
2024-09-17
Estimated Expiration
2040-12-05

AI Technical Summary

Technical Problem

The verification process of traditional hardware design before the functional specifications are refined to the RTL level is cumbersome, resulting in bottlenecks in chip design and development. Especially when dealing with complex GPU designs, it is difficult to quickly simulate and verify.

Method used

Using SystemC-based GPU occlusion query TLM device, through the transaction-level interface between the chip host, fragment processing unit, command processor, register unit and rasterization unit, the occlusion query operation is implemented, the depth test and fragment processing process is simplified, and glBeginQuery is provided and glEndQuery function code to start and end the query, and obtain the query results through glGetQueryObject.

Benefits of technology

It accelerates the simulation speed of GPU design, can quickly determine whether the geometry is visible after depth testing, simplifies the design verification process, and shortens the design cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112581576B
    Figure CN112581576B
Patent Text Reader

Abstract

The present invention relates to the technical field of computer hardware modeling, and in particular to a GPU occlusion query TLM device based on SystemC. The GPU occlusion query TLM device based on SystemC comprises: step 1: a host generates an execution command, and sends the execution command to a command processor through a transaction-level interface; step 2: a fragment processing unit receives and processes the glBeginQuery function code issued by the command processor; step 3: the fragment processing unit receives the fragment data stream of the rasterization unit and performs fragment operations; step 4: the fragment processing unit receives and processes the glEndQuery function code issued by the command processor; step 5: the host calls glGetQueryObject to obtain occlusion query results. The present invention implements a GPU occlusion query TLM device and operation method based on SystemC, solves the problem of querying the number of fragments that pass the depth test in the current drawing process, so that it can be determined whether a group of geometric figures are visible after the depth test, and speeds up the simulation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer hardware modeling, and relates to a GPU occlusion query TLM device, and in particular to a SystemC-based GPU occlusion query TLM device and an operation method thereof. Background Art

[0002] With the continuous increase of graphical applications, the early solutions that relied solely on CPU for graphics rendering have been unable to meet the graphics processing needs of the growing performance and technology, and the Graphics Processing Unit (GPU) came into being. Since Nvidia released its first GPU product in 1999, the development of GPU technology has mainly gone through the fixed-function pipeline stage, the separate shader architecture stage, and the unified shader architecture stage. Its graphics processing capabilities have been continuously improved, and its application areas have gradually expanded from the initial graphics rendering to the general computing field. The high-speed, parallel characteristics of the GPU pipeline and its flexible programmability provide a good operating platform for graphics processing and general parallel computing.

[0003] The hardware logic scale of GPU chip development is huge and the complexity is increasing. It is necessary to describe the design at a higher level of abstraction so that higher-speed simulation, software / hardware co-simulation and architecture exploration can be performed. When the design is expressed as a system-level model, it is easy to try the design multiple times using different algorithms, and it can also be done quickly by changing to different structures for experimentation; if the design is expressed using a register transfer level or gate level model, the scale is usually quite large, and it is time-consuming and laborious to try different design structures or make some changes, even if it is not too difficult.

[0004] The key factor that promotes the development and standardization of SystemC as a language is that it can perform system-level design, describe hardware architecture and software algorithms, and support verification and IP communication. Using SystemC as a partitioning tool for software and hardware at the system level is much easier than other languages, and simulation is much faster than using multiple languages. Therefore, using SystemC to design and describe the microstructure of the unit can establish a completely standard simulation environment and directly model at a high level of abstraction.

[0005] Transaction-Level Modeling (TLM) is built on the SystemC standard, including the SystemC core language, structured elements, predefined channels, data types and other concepts. TLM is a transaction-based communication method, which is usually cited in high-level abstract languages ​​as a communication method between modules, successfully separating the calculation within the module and the communication between modules from the time span. Traditional hardware design starts with functional specifications, and is refined step by step to the RTL level before entering the simulation and verification stage. Verification has become a bottleneck for chip design and development. In order to better and more efficiently describe functional specifications, it is necessary to innovate system design and verification methodology. When the target system to be modeled is very complex, the use of behavioral models to quickly model the target system allows designers to have a clearer understanding of the target design, which is conducive to the division of software and hardware. The system can be verified from the architecture stage, which greatly saves the design cycle and accelerates the verification progress. Summary of the invention

[0006] Based on the problems existing in the background technology, the present invention provides a SystemC-based GPU occlusion query TLM device and operation method, which can solve the problem of the GPU occlusion query TLM device querying the number of fragments that pass the depth test in the current drawing process, thereby determining whether a group of geometric figures is visible after the depth test and speeding up the simulation.

[0007] The technical solution of the present invention is:

[0008] A GPU occlusion query TLM device based on SystemC, which is special in that it includes a chip host, a fragment processing unit, a command processor, a register unit, a rasterization unit and several transaction-level interfaces for connecting the components;

[0009] The host is connected to the command processor and the fragment processing unit respectively through a transaction level interface;

[0010] The register unit is connected to the command processor and the fragment processing unit respectively through a transaction level interface;

[0011] The above-mentioned rasterization unit is connected to the fragment processing unit via a transaction level interface;

[0012] The host is used to generate execution commands for graphic images and send the execution commands to the command processor via the transaction level interface;

[0013] The command processor is used to parse the execution command and send the parsed execution command to the fragment processing unit and the register unit respectively;

[0014] The above-mentioned rasterization unit is used to generate a fragment data stream and send the fragment data stream to the fragment processing unit; wherein the fragment processing unit is used for fragment processing and occlusion query operations of the data stream and sends the occlusion query operation results to the host; the register unit is used to cooperate with the fragment processing unit to store the data stream in the fragment processing and occlusion query operations.

[0015] An operating method of a GPU occlusion query TLM device based on SystemC, which is special in that:

[0016] The following steps are involved:

[0017] Step 1: The host generates an execution command and sends the execution command to the command processor through the transaction level interface;

[0018] Step 2: The command processor sends the execution command to the fragment processing unit through the transaction-level interface and executes the start query operation; the above-mentioned start query operation is to specify the start of an occlusion query operation; the execution command in the above step 2 is the glBeginQuery function code;

[0019] Step 3: The fragment processing unit receives the fragment data stream from the rasterization unit, and the fragment processing process performs fragment operations;

[0020] Step 4: The fragment processing unit receives the execution command sent by the command processor and executes the end query operation; the execution command in the above step 4 is the glEndQuery function code;

[0021] Step 5: The host calls glGetQueryObjec to obtain the query result through the fragment processing unit.

[0022] The specific execution process of step 2 above is as follows:

[0023] Step 2.1

[0024] The fragment processing unit reads reg.beginQueryId in the register unit;

[0025] Step 2.2

[0026] The fragment processing unit sets the query start valid flag: reg.beginQueryValid = 1;

[0027] Step 2.3

[0028] Reset query result value: reg.queryResult[reg.beginQueryId] = 0.

[0029] The specific execution process of the depth test in the fragment operation of step 3 above is as follows:

[0030] Step 3.1

[0031] If the depth test is enabled, continue to the next step; otherwise exit;

[0032] Step 3.2

[0033] If the depth test of the pixel passes and the pixel is a valid pixel, continue to the next step; otherwise exit;

[0034] if((depthTestResult[pixelNum]==1)&&(tileMask[pixelNum]==1))

[0035] Step 3.3

[0036] If the reg.beginQueryValid flag is valid, then the reg.queryResultCount count is incremented by 1, otherwise exit;

[0037] if(reg.beginQueryValid==1)

[0038] {reg.queryResultCount++;}

[0039] Step 3.4

[0040] The number of pixels that pass the depth test in the current drawing stream is stored in the reg.queryResultCount variable.

[0041] The specific execution process of step 4 above is defined as follows:

[0042] Step 4.1

[0043] Determine whether the glBeginQuery mark reg.beginQueryValid is valid at this time. If it is valid (if (reg.beginQueryValid == 1)), execute the next step; otherwise, execute and exit;

[0044] Step 4.2

[0045] Clear the reg.beginQueryValid flag: reg.beginQueryValid = 0;

[0046] Step 4.3

[0047] Assignment: reg.queryResult[reg.beginQueryId]=reg.queryResultCount;

[0048] Step 4.4

[0049] Clear count result: reg.queryResultCount = 0x0.

[0050] The specific execution process of step 5 above is as follows:

[0051] Step 5.1

[0052] Send command to processor unit, configure FP register; trigger glGetQueryObject_write_event;

[0053] Step 5.2

[0054] The query result monitoring process in the fragment processing unit is triggered by the event and executed

[0055] Fragment processing unit ROU_QueryData_Reg.querydata==

[0056] reg.queryResult[glGetQueryObject_id_reg.id];

[0057] Fragment processing unit ROU_Ctrl_Reg.query_done = 1;

[0058] Step 5.3

[0059] The host software blocks until the fragment processing unit ROU_Ctrl_Reg.query_done = 1; step 5.4

[0060] The host software reads the fragment processing unit ROU_QueryData_Reg.querydata to obtain the query result.

[0061] The above reg.beginQueryId is the ID number of glBeginQuery;

[0062] The above reg.beginQueryValid is the valid flag of glBeginQuery;

[0063] The above reg.queryResult[n] is a count array that stores n groups of occlusion query pass results;

[0064] The above reg.queryResultCount is the current count of the results of the occlusion query.

[0065] The above depthTestResult is the depth test result of the saved pixel;

[0066] The above tileMask is the mask that saves pixels;

[0067] The above glGetQueryObject_write_event represents the glGetQueryObject register write event;

[0068] The above-mentioned fragment processing unit ROU_QueryData_Reg.querydata represents the result data of the occlusion query;

[0069] The above fragment processing unit ROU_Ctrl_Reg.query_done indicates the completion flag of the occlusion query result.

[0070] The present invention has the following advantages:

[0071] 1. The present invention provides a SystemC-based GPU occlusion query TLM device, comprising a fragment processing unit that receives and processes the glBeginQuery function code sent by a command processor; the fragment processing unit receives the fragment data stream of a rasterization unit and performs fragment operations; the fragment processing unit receives and processes the glEndQuery function code sent by the command processor; and the host calls glGetQueryObject to obtain the occlusion query result.

[0072] 2. The present invention solves the problem of the GPU occlusion query TLM device querying the number of fragments that pass the depth test in the current drawing process, thereby determining whether a group of geometric figures is visible after the depth test and speeding up the simulation. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 It is a block diagram of the fragment processing unit hardware TLM microarchitecture.

[0074] Among them, 1-host, 2-fragment processing unit, 3-command processor, 4-register unit, 5-rasterization unit. DETAILED DESCRIPTION

[0075] See also Figure 1 , a GPU occlusion query TLM device based on SystemC, which is special in that: it includes a chip host 1, a fragment processing unit, a command processor 3, a register unit 4, a rasterization unit 5 and several transaction-level interfaces for connecting the components;

[0076] The host 1 is connected to the command processor 3 and the fragment processing unit 2 respectively through the transaction level interface;

[0077] The register unit 4 is connected to the command processor 3 and the fragment processing unit 2 respectively through a transaction level interface;

[0078] The above-mentioned rasterization unit 5 is connected to the fragment processing unit 2 via a transaction level interface;

[0079] The host 1 is used to generate execution commands for graphic images and send the execution commands to the command processor 3 through the transaction level interface;

[0080] The command processor 3 is used to parse the execution command and send the parsed execution command to the fragment processing unit 2 and the register unit 4 respectively;

[0081] The above-mentioned rasterization unit 5 is used to generate a fragment data stream and send the fragment data stream to the fragment processing unit 2; wherein the fragment processing unit 2 is used for fragment processing and occlusion query operations of the data stream and sends the occlusion query operation results to the host 1; the register unit 4 is used to cooperate with the fragment processing unit 2 to store the data stream in the fragment processing and occlusion query operations.

[0082] An operating method of a GPU occlusion query TLM device based on SystemC, which is special in that:

[0083] The following steps are involved:

[0084] Step 1: Host 1 generates an execution command and sends the execution command to command processor 3 through a transaction level interface;

[0085] Step 2: The command processor 3 sends the execution command to the fragment processing unit 2 through the transaction level interface, and executes the start query operation; the above-mentioned start query operation is to specify the start of an occlusion query operation; the execution command in the above-mentioned step 2 is the glBeginQuery function code;

[0086] Step 3: The fragment processing unit 2 receives the fragment data stream from the rasterization unit 5, and the fragment processing process performs fragment operations;

[0087] Step 4: The fragment processing unit 2 receives the execution command sent by the command processor 3 and executes the end query operation; the execution command in the above step 4 is the glEndQuery function code;

[0088] Step 5: Host 1 calls glGetQueryObjec and obtains the query result through fragment processing unit 2.

[0089] The specific execution process of step 2 above is as follows:

[0090] Step 2.1

[0091] Fragment processing unit 2 reads reg.beginQueryId in register unit 4;

[0092] Step 2.2

[0093] The fragment processing unit 2 sets the query start valid flag: reg.beginQueryValid = 1;

[0094] Step 2.3

[0095] Reset query result value: reg.queryResult[reg.beginQueryId] = 0.

[0096] The specific execution process of the depth test in the fragment operation of step 3 above is as follows:

[0097] Step 3.1

[0098] If the depth test is enabled, continue to the next step; otherwise exit;

[0099] Step 3.2

[0100] If the depth test of the pixel passes and the pixel is a valid pixel, continue to the next step; otherwise exit;

[0101] if((depthTestResult[pixelNum]==1)&&(tileMask[pixelNum]==1))

[0102] Step 3.3

[0103] If the reg.beginQueryValid flag is valid, then the reg.queryResultCount count is incremented by 1, otherwise exit;

[0104] if(reg.beginQueryValid==1)

[0105] {reg.queryResultCount++;}

[0106] Step 3.4

[0107] The number of pixels that pass the depth test in the current drawing stream is stored in the reg.queryResultCount variable.

[0108] The specific execution process of step 4 above is defined as follows:

[0109] Step 4.1

[0110] Determine whether the glBeginQuery mark reg.beginQueryValid is valid at this time. If it is valid (if (reg.beginQueryValid == 1)), execute the next step; otherwise, execute and exit;

[0111] Step 4.2

[0112] Clear the reg.beginQueryValid flag: reg.beginQueryValid = 0;

[0113] Step 4.3

[0114] Assignment: reg.queryResult[reg.beginQueryId]=reg.queryResultCount;

[0115] Step 4.4

[0116] Clear count result: reg.queryResultCount = 0x0.

[0117] The specific execution process of step 5 above is as follows:

[0118] Step 5.1

[0119] Send command to processor 3 unit to configure FP register; trigger glGetQueryObject_write_event;

[0120] Step 5.2

[0121] The query result monitoring process is triggered by the event in the fragment processing unit 2, and the fragment processing unit 2 ROU_QueryData_Reg.querydata== is executed.

[0122] reg.queryResult[glGetQueryObject_id_reg.id];

[0123] Fragment processing unit 2 ROU_Ctrl_Reg.query_done = 1;

[0124] Step 5.3

[0125] Host 1 software blocks until fragment processing unit 2 ROU_Ctrl_Reg.query_done = 1;

[0126] Step 5.4

[0127] The host 1 software reads the fragment processing unit 2 ROU_QueryData_Reg.querydata to obtain the query result.

[0128] The above reg.beginQueryId is the ID number of glBeginQuery;

[0129] The above reg.beginQueryValid is the valid flag of glBeginQuery;

[0130] The above reg.queryResult[n] is a count array that stores n groups of occlusion query pass results;

[0131] The above reg.queryResultCount is the current count of the results of the occlusion query.

[0132] The above depthTestResult is the depth test result of the saved pixel;

[0133] The above tileMask is the mask that saves pixels;

[0134] The above glGetQueryObject_write_event represents the glGetQueryObject register write event;

[0135] The above fragment processing unit 2ROU_QueryData_Reg.querydata represents the result data of the occlusion query;

[0136] The above fragment processing unit 2 ROU_Ctrl_Reg.query_done indicates the completion flag of the occlusion query result.

[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An operating method of a GPU occlusion query TLM device based on SystemC, characterized in that: The SystemC-based GPU occlusion query TLM device includes a chip host, a fragment processing unit, a command processor, a register unit, a rasterization unit, and several transaction-level interfaces for connecting the various components; The host is connected to the command processor and the fragment processing unit respectively through a transaction level interface; The register unit is connected to the command processor and the fragment processing unit respectively through a transaction level interface; The rasterization unit is connected to the fragment processing unit via a transaction level interface; The host is used to generate an execution command of the graphic image, and send the execution command to the command processor through the transaction level interface; The command processor is used to parse the execution command and send the parsed execution command to the fragment processing unit and the register unit respectively; The rasterization unit is used to generate a fragment data stream and send the fragment data stream to the fragment processing unit; wherein the fragment processing unit is used for fragment processing and occlusion query operations of the data stream and sends the occlusion query operation results to the host; the register unit is used to cooperate with the fragment processing unit to store the data stream in the fragment processing and occlusion query operations; The operating method of the SystemC-based GPU occlusion query TLM device comprises the following steps: Step 1: The host generates an execution command and sends the execution command to the command processor through the transaction level interface; Step 2: The command processor sends the execution command to the fragment processing unit through the transaction level interface, and executes the start query operation; the start query operation is to specify the start of an occlusion query operation; the execution command in step 2 is the glBeginQuery function code; Step 2.1 The fragment processing unit reads reg.beginQueryId in the register unit; Step 2.2 The fragment processing unit sets the query start valid flag: reg.beginQueryValid = 1; Step 2.3 Reset query result value: reg.queryResult[reg.beginQueryId] = 0; Step 3: The fragment processing unit receives the fragment data stream from the rasterization unit, and the fragment processing process performs fragment operations; Step 3.1 If the depth test is enabled, continue to the next step; otherwise exit; Step 3.2 If the depth test of the pixel passes and the pixel is a valid pixel, continue to the next step; otherwise exit; if((depthTestResult[pixelNum]==1)&&(tileMask[pixelNum]==1)) Step 3.3 If the reg.beginQueryValid flag is valid, then the reg.queryResultCount count is incremented by 1, otherwise exit; if(reg.beginQueryValid==1) {reg.queryResultCount++;} Step 3.4 The number of pixels that pass the depth test in the current drawing stream is saved in the reg.queryResultCount variable; Step 4: The fragment processing unit receives the execution command sent by the command processor and executes the end query operation; the execution command in step 4 is the glEndQuery function code; the specific execution process is defined as follows: Step 4.1 Determine whether the glBeginQuery mark reg.beginQueryValid is valid at this time. If it is valid (if (reg.beginQueryValid == 1)), execute the next step; otherwise, execute and exit; Step 4.2 Clear the reg.beginQueryValid flag: reg.beginQueryValid = 0; Step 4.3 Assignment: reg.queryResult[reg.beginQueryId]=reg.queryResultCount; Step 4.4 Clear count result: reg.queryResultCount = 0x0; Step 5: The host calls glGetQueryObjec to obtain the query result through the fragment processing unit; Step 5.1 Send command to processor unit, configure FP register; trigger glGetQueryObject_write_event; Step 5.2 The query result monitoring process in the fragment processing unit is triggered by the event and executed Fragment processing unit ROU_QueryData_Reg.querydata == reg.queryResult[glGetQueryObject_id_reg.id]; Fragment processing unit ROU_Ctrl_Reg.query_done = 1; Step 5.3 The host software blocks until the fragment processing unit ROU_Ctrl_Reg.query_done = 1; Step 5.4 The host software reads the fragment processing unit ROU_QueryData_Reg.querydata to obtain the query result.

2. The operating method of the SystemC-based GPU occlusion query TLM device according to claim 1, characterized in that: The reg.beginQueryId is the ID number of glBeginQuery; The reg.beginQueryValid is the valid flag of glBeginQuery; The reg.queryResult[n] is a count array storing n groups of occlusion query pass results; The reg.queryResultCount is used to define the current count of the occlusion query pass results; The depthTestResult is the depth test result of the saved pixel; The tileMask is a mask for saving pixels; The glGetQueryObject_write_event represents a glGetQueryObject register write event; The fragment processing unit ROU_QueryData_Reg.querydata represents the result data of the occlusion query; The fragment processing unit ROU_Ctrl_Reg.query_done indicates the completion flag of the occlusion query result.