Method for multi-thread 3D graphics acceleration based on CPU without 3D GPU embedded chip
By evaluating the processing weights of 3D graphics processing tasks and the capabilities of CPU cores, and rationally allocating tasks to multiple CPU cores, the problem of low CPU processing efficiency in embedded chips without 3D GPUs was solved, thus achieving 3D graphics acceleration for the CPU.
Patent Information
- Application Number
- CN202411837896.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2044-12-13
AI Technical Summary
In scenarios where there is no 3D GPU embedded chip, the CPU is less efficient at performing 3D graphics processing.
By acquiring target task information and CPU core information for 3D graphics processing tasks, the processing weight and core capabilities are evaluated, a multi-threaded processing strategy is determined, and tasks are rationally allocated to multiple CPU cores for processing.
It improves the CPU's 3D graphics processing efficiency and enables CPU multi-threaded 3D graphics acceleration without a 3D GPU embedded chip.
Smart Images

Figure CN119722898B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of graphics processing, in particular to a method for CPU multi-thread 3D graphics acceleration based on no 3D GPU embedded chip. BACKGROUND
[0002] With the development of image processing technology, 3D graphics processing technology has also developed. The processing of 3D graphics includes various processing steps such as rendering, mapping and texture mapping. At present, in most 3D image processing scenarios, GPU (Graphics Processing Unit) is used to realize graphics processing. However, in some scenarios, there may be no GPU configured, and only CPU (Central Processing Unit) can be used for 3D graphics processing. In this case, if the existing processing strategy of CPU is used for processing, the efficiency of 3D graphics processing may be slow. SUMMARY
[0003] The purpose of the present disclosure is to provide a method for CPU multi-thread 3D graphics acceleration based on no 3D GPU embedded chip, so as to realize CPU multi-thread 3D graphics acceleration based on no 3D GPU embedded chip and improve the efficiency of 3D graphics processing of CPU.
[0004] In order to achieve the above purpose, the present disclosure provides a method for CPU multi-thread 3D graphics acceleration based on no 3D GPU embedded chip, comprising: obtaining target task information corresponding to a 3D graphics processing task and CPU core information; evaluating the 3D graphics processing task according to the target task information to obtain first evaluation information, wherein the first evaluation information is used to represent the processing weight of the 3D graphics processing task; evaluating a plurality of cores of the CPU according to the CPU core information to obtain second evaluation information, wherein the second evaluation information is used to represent the processing capacity of each core of the plurality of cores; determining a multi-thread processing strategy of the 3D graphics processing task according to the first evaluation information and the second evaluation information; and executing the 3D graphics processing task by the plurality of cores according to the multi-thread processing strategy.
[0005] Optionally, the evaluating the 3D graphics processing task according to the target task information to obtain first evaluation information comprises: determining a first processing weight according to the target task information and pre-configured task information, the pre-configured task information being task information matching the CPU capability; determining a second processing weight according to the target task information and a pre-trained evaluation model, the pre-trained evaluation model being configured to output the second processing weight according to input target task information; and obtaining first evaluation information for representing a target processing weight of the 3D graphics processing task according to the first processing weight and the second processing weight.
[0006] Optionally, the method further comprises: obtaining a first training data set, the first training data set comprising a plurality of first training samples, each first training sample comprising sample task information and a sample processing weight, wherein the sample task information is determined from a 3D graphics processing task executed by an external GPU, and the sample processing weight is determined by analyzing a real execution result of the external GPU for the 3D graphics processing task; determining a sample weight corresponding to the first training data set according to external GPU core information and the CPU core information; and training a to-be-trained evaluation model according to the first training data set and the sample weight corresponding to the first training data set to obtain the pre-trained evaluation model.
[0007] Optionally, the CPU core information comprises historical load information corresponding to a plurality of cores respectively, and the evaluating the plurality of cores of the CPU according to the CPU core information to obtain second evaluation information comprises: evaluating the plurality of cores respectively according to the historical load information corresponding to the plurality of cores respectively and pre-configured load information to obtain first processing capability evaluation values corresponding to the plurality of cores respectively; obtaining external GPU core information, the external GPU core information comprising real load change information corresponding to a plurality of GPU cores respectively when the GPU performs 3D graphics processing; evaluating the plurality of cores respectively according to the external GPU core information and the historical load information corresponding to the plurality of cores respectively to obtain second processing capability evaluation values corresponding to the plurality of cores respectively; and determining the second evaluation information according to the first processing capability evaluation values and the second processing capability evaluation values, the second evaluation information comprising target processing capability evaluation values corresponding to the plurality of cores respectively.
[0008] Optionally, the evaluating the plurality of cores respectively according to the external GPU core information and the historical load information corresponding to the plurality of cores respectively to obtain second processing capability evaluation values corresponding to the plurality of cores respectively comprises: determining first load prediction information according to the historical load information corresponding to the plurality of cores respectively and a pre-trained prediction model, the first load prediction information comprising predicted loads corresponding to the plurality of cores respectively; determining second load prediction information according to the external GPU core information and the pre-trained prediction model, the second load prediction information comprising predicted loads corresponding to the plurality of GPU cores respectively; and determining the second processing capability evaluation values corresponding to the plurality of cores respectively according to the first load prediction information and the second load prediction information.
[0009] Optionally, the method further comprises: obtaining a second training data set, the second training data set comprising a plurality of second samples and a plurality of third samples, each second sample comprising sample load information of the plurality of cores when performing a 3D graphics processing task, and each third sample comprising sample load information of the plurality of cores when performing a non-3D graphics processing task; determining load change rates corresponding to the plurality of second samples respectively and determining load change rates corresponding to the plurality of third samples respectively; determining first sub-samples from the plurality of second samples and second sub-samples from the plurality of third samples according to the load change rates corresponding to the plurality of second samples respectively and the load change rates corresponding to the plurality of third samples respectively; and training the to-be-trained prediction model according to the first sub-samples and the second sub-samples to obtain the pre-trained prediction model.
[0010] Optionally, the determining the corresponding multi-thread processing strategy of the 3D graphics processing task according to the first evaluation information and the second evaluation information comprises: dividing the 3D graphics processing task into a plurality of sub-processing tasks according to the first evaluation information; determining sub-task information corresponding to the plurality of sub-processing tasks respectively; determining cores corresponding to the plurality of sub-processing tasks respectively according to the second evaluation information and the sub-task information corresponding to the plurality of sub-processing tasks respectively; determining load adjustment strategies corresponding to the plurality of cores according to the first evaluation information and the second evaluation information; and determining the multi-thread processing strategy according to the plurality of sub-processing tasks, the cores corresponding to the plurality of sub-processing tasks respectively, and the load adjustment strategies corresponding to the plurality of cores.
[0011] Optionally, the determining the load adjustment strategy corresponding to the plurality of cores according to the first evaluation information and the second evaluation information comprises: judging whether the processing capability of each of the plurality of cores matches the processing weight of the 3D graphics processing task according to the first evaluation information and the second evaluation information; if the processing capability of each of the plurality of cores matches the processing weight of the 3D graphics processing task, determining that the load adjustment strategy corresponding to the plurality of cores is a first adjustment strategy, in which the load corresponding to the plurality of cores is adjusted every preset period; if the processing capability of each of the plurality of cores does not match the processing weight of the 3D graphics processing task, determining that the load adjustment strategy corresponding to the plurality of cores is a second adjustment strategy, in which the load corresponding to the plurality of cores is adjusted every time a preset number of sub-processing tasks are detected to be completed.
[0012] Optionally, the executing the 3D graphics processing task by the plurality of cores according to the multi-thread processing strategy comprises: allocating the plurality of sub-processing tasks to the cores corresponding to the plurality of sub-processing tasks respectively; executing the corresponding sub-processing tasks by the cores corresponding to the plurality of sub-processing tasks respectively; and adjusting the load corresponding to at least part of the plurality of cores according to the load adjustment strategy corresponding to the plurality of cores during the execution of the tasks.
[0013] Optionally, the 3D graphics processing task is a 3D graphics rendering task, and the method further comprises: in response to detecting that the 3D graphics processing task is executed completely within a preset time length, obtaining 3D graphics rendering information, adding first identification information to the rendered 3D graphics according to the 3D graphics rendering information, the first identification information being used to represent the rendering quality of the 3D graphics; and in response to not detecting that the 3D graphics processing task is executed completely within a preset time length, obtaining a 3D graphics rendering progress, and adding second identification information to the rendered 3D graphics according to the 3D graphics rendering progress, the second identification information being used to represent the rendering progress of the 3D graphics.
[0014] By the technical solution, the 3D graphics processing task is evaluated through the target task information corresponding to the 3D graphics processing task to obtain a processing weight, the core of the CPU is evaluated through the CPU core information to obtain the processing capability of the multiple cores, the multi-thread processing strategy is determined in combination of the processing weight and the processing capability of the multiple cores, and then the 3D graphics processing task is executed by the multiple cores based on the multi-thread processing strategy. Since the processing weight is information obtained from the perspective of the 3D graphics processing task, and the processing capability is information obtained from the perspective of the core information, the multi-thread processing strategy that is relatively reasonable and adaptive to the CPU core can be determined in combination of the two kinds of information, so that the task processing efficiency can be improved by using the multi-thread processing strategy to process the task, and the 3D graphics task acceleration of the CPU is realized. Therefore, the technical solution can realize the multi-thread 3D graphics acceleration of the CPU based on the 3D GPU-embedded embedded chip, and improve the 3D graphics processing efficiency of the CPU.
[0015] Other features and advantages of the present disclosure will be described in detail in the following detailed description section. BRIEF DESCRIPTION OF DRAWINGS
[0016] The accompanying drawings are included to provide a further understanding of the present disclosure and constitute a part of the specification, and are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation on the present disclosure. In the drawings:
[0017] Figure 1 is a schematic diagram of a CPU multi-thread according to an exemplary embodiment.
[0018] Figure 2 is a flowchart of a method of multi-thread 3D graphics acceleration of a CPU based on a 3D GPU-embedded embedded chip according to an exemplary embodiment.
[0019] Figure 3 is a running block diagram of a CPU according to an exemplary embodiment.
[0020] Figure 4 is a 3D rendering result schematic diagram according to an exemplary embodiment.
[0021] Figure 5 is a block diagram of an apparatus of multi-thread 3D graphics acceleration of a CPU based on a 3D GPU-embedded embedded chip according to an exemplary embodiment.
[0022] Figure 6 is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0023] The specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are intended to illustrate and explain the present disclosure, but not to limit the present disclosure.
[0024] It should be noted that all actions of obtaining signals, information or data in the present disclosure are carried out in accordance with the corresponding data protection regulations and policies of the country where the device is located, and with the authorization given by the owner of the corresponding device.
[0025] With the development of image processing technology, 3D graphics processing technology has also developed. The processing of 3D graphics includes various processing steps such as rendering, mapping and texture mapping. At present, in most 3D image processing scenarios, GPU (Graphics Processing Unit) is used to realize graphics processing, but in some scenarios, there may be no GPU configured, and only CPU (Central Processing Unit) can be used for 3D graphics processing. In this case, if the existing processing strategy of CPU is used for processing, the efficiency of 3D graphics processing may be slow.
[0026] Both CPU and GPU have multi-threading capability, which can execute tasks through multiple cores respectively to realize multi-threaded running of tasks.
[0027] In terms of graphics processing, the multi-threading capability of GPU is stronger than that of CPU, but the running efficiency of multi-threading can be improved by reasonably allocating tasks of CPU cores.
[0028] Therefore, the embodiment of the present disclosure provides a technical solution, which evaluates 3D graphics processing tasks by corresponding target task information of the 3D graphics processing tasks, obtains processing weights, evaluates the cores of the CPU by CPU core information, obtains the processing capability of multiple cores, determines a multi-threading processing strategy by combining the processing weights and the processing capability of multiple cores, and then executes the 3D graphics processing tasks by multiple cores based on the multi-threading processing strategy.
[0029] Since the processing weights are information obtained from the analysis of 3D graphics processing tasks, and the processing capability is information obtained from the analysis of core information, by combining the two kinds of information, a more reasonable and adaptive multi-threading processing strategy for CPU cores can be determined. Therefore, using the multi-threading processing strategy for task processing can improve the task processing efficiency and realize the acceleration of 3D graphics tasks of CPU. Therefore, the technical solution can realize the multi-threading 3D graphics acceleration of CPU based on 3D GPU-free embedded chips, and improve the 3D graphics processing efficiency of CPU.
[0030] It can be understood that the application scenario of the scheme is an embedded chip without a 3D GPU, which includes a CPU, and the 3D graphics processing is realized through the CPU.
[0031] Regarding the 3D graphics processing, it can involve multiple processing modes such as rendering, texture mapping, and mapping. Correspondingly, the 3D graphics processing task can involve one or more of these processing modes.
[0032] Figure 1 is a schematic diagram of CPU multithreading according to an exemplary embodiment. As shown in Figure 1 The CPU is divided into multiple cores, which can execute different threads respectively, so that the tasks are allocated to different cores, and the multiple cores can execute the tasks in a multithreading manner.
[0033] It can be understood that the technical scheme can be applied not only to CPU graphics acceleration, but also to other scenarios involving non-CPU hardware without GPU, and the non-CPU hardware also has multithreading capability.
[0034] Figure 2 is a flowchart of a method of CPU multithreading 3D graphics acceleration based on an embedded chip without a 3D GPU according to an exemplary embodiment, which includes the following steps:
[0035] Step S21, obtaining target task information and CPU core information corresponding to the 3D graphics processing task.
[0036] Step S22, evaluating the 3D graphics processing task according to the target task information to obtain first evaluation information, which is used to represent the processing weight of the 3D graphics processing task.
[0037] Step S23, evaluating the multiple cores of the CPU according to the CPU core information to obtain second evaluation information, which is used to represent the processing capability of the multiple cores respectively.
[0038] Step S24, determining the corresponding multithreading processing strategy of the 3D graphics processing task according to the first evaluation information and the second evaluation information.
[0039] Step S25, executing the 3D graphics processing task through the multiple cores according to the multithreading processing strategy.
[0040] In step S21, the 3D graphics processing task can be a current 3D graphics processing task to be executed, which can be a rendering task, a mapping task, a texture mapping task, etc., which is not limited here.
[0041] The target task information can be determined by analyzing the 3D graphics processing task. The target task information can include a task type, a task complexity, and a task data volume, etc.
[0042] The task type can be rendering, mapping, and texture mapping, etc. The task type can be carried in the task, and the task type can be determined by the task type identifier.
[0043] The task complexity can represent the complexity and difficulty of the task. The more complex the task is, the higher the difficulty of the task is. The task complexity can be determined by the task analysis technology in the art.
[0044] The task data volume can be the number of maps, the number of rendering elements, and the number of texture mappings, etc. The task data volume can be determined by counting the data involved in the task, or other analysis methods.
[0045] The CPU core information can be the information of multiple cores of the CPU. The information can be preset information, or information determined by the actual running of the multiple cores.
[0046] For example, the CPU core information can include the maximum load that the core can withstand, the data cache amount of the core, and the processing efficiency of the core, etc.
[0047] Further, in step S22, the 3D graphics processing task is evaluated according to the target information to obtain first evaluation information representing the processing weight.
[0048] The processing weight can represent the situation of the 3D graphics processing task from different dimensions, such as the task importance, the task difficulty (complexity), and the task fault tolerance, etc.
[0049] As an optional implementation, step S22 includes determining a first processing weight according to the target task information and pre-configured task information, the pre-configured task information being task information matching the CPU capability; determining a second processing weight according to the target task information and a pre-trained evaluation model, the pre-trained evaluation model being used to output the second processing weight according to the input target task information; and obtaining first evaluation information representing the target processing weight of the 3D graphics processing task according to the first processing weight and the second processing weight.
[0050] In this implementation, the task information matching the CPU capability can be pre-configured in the CPU. The first processing weight can be determined by comparing the target task information with the pre-configured task information.
[0051] In some embodiments, the greater the gap between the target task information and the pre-configured task information, the higher the first processing weight.
[0052] Regarding the gap between the target task information and the pre-configured task information, it can be the integrated result of the gap of each piece of information. For example, for different target task information, corresponding task information is pre-configured respectively, by comparing respectively, the gap of each information can be determined, and finally integrated to obtain the final gap.
[0053] The first processing weight can only evaluate the task from the perspective of CPU capability, and the task needs to be evaluated from other perspectives.
[0054] Therefore, the pre-trained evaluation information can also be used to determine the second processing weight according to the target task information.
[0055] Regarding the pre-trained evaluation model, it can be an evaluation model trained based on related data of GPU, so that the CPU can be as close to the GPU as possible.
[0056] Therefore, as an optional implementation, the training of the evaluation model includes: obtaining a first training data set, the first training data set including a plurality of first training samples, each first training sample including sample task information and sample processing weight, wherein the sample task information is task information determined from a 3D graphics processing task executed by an external GPU, and the sample processing weight is determined by analyzing the real execution result of the external GPU for the 3D graphics processing task; determining a sample weight corresponding to the first training data set according to the external GPU core information and the CPU core information; training the evaluation model to be trained according to the first training data set and the sample weight corresponding to the first training data set, to obtain the pre-trained evaluation model.
[0057] In this implementation, the 3D graphics processing task executed by the external GPU can be analyzed to extract the sample task information, and the sample task information can be labeled with the sample processing weight. The sample processing weight can be labeled by humans or other labeling methods, which are not limited here.
[0058] Regarding the external GPU, it can be a GPU other than the current chip, but related data can be obtained.
[0059] In this way, the model is pre-trained and integrated into the current CPU for task evaluation of the current CPU.
[0060] Further, the samples in the first training data set are samples in a GPU scene, and there is a certain gap between the GPU and the CPU. Therefore, external GPU core information can also be obtained, and the external GPU core information and the CPU core information are compared. The greater the gap in core information, the lower the sample weight.
[0061] In some embodiments, the same type of core information is compared, and multiple types of core information can be compared respectively, and then the comparison results of the multiple types of core information are integrated to obtain the final core information gap.
[0062] Further, the first training data set and the sample weight corresponding to the first training data set can be used to train the to-be-trained evaluation model to obtain a pre-trained evaluation model.
[0063] In this way, both GPU data and the gap between GPU and CPU are considered, and the model precision is improved. Moreover, there may be fewer scenarios for performing graphics processing by using the CPU at present. In this way, the difficulty of obtaining training data can be reduced.
[0064] In step S23, the multiple cores of the CPU are evaluated according to the CPU core information to obtain second evaluation information representing the processing capabilities of the multiple cores respectively.
[0065] In some embodiments, the CPU core information includes historical load information corresponding to the multiple cores respectively, and the CPU core evaluation can be implemented by using the information.
[0066] As an optional implementation, step S23 includes: evaluating the multiple cores respectively according to the historical load information corresponding to the multiple cores respectively and the preconfigured load information to obtain first processing capability evaluation values corresponding to the multiple cores respectively; obtaining external GPU core information, the external GPU core information including real load change information corresponding to the multiple GPU cores respectively when the GPU performs 3D graphics processing; evaluating the multiple cores respectively according to the external GPU core information and the historical load information corresponding to the multiple cores respectively to obtain second processing capability evaluation values corresponding to the multiple cores respectively; and determining the second evaluation information according to the first processing capability evaluation values and the second processing capability evaluation values, the second evaluation information including target processing capability evaluation values corresponding to the multiple cores respectively.
[0067] In this implementation, the multiple cores are first evaluated by using the preconfigured load information. The preconfigured load information can be load information corresponding to an optimal load condition, which can involve load conditions of the multiple cores, such as load distribution conditions, load change rates, and the like.
[0068] Further, by analyzing the historical load information corresponding to each of the plurality of cores, load information of the same type as the preconfigured load information is obtained, and then compared, and according to the comparison result, the first processing capability evaluation value is determined.
[0069] In some embodiments, the greater the gap, the lower the first processing capability evaluation value.
[0070] In some embodiments, the external GPU core information can include real load change information corresponding to each of the plurality of GPU cores when the GPU performs 3D graphics processing. The real load change information can represent the core load situation of the external GPU.
[0071] In some embodiments, according to the external GPU core information and the historical load information corresponding to each of the plurality of cores, the plurality of cores are respectively evaluated to obtain a second processing capability evaluation value corresponding to each of the plurality of cores, which can include: determining first load prediction information according to the historical load information corresponding to each of the plurality of cores and a pre-trained prediction model, the first load prediction information including predicted loads corresponding to each of the plurality of cores; determining second load prediction information according to the external GPU core information and the pre-trained prediction model, the second load prediction information including predicted loads corresponding to each of the plurality of GPU cores; and determining the second processing capability evaluation value corresponding to each of the plurality of cores according to the first load prediction information and the second load prediction information.
[0072] In this implementation, by using the pre-trained prediction model in combination with the corresponding load information, future load information is predicted.
[0073] In some embodiments, the first load prediction information and the second load prediction information are compared, and the greater the gap, the lower the second processing capability evaluation value.
[0074] In the above embodiments, the gap between various information can be a value gap or a gap represented by similarity. For details, refer to mature data processing technology in the art, which will not be described in detail here.
[0075] The pre-trained prediction model can be an unsupervised model based on time series, and the training sample thereof is the changing load information. By training the model using the changing load information, the model can have the ability to predict load information.
[0076] In addition, the aforementioned evaluation model is a supervised model, which can be a large model or other implementable neural network model.
[0077] As an optional implementation, the training of the prediction model comprises: obtaining a second training data set, the second training data set comprising a plurality of second samples and a plurality of third samples, each second sample comprising sample load information of the plurality of cores when performing a 3D graphics processing task, and each third sample comprising sample load information of the plurality of cores when performing a non-3D graphics processing task; determining a load change rate corresponding to each second sample, and determining a load change rate corresponding to each third sample; determining a first sub-sample from the plurality of second samples and a second sub-sample from the plurality of third samples according to the load change rate corresponding to each second sample and the load change rate corresponding to each third sample; and training the to-be-trained prediction model according to the first sub-sample and the second sub-sample to obtain the pre-trained prediction model.
[0078] In this implementation, two kinds of sample load information of the plurality of cores when performing the 3D graphics processing task and the non-3D graphics processing task can be collected.
[0079] Through the two kinds of sample load information, the load change rate is analyzed. As for the load change rate, it can be determined according to the load corresponding to each time point, and specific implementation can refer to mature technologies in the art, which represents the change of the load.
[0080] Further, the determination of the first sub-sample from the plurality of second samples and the second sub-sample from the plurality of third samples according to the load change rate corresponding to each second sample and the load change rate corresponding to each third sample can comprise: taking a sample with a load change rate higher than a threshold value as the first sub-sample, and taking a sample with a load change rate lower than the threshold value as the second sub-sample.
[0081] The threshold value can be set according to different application scenarios, for example, it can be 50%.
[0082] Alternatively, the determination of the first sub-sample from the plurality of second samples and the second sub-sample from the plurality of third samples according to the load change rate corresponding to each second sample and the load change rate corresponding to each third sample can comprise: comparing the difference between the load change rates of each second sample and each third sample, taking a second sample and a third sample with a smaller load change rate difference as the first sub-sample, and taking a second sample and a third sample with a larger load change rate difference as the second sub-sample.
[0083] As for the judgment of the load change rate difference, a range can be set. For example, if the load change rate difference is within 10%, it is considered to be smaller, otherwise, it is considered to be larger.
[0084] Further, the first sub-sample and the second sub-sample can be obtained, which can be regarded as contrast samples and are difference samples based on the load change rate.
[0085] Further, the first sub-sample and the second sub-sample can be used to cross-comparison training of the to-be-trained prediction model, so as to improve the generalization ability of the model.
[0086] Through the implementation, the load information ability of the prediction model can be improved, and more accurate first load prediction information and second load prediction information can be obtained.
[0087] Further, in step S24, the corresponding multi-thread processing strategy of the 3D graphics processing task is determined according to the first evaluation information and the second evaluation information.
[0088] In some embodiments, the multi-thread processing strategy can represent a task allocation manner and a load adjustment strategy.
[0089] Therefore, as an optional implementation, step S24 includes: dividing the 3D graphics processing task into a plurality of sub-processing tasks according to the first evaluation information; determining sub-task information corresponding to each of the plurality of sub-processing tasks; determining cores corresponding to each of the plurality of sub-processing tasks according to the second evaluation information and the sub-task information corresponding to each of the plurality of sub-processing tasks; determining a load adjustment strategy corresponding to each of the cores according to the first evaluation information and the second evaluation information; and determining the multi-thread processing strategy according to the plurality of sub-processing tasks, the cores corresponding to each of the plurality of sub-processing tasks, and the load adjustment strategy corresponding to each of the cores.
[0090] In this implementation, the 3D graphics processing task can be divided into a plurality of sub-processing tasks based on the first evaluation information.
[0091] In some embodiments, the first evaluation information can determine the number of the plurality of sub-processing tasks and the data amount of each sub-processing task. For example, the higher the processing weight, the more the number of the plurality of sub-processing tasks, and the less the data amount of each sub-processing task. Further, the graphics rendering task, the texture mapping task, and the mapping task can be divided into multi-thread sub-processing tasks. The specific division manner of the tasks can refer to the mature technology in the art. For example, the division manner based on array, vector, sequence, etc. can be used to implement task division according to corresponding rules.
[0092] In some embodiments, the sub-task information corresponding to each of the plurality of sub-processing tasks can be task complexity (difficulty) and task importance. The determination manner of the sub-task information can refer to the determination manner of the target task information, and the difference is that the sub-task information is determined for each sub-task.
[0093] Further, the second evaluation information and the sub-task information corresponding to each of the plurality of sub-processing tasks can be used to determine the core corresponding to each of the plurality of sub-processing tasks.
[0094] In some embodiments, the stronger the processing capability of the core, the higher the task difficulty and the task importance in the sub-task information corresponding to the core.
[0095] Therefore, the task information corresponding to various processing capabilities can be pre-configured, and the core corresponding to each of the plurality of sub-processing tasks can be determined according to the pre-configured information.
[0096] The load adjustment strategy can be used to adjust the load during task execution.
[0097] In some embodiments, the load adjustment strategy corresponding to the plurality of cores is determined according to the first evaluation information and the second evaluation information, including: determining whether the processing capability of each of the plurality of cores matches the processing weight of the 3D graphics processing task according to the first evaluation information and the second evaluation information; if the processing capability of each of the plurality of cores matches the processing weight of the 3D graphics processing task, determining that the load adjustment strategy corresponding to the plurality of cores is a first adjustment strategy, and in the first adjustment strategy, the load corresponding to the plurality of cores is adjusted every preset period; if the processing capability of each of the plurality of cores does not match the processing weight of the 3D graphics processing task, determining that the load adjustment strategy corresponding to the plurality of cores is a second adjustment strategy, and in the second adjustment strategy, the load corresponding to the plurality of cores is adjusted every time a preset number of sub-processing tasks are completed.
[0098] In this implementation, the highest processing capability and the lowest processing capability in the processing capability of each of the plurality of cores can be determined, and if any of the processing capabilities matches the processing weight of the 3D graphics processing task, it is considered that the processing capability of each of the plurality of cores matches the processing weight of the 3D graphics processing task.
[0099] In some embodiments, different processing weights can be pre-configured to adapt to different processing capabilities, and whether the processing capabilities match the processing weights can be determined according to the pre-configured information.
[0100] In some embodiments, in the matching case, the frequency of load adjustment can be reduced, and therefore the load adjustment can be performed according to a preset period. The preset period can be set according to different application scenarios, which is not limited herein.
[0101] In some embodiments, in the non-matching case, a high load adjustment frequency needs to be ensured to avoid CPU overload. Therefore, the load corresponding to the plurality of cores can be adjusted when a preset number of sub-processing tasks are completed.
[0102] The preset number can be determined according to the number of cores, for example, if the number of cores is 10, the preset number can be a value between 1 and 3.
[0103] It can be understood that the load needs to be adjusted every time the preset number of sub-processing tasks is detected to be completed, rather than only once.
[0104] Further, in step S25, performing the 3D graphics processing task by the plurality of cores according to the multi-thread processing strategy can include: assigning a plurality of sub-processing tasks to a plurality of cores corresponding to the plurality of sub-processing tasks respectively; performing the corresponding sub-processing tasks by the plurality of cores corresponding to the plurality of sub-processing tasks respectively; and adjusting the load corresponding to at least part of the plurality of cores according to the load adjustment strategy corresponding to the plurality of cores during the task execution process.
[0105] In this embodiment, the sub-processing tasks are divided and then executed by each core. During the task execution process, the load corresponding to at least part of the plurality of cores can be adjusted according to the load adjustment strategy corresponding to the plurality of cores.
[0106] In some embodiments, the load adjustment strategy is only used to determine the load adjustment timing. As for the specific load adjustment method, it can be, for example, load shunting, load transfer, and load reallocation, etc.
[0107] Figure 3 is a running block diagram of a CPU according to an exemplary embodiment, as shown in Figure 3 As shown, when receiving a 3D graphics processing task, first, a multi-thread processing strategy is formulated. Then, the task is assigned according to the multi-thread processing strategy. Next, during the multi-thread execution of the task by the plurality of cores, load adjustment is needed in corresponding cases.
[0108] Further, in different scenarios, after executing the 3D graphics processing task, corresponding feedback can be made according to the specific execution situation.
[0109] As an example, in a 3D rendering scenario, the 3D graphics processing task is a 3D graphics rendering task, and the method can further include: in response to detecting that the 3D graphics processing task is executed within a preset time length, obtaining 3D graphics rendering information, adding first identification information to the rendered 3D graphics according to the 3D graphics rendering information, the first identification information being used to represent the rendering quality of the 3D graphics; and in response to not detecting that the 3D graphics processing task is executed within a preset time length, obtaining a 3D image rendering progress, adding second identification information to the rendered 3D graphics according to the 3D graphics rendering progress, the second identification information being used to represent the rendering progress of the 3D graphics.
[0110] In this implementation, the completion of the 3D graphics processing task can be understood as each core completing the corresponding sub-processing task.
[0111] In some embodiments, the preset time length can be an estimated task execution time, and the specific value is not limited herein.
[0112] In some embodiments, the 3D graphics rendering information can be information related to the rendering quality of the 3D graphics, such as 3D graphics frame rate, smoothness, etc., which can be directly detected and determined for the completed rendering 3D graphics.
[0113] Further, based on the rendering information, the first identification information can be added to indicate the rendering quality. The first identification information can be a quality level, such as A level, B level, etc., and the higher the level, the better the quality.
[0114] In some embodiments, the 3D graphics rendering progress can be the completion progress of the sub-processing task, for example, there are a total of 100 sub-processing tasks, and currently 80 are completed, so the progress is 80%. Further, the rendering progress can be represented by the second identification information.
[0115] Figure 4 is a 3D rendering result diagram according to an exemplary embodiment, as shown in Figure 4 As shown, in the rendering scene, two kinds of 3D graphics that need to be rendered are involved, which correspond to different 3D graphics processing tasks. For the first kind of graphics, the rendering is completed, so the rendering level is displayed. For the second kind of image, the rendering is not completed, so the rendering progress is displayed.
[0116] The forms of the first identification information and the second identification information displayed can adopt various optional implementation manners, which are not limited herein.
[0117] Through the technical solution of the embodiments of the present disclosure, the 3D graphics processing task is evaluated by the target task information corresponding to the 3D graphics processing task, the processing weight is obtained, the core of the CPU is evaluated by the CPU core information, the processing capacity of the multiple cores is obtained, the multi-thread processing strategy is determined by combining the processing weight and the processing capacity of the multiple cores, and then the 3D graphics processing task is executed by the multiple cores based on the multi-thread processing strategy. Since the processing weight is information obtained from the analysis of the 3D graphics processing task, and the processing capacity is information obtained from the analysis of the core information, by combining the two kinds of information, a more reasonable and adaptive multi-thread processing strategy of the CPU core can be determined. Therefore, using the multi-thread processing strategy for task processing can improve the task processing efficiency and realize the 3D graphics task acceleration of the CPU. Therefore, the technical solution can realize the CPU multi-thread 3D graphics acceleration based on the non-3D GPU embedded chip and improve the 3D graphics processing efficiency of the CPU.
[0118] Figure 5 is a block diagram of an apparatus for CPU multi-thread 3D graphics acceleration based on no 3D GPU embedded chip according to an exemplary embodiment, as shown in Figure 4 , the apparatus comprises:
[0119] An obtaining module 501 is configured to obtain target task information corresponding to a 3D graphics processing task and CPU core information.
[0120] An evaluating module 502 is configured to evaluate the 3D graphics processing task according to the target task information to obtain first evaluation information, the first evaluation information being used to represent a processing weight of the 3D graphics processing task; and evaluate a plurality of cores of the CPU according to the CPU core information to obtain second evaluation information, the second evaluation information being used to represent processing capabilities of the plurality of cores respectively.
[0121] A processing module 503 is configured to determine a corresponding multi-thread processing strategy of the 3D graphics processing task according to the first evaluation information and the second evaluation information; and execute the 3D graphics processing task by the plurality of cores according to the multi-thread processing strategy.
[0122] As to the apparatus in the above-described embodiments, specific manners in which various modules perform operations have been described in details in the embodiments about the method, and will not be described in details here.
[0123] Figure 6 is a block diagram of an electronic device 600 according to an exemplary embodiment. As shown in Figure 6 , the electronic device 600 can include a processor 601 and a memory 602. The electronic device 600 can also include one or more of a multimedia component 603, an input / output (I / O) interface 604, and a communication component 605.
[0124] The processor 601 is configured to control overall operations of the electronic device 600 to complete all or part of the steps of the method for CPU multi-threaded 3D graphics acceleration based on a 3D GPU-embedded chip-free chip described above. The memory 602 is configured to store various types of data to support operations of the electronic device 600, which can include, for example, instructions for any application or method operating on the electronic device 600, and application-related data, such as contact data, sent and received messages, pictures, audio, video, and the like. The memory 602 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 603 can include a screen and an audio component. The screen can be, for example, a touch screen, and the audio component is configured to output and / or input audio signals. For example, the audio component can include a microphone configured to receive external audio signals. The received audio signals can be further stored in the memory 602 or transmitted through the communication component 605. The audio component also includes at least one speaker configured to output audio signals. The I / O interface 604 provides an interface between the processor 601 and other interface modules, which can be a keyboard, a mouse, a button, and the like. The buttons can be virtual buttons or physical buttons. The communication component 605 is configured to perform wired or wireless communication between the electronic device 600 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, near field communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, and the like, or a combination of one or more of them, is not limited herein. Therefore, the corresponding communication component 605 can include a Wi-Fi module, a Bluetooth module, an NFC module, and the like.
[0125] In an exemplary embodiment, the electronic device 600 can be implemented by one or more Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), controller, microcontroller, microprocessor or other electronic elements for executing the above-mentioned method of 3D graphics acceleration based on multi-threading of CPU without 3D GPU embedded chip.
[0126] In another exemplary embodiment, a computer readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the above-mentioned method of 3D graphics acceleration based on multi-threading of CPU without 3D GPU embedded chip. For example, the computer readable storage medium can be the above-mentioned memory 602 including program instructions, and the above-mentioned program instructions can be executed by the processor 601 of the electronic device 600 to complete the above-mentioned method of 3D graphics acceleration based on multi-threading of CPU without 3D GPU embedded chip.
[0127] The preferred embodiments of the present disclosure are described in detail above with reference to the accompanying drawings, but the present disclosure is not limited to the specific details in the above-described embodiments. Within the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
[0128] In addition, it should be noted that each specific technical feature described in the above-described specific embodiments can be combined in any appropriate manner without contradiction, and in order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0129] Furthermore, various different embodiments of the present disclosure can also be combined in any appropriate manner, as long as it does not deviate from the idea of the present disclosure, and it should be considered as disclosed by the present disclosure.
Claims
1. A method for CPU multi-threaded 3D graphics acceleration based on 3D GPU- free embedded chip, characterized in that, The method comprises: obtaining target task information and CPU core information corresponding to a 3D graphics processing task; evaluating the 3D graphics processing task according to the target task information to obtain first evaluation information, the first evaluation information being used to represent a processing weight of the 3D graphics processing task; evaluating a plurality of cores of the CPU according to the CPU core information to obtain second evaluation information, the second evaluation information being used to represent processing capabilities of the plurality of cores respectively; determining a corresponding multi-thread processing strategy of the 3D graphics processing task according to the first evaluation information and the second evaluation information; executing the 3D graphics processing task through the plurality of cores according to the multi-thread processing strategy; The method further comprises: obtaining a first training data set, the first training data set comprising a plurality of first training samples, each first training sample comprising sample task information and a sample processing weight, wherein the sample task information is determined from a 3D graphics processing task executed by an external GPU, and the sample processing weight is determined by analyzing a real execution result of the external GPU for the 3D graphics processing task; determining a sample weight corresponding to the first training data set according to external GPU core information and the CPU core information; training a to-be-trained evaluation model according to the first training data set and the sample weight corresponding to the first training data set to obtain the pre-trained evaluation model. The method further comprises: dividing the 3D graphics processing task into a plurality of sub-processing tasks according to the first evaluation information; determining sub-task information corresponding to the plurality of sub-processing tasks respectively; determining cores corresponding to the plurality of sub-processing tasks respectively according to the second evaluation information and the sub-task information corresponding to the plurality of sub-processing tasks respectively; determining load adjustment strategies corresponding to the plurality of cores according to the first evaluation information and the second evaluation information; and determining the multi-thread processing strategy according to the plurality of sub-processing tasks, the cores corresponding to the plurality of sub-processing tasks, and the load adjustment strategies corresponding to the plurality of cores. 2. The method of claim 1, wherein, The CPU core information includes historical load information corresponding to each of the plurality of cores, and the evaluating the plurality of cores according to the CPU core information to obtain second evaluation information includes: evaluating each of the plurality of cores according to the historical load information corresponding to each of the plurality of cores and pre-configured load information to obtain a first processing capability evaluation value corresponding to each of the plurality of cores; obtaining external GPU core information, the external GPU core information including real load change information corresponding to each of a plurality of GPU cores when the GPU performs 3D graphics processing; evaluating each of the plurality of cores according to the external GPU core information and the historical load information corresponding to each of the plurality of cores to obtain a second processing capability evaluation value corresponding to each of the plurality of cores; determining the second evaluation information according to the first processing capability evaluation value and the second processing capability evaluation value, the second evaluation information including a target processing capability evaluation value corresponding to each of the plurality of cores.
3. The method of claim 2, wherein, The evaluating each of the plurality of cores according to the external GPU core information and the historical load information corresponding to each of the plurality of cores to obtain a second processing capability evaluation value corresponding to each of the plurality of cores includes: determining first load prediction information according to the historical load information corresponding to each of the plurality of cores and a pre-trained prediction model, the first load prediction information including predicted loads corresponding to each of the plurality of cores; determining second load prediction information according to the external GPU core information and the pre-trained prediction model, the second load prediction information including predicted loads corresponding to each of the plurality of GPU cores; determining the second processing capability evaluation value corresponding to each of the plurality of cores according to the first load prediction information and the second load prediction information.
4. The method of claim 3, wherein, The method further includes: obtaining a second training data set, the second training data set including a plurality of second samples and a plurality of third samples, each second sample including sample load information of the plurality of cores when performing a 3D graphics processing task, and each third sample including sample load information of the plurality of cores when performing a non-3D graphics processing task; determining load change rates corresponding to each of the plurality of second samples and determining load change rates corresponding to each of the plurality of third samples; determining a first sub-sample from the plurality of second samples and a second sub-sample from the plurality of third samples according to the load change rates corresponding to each of the plurality of second samples and the load change rates corresponding to each of the plurality of third samples; training a to-be-trained prediction model according to the first sub-sample and the second sub-sample to obtain the pre-trained prediction model.
5. The method of claim 1, wherein, The determining a load adjustment strategy corresponding to the plurality of cores according to the first evaluation information and the second evaluation information includes: determining whether the processing capability of each of the plurality of cores matches the processing weight of the 3D graphics processing task according to the first evaluation information and the second evaluation information. If the processing capability of each of the plurality of cores matches the processing weight of the 3D graphics processing task, it is determined that the load adjustment strategy corresponding to the plurality of cores is a first adjustment strategy, in which the load corresponding to the plurality of cores is adjusted every preset period. If the processing capability of each of the plurality of cores does not match the processing weight of the 3D graphics processing task, it is determined that the load adjustment strategy corresponding to the plurality of cores is a second adjustment strategy, in which the load corresponding to the plurality of cores is adjusted every time a preset number of sub-processing tasks are completed.
6. The method of claim 5, wherein, The execution of the 3D graphics processing task by the plurality of cores according to the multi-thread processing strategy includes: allocating the plurality of sub-processing tasks to the cores corresponding to the plurality of sub-processing tasks, respectively; executing the corresponding sub-processing tasks by the cores corresponding to the plurality of sub-processing tasks, respectively; adjusting the load corresponding to at least part of the plurality of cores according to the load adjustment strategy corresponding to the plurality of cores during the execution of the task.
7. The method of claim 1, wherein, The 3D graphics processing task is a 3D graphics rendering task, and the method further includes: in response to detecting that the 3D graphics processing task is completed within a preset time length, obtaining 3D graphics rendering information, adding first identification information to the rendered 3D graphics according to the 3D graphics rendering information, the first identification information being used to represent the rendering quality of the 3D graphics; in response to not detecting that the 3D graphics processing task is completed within a preset time length, obtaining a 3D graphics rendering progress, and adding second identification information to the rendered 3D graphics according to the 3D graphics rendering progress, the second identification information being used to represent the rendering progress of the 3D graphics.
Citation Information
Patent Citations
Multithread realization method for rasterization stage in graphic rendering
CN102736947A