A Fragment Scheduling Method Based on WRR Algorithm in a Graphics Processor
By adopting the fragment scheduling method based on WRR algorithm in the graphics processor, the problem of unbalanced gcu fragment scheduling is solved, the scheduling equality of all gcu is achieved, and the performance of the graphics processor is improved.
Patent Information
- Application Number
- CN202210548485.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-20
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-05-20
AI Technical Summary
In the prior art, the fragment scheduling of gcu in the graphics processor is unbalanced, resulting in some gcu being too idle or busy, affecting the performance of graphics processing.
The fragment scheduling method based on the WRR algorithm is adopted to schedule multiple channels of the pixel scanning module through weight ratio to ensure the scheduling balance of all gcu.
Through unified scheduling methods, the scheduling balance of all gcus is ensured, and some gcus are prevented from happening too idle or busy, and the performance and efficiency of the graphics processor are improved.
Smart Images

Figure CN114820280B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of graphics processors, and in particular to a fragment scheduling method based on a WRR algorithm in a graphics processor. Background Art
[0002] Fragment scheduling is a key technology in graphics processors and an important part of improving graphics processor performance.
[0003] At present, there is a hardware acceleration implementation method for scheduling and managing dye fragments in a GPU, such as the Chinese invention patent with publication number x. In this patent, the raster is an 8-channel pixel scan, and every 2 channels are fixedly scheduled to 4 gcu, that is, 8 channels correspond to 16 gcu. The patent mainly describes how 2 channels of the raster are scheduled to 4 gcu, channel 0 is fixedly scheduled to gcu0 and gcu2, and channel 1 is fixedly scheduled to gcu1 and gcu3.
[0004] Although the above method can solve the first-in-first-out relationship of different scanned primitives and different channel scanned fragments of the same primitive in actual processing, it prevents the fragments of subsequent primitives from being dyed before the fragments of the previous primitives. The raster module mainly scans point, line and triangle primitives, and more often scans triangle primitives. Due to the characteristics of the triangular pyramid shape, the smaller the channel value in the figure, the fewer the number of fragments scanned by the channel. On the contrary, if it is an inverted triangle, the larger the channel value, the fewer the number of fragments scanned by the channel. Therefore, it is easy for small-numbered gcu or large-numbered gcu to not have enough fragments for dyeing. Summary of the invention
[0005] The technical problem to be solved by the present invention is to overcome the defects of the prior art. The present invention proposes a fragment scheduling method based on the WRR algorithm in a graphics processor that can improve the balance of all gcu.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is: a fragment scheduling method based on the WRR algorithm in a graphics processor, comprising the following steps:
[0007] S1. Use the WRR algorithm to weight multiple channels in the pixel scanning module;
[0008] S2, the scheduling module sequentially schedules the multiple data fragments generated by the pixel scanning module to the fragment dyer according to the weights corresponding to the channels, and determines the end of the scheduling by the number of fragments corresponding to the weights or the empty state in the channel, wherein the number of fragments is related to the number of processors and the number of processor threads in the single fragment dyeing;
[0009] S3, the scheduling module repeats S2 until all pixel scanning modules are scheduled, and at the same time, the fragment colorizer id and the number of scheduled fragments at the end of each round of corresponding scheduling are strung into a list;
[0010] S4, the scheduling module selects the fragment dyer with the smallest id in turn to dye the fragments that have been scheduled, and reads the fragment dyer dyeing completion information according to the first-in-first-out principle in the S3 list, and schedules it to the pixel processing module again.
[0011] Furthermore, the weight matching in step S1 specifically includes: when the pixel scanning module is row scanning, the internal channel weight matching ratio is all 1; when the pixel scanning module is block scanning, the internal channel matching weight is based on the number of block scanning segments.
[0012] Furthermore, the scheduling module performs scheduling by adjusting the speed of one segment per beat.
[0013] Furthermore, each channel includes 1-32 attributes.
[0014] Furthermore, the pixel scanning module has 4 channels or 8 channels.
[0015] Compared with the prior art, the beneficial effects of the present invention include: through the unified scheduling method of the scheduling module, the scheduling balance of all gcu can be guaranteed to prevent some gcu from being too idle or busy; the number of channel scheduling fragments inside gcu can be flexibly configured through the WRR algorithm, which is suitable for various fragment scanning methods, and the scheduling balance of gcu is more reliable. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The disclosure of the present invention is described with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. In the accompanying drawings, the same reference numerals are used to refer to the same components. Among them:
[0017] Figure 1 The figure is a schematic diagram of the preparation process of a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0018] It is easy to understand that according to the technical solution of the present invention, without changing the essential spirit of the present invention, a person skilled in the art can propose a variety of interchangeable structural modes and implementation modes. Therefore, the following specific implementation modes and drawings are only exemplary descriptions of the technical solution of the present invention, and should not be regarded as the whole of the present invention or as a limitation or restriction to the technical solution of the present invention.
[0019] According to one embodiment of the present invention, Figure 1 A fragment scheduling method based on the WRR algorithm in a graphics processor is shown, comprising the following steps:
[0020] S1. Use the WRR algorithm to weight multiple channels in the pixel scanning module;
[0021] S2, the scheduling module sequentially schedules the multiple data fragments generated by the pixel scanning module to the fragment dyer according to the weights corresponding to the channels, and determines the end of the scheduling by the number of fragments corresponding to the weights or the empty state in the channel, wherein the number of fragments is related to the number of processors and the number of processor threads in the single fragment dyeing;
[0022] S3, the scheduling module repeats S2 until all pixel scanning modules are scheduled, and at the same time, the fragment colorizer id and the number of scheduled fragments at the end of each round of corresponding scheduling are strung into a list;
[0023] S4, the scheduling module selects the fragment dyer with the smallest id in turn to dye the fragments that have been scheduled, and reads the fragment dyer dyeing completion information according to the first-in-first-out principle in the S3 list, and schedules it to the pixel processing module again.
[0024] The data source of the scheduling module is the fragment information generated by the pixel scanning module (raster). Each fragment contains up to 32 attributes such as color and coordinates. In order to generate enough fragments for the fragment colorizer (gcu) in the pixel processing module, the raster module needs enough channels to scan the fragment information at the same time, but at the same time, the coloring efficiency of the colorizer (gcu) must be taken into account. Therefore, we generally design a 4-channel or 8-channel pixel scanning module (raster)
[0025] The function of the fragment scheduling module is to schedule the fragment information generated by the raster module to the gcu module for fragment coloring at the fastest speed. The number of fragments scheduled to the gcu module each time is 32, which is determined by the number of processors in the gcu and the number of threads of each processor.
[0026] In order to achieve greater scheduling flexibility, the present invention adopts the Weight round robin (WRR) algorithm to implement it. First, different or the same weight is configured for each channel, and then the corresponding number of fragments is scheduled according to its weight starting from channel 0, and then channels 1 / 2 / 3 are scheduled in turn to complete a round of scheduling. During this period, every time the scheduling of 32 fragments of the current gcu is completed, the next idle gcu is selected for scheduling until all fragments are scheduled.
[0027] Through a unified scheduling method, the fragments of the four channels of the raster are dispatched to the same gcu through the WRR algorithm in turn, and then dispatched to the next gcu in turn. At the same time, the gcu ids that have been scheduled are strung into a list and dispatched to the pixel processing module (rop) according to the first-in-first-out order when the fragment dyeing is completed. This can avoid the situation of unbalanced scheduling and ensure the first-in-first-out order of the fragments. Another biggest advantage is that the weights of different channels can be configured to achieve maximum flexibility.
[0028] In order to prevent bottlenecks from occurring in the scheduling module, it is necessary to ensure that the scheduling module schedules one segment attribute per beat, thereby achieving maximum scheduling efficiency.
[0029] The Raster module scans the fragment information of 4 channels simultaneously and writes it into the corresponding fifo (channel) according to the row scanning or block scanning mode. Each complete fragment information contains 1-32 attributes;
[0030] The weight values of the four fifos are configured as w0, w1, w2, and w3 respectively. This weight value is used to schedule the number of fragments in a single round;
[0031] The scheduling module first finds a gcu with the smallest id from all idle gcu. Each gcu can schedule 32 fragment information.
[0032] Then start scheduling the fragment information from fifo 0 to the gcu selected above. When w0 fragments are scheduled or fifo 0 is empty, start scheduling fifo 1. Similarly, when w1 fragments are scheduled or fifo 1 is empty, start scheduling fifo 2, and so on until all four fifos are scheduled. At this time, one round of scheduling ends, and then the next round of scheduling begins;
[0033] During the scheduling process, as long as 32 fragments are fully scheduled, the GCU with the smallest ID among the remaining idle GCUs will continue to be selected to schedule the next 32 fragments;
[0034] After each GCU is scheduled, the GCU ID and the number of scheduled fragments are put into a list. According to the first-in-first-out principle, the fragment dyeing completion information is read from the GCU that is first put into the list, and then it is scheduled to the pixel processing module (rop) again;
[0035] The scheduling of all scanning module fragments is completed according to the above three scheduling strategies.
[0036] The biggest advantage of this scheduling scheme is its great configuration flexibility. When raster adopts row scanning mode, the weight value can be configured as 1, then 4 raster channels schedule one fragment each time, and each gcu schedules 32 fragments, which is equivalent to 4*8 scanning blocks, which can improve the cache hit rate of a single gcu during texture mapping; when raster adopts block scanning mode, the weight value can be configured as the number of block scanning fragments, then the fragments scheduled to the same gcu are all fragment blocks in the same channel, which can also improve the cache hit rate of a single gcu during texture mapping;
[0037] This scheduling scheme adopts a unified scheduling method, which can ensure the scheduling balance of all GCUs and prevent some GCUs from being too idle or busy. However, the premise is to use the scheduled GCU ID string list method to ensure the first-in-first-out order.
[0038] In general 3D rendering application scenarios, each fragment contains 1 to 2 attributes, and each gcu schedules 32 fragments. According to the present invention, one attribute calculation is scheduled in each beat, so scheduling a gcu requires 32 to 64 beats, and scheduling a round of gcu requires 512 to 1024 beats, which is much less than the time it takes for the gcu dyer to complete the dyeing of 32 fragments. When the fragment contains more attributes, the scheduling time becomes longer, and the dyeing time also needs to be calculated and compared according to the complexity of the actual dyeing program.
[0039] The technical scope of the present invention is not limited to the contents in the above description. Those skilled in the art can make various deformations and modifications to the above embodiments without departing from the technical idea of the present invention, and these deformations and modifications should all fall within the protection scope of the present invention.
Claims
1. A fragment scheduling method based on the WRR algorithm in a graphics processor, characterized in that The steps include: S1. Use the WRR algorithm to weight multiple channels in the pixel scanning module; S2, the scheduling module sequentially schedules the multiple data fragments generated by the pixel scanning module to the fragment dyer with the weights corresponding to the channels, and determines the end of the single channel scheduling with the number of fragments corresponding to the weights or the empty state in the channel, wherein the number of fragments scheduled to the fragment dyer each time is related to the number of processors and the number of processor threads in the single fragment dyeing; S3, the scheduling module repeats S2 until all pixel scanning modules are scheduled, and at the same time, the fragment colorizer id and the number of scheduled fragments at the end of each round of corresponding scheduling are strung into a list; S4, the scheduling module selects the fragment dyer with the smallest id in turn to dye the fragments that have been scheduled, and reads the fragment dyer dyeing completion information according to the first-in-first-out principle in the S3 list, and schedules it to the pixel processing module again.
2. The fragment scheduling method based on the WRR algorithm in a graphics processor according to claim 1, characterized in that: The weight matching in step S1 specifically includes: when the pixel scanning module is row scanning, the internal channel weight matching ratio is all 1; when the pixel scanning module is block scanning, the internal channel matching weight is based on the number of block scanning segments.
3. The fragment scheduling method based on the WRR algorithm in a graphics processor according to claim 1, characterized in that: The scheduling module schedules a segment speed per beat.
4. The fragment scheduling method based on the WRR algorithm in a graphics processor according to claim 1, characterized in that: Each channel contains 1 to 32 attributes.
5. The fragment scheduling method based on the WRR algorithm in a graphics processor according to claim 1, characterized in that: The pixel scanning module has 4 channels or 8 channels.
Citation Information
Patent Citations
A hardware accelerated implementation method of dyeing fragment scheduling management in GPU
CN108958921A
Task scheduling method, and electronic equipment
CN113986512A