Information processing method, device, equipment, storage medium and computer program product
By measuring the running memory changes of the test application to determine the compiled memory of the shader variant, it solves the problem of pre-compilation in the application, avoids compilation lags and program crashes, and improves the user experience.
Patent Information
- Application Number
- CN202111352425.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-11-15
AI Technical Summary
The existing technology cannot accurately determine the shader variants that need to be precompiled in the application, resulting in problems such as compilation lags caused by real-time compilation or program crashes caused by precompilation.
Determine the compiled memory of the shader variant by obtaining the difference between the running memory of the test application, and then determine whether pre-compilation is needed to ensure that compilation lags and program crashes are avoided when the target application is running.
It effectively solves the compilation lag problem caused by real-time compilation of shader variants, avoids program crashes during pre-compilation, and improves user experience.
Smart Images

Figure CN113971072B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an information processing method, apparatus, device, storage medium and computer program product. Background Art
[0002] With the rapid development of computer technology, various applications have emerged; during the running process of the application, the shader variants referenced by the application can be compiled to render the application screen in the application, and then interact with the user based on the application screen in the application. Generally speaking, the shader variants referenced by the application are compiled in real time. Since compiling shader variants will occupy running memory, when a large number of shader variants referenced by the application are compiled, it will cause compilation jams, which will affect the user experience; based on this, the shader variants referenced by the application can be precompiled to reduce the compilation jams caused by real-time compilation, but when a large number of shader variants referenced by the application are precompiled, it may cause the program to crash. Based on this, how to determine the shader variants that need to be precompiled in the application is a problem that needs to be solved urgently. However, in the prior art, since it is impossible to determine the running memory required when compiling each shader variant referenced by the application, it is impossible to accurately determine the shader variants that need to be precompiled in the application. Summary of the invention
[0003] Embodiments of the present application provide an information processing method, apparatus, device, storage medium, and computer program product, which can determine the compiled memory of each shader variant referenced by a target application based on processing a test application.
[0004] On the one hand, an embodiment of the present application provides an information processing method, including:
[0005] Obtaining N shader variants referenced by a test application; wherein the test application is used to test the N shader variants referenced by a target application, and the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application; the N shader variants are compiled for rendering an application screen, and N is a positive integer;
[0006] Before compiling an nth shader variant among N shader variants referenced by the test application, obtaining a first running memory occupied by the test application, and after compiling the nth shader variant, obtaining a second running memory occupied by the test application, where n is a positive integer less than or equal to N;
[0007] Based on the first running memory and the second running memory, the compilation memory of the nth shader variant is determined, the compilation memory of the nth shader variant indicates the running memory required when compiling the nth shader variant, and the compilation memory of the nth shader variant is used to determine whether the nth shader variant needs to be precompiled when the target application is running.
[0008] On the one hand, an embodiment of the present application provides another information processing method, including:
[0009] Obtain N compiled memories of N shader variants referenced by a target application; each of the N shader variants has a compiled memory, the N shader variants are compiled when the target application is running to render an application screen in the target application, and the compiled memory of each shader variant is obtained by testing in a test application that references the N shader variants, where N is a positive integer;
[0010] Determine a target shader variant from the N shader variants based on the N compiled memories of the N shader variants and the available running memory of the graphics processor;
[0011] When the target application is running, the target shader variant is loaded and precompiled.
[0012] On the one hand, an embodiment of the present application provides a program testing device, including:
[0013] an acquisition unit, configured to acquire N shader variants referenced by a test application; wherein the test application is used to test the N shader variants referenced by a target application, and the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application; the N shader variants are compiled for rendering an application screen, and N is a positive integer;
[0014] a processing unit, configured to obtain a first running memory occupied by the test application before compiling an nth shader variant among N shader variants referenced by the test application, and to obtain a second running memory occupied by the test application after compiling the nth shader variant, where n is a positive integer less than or equal to N;
[0015] The processing unit is further used to determine the compilation memory of the nth shader variant based on the first running memory and the second running memory, the compilation memory of the nth shader variant indicates the running memory required when compiling the nth shader variant, and the compilation memory of the nth shader variant is used to determine whether the nth shader variant needs to be precompiled when the target application is running.
[0016] On the one hand, an embodiment of the present application provides a program execution device, including:
[0017] an acquisition unit, configured to acquire N compiled memories of N shader variants referenced by a target application; each of the N shader variants has a compiled memory, the N shader variants are compiled when the target application is running to be used for rendering an application screen in the target application, the compiled memory of each shader variant is obtained by testing in a test application that references the N shader variants, and N is a positive integer;
[0018] A processing unit, configured to determine a target shader variant from the N shader variants based on the N compiled memories of the N shader variants and available running memory of the graphics processor;
[0019] The processing unit is further configured to load the target shader variant and precompile the target shader variant when the target application is running.
[0020] On the one hand, an embodiment of the present application provides a program testing device, characterized in that the program testing device includes an input interface and an output interface, and further includes:
[0021] a processor adapted to implement one or more instructions; and,
[0022] A computer storage medium storing one or more instructions, wherein the one or more instructions are suitable for being loaded by the processor and executing the above-mentioned information processing method.
[0023] On the one hand, an embodiment of the present application provides a program execution device, characterized in that the program execution device includes an input interface and an output interface, and further includes:
[0024] a processor adapted to implement one or more instructions; and,
[0025] A computer storage medium storing one or more instructions, wherein the one or more instructions are suitable for being loaded by the processor and executing the above-mentioned another information processing method.
[0026] On the one hand, an embodiment of the present application provides a computer storage medium, characterized in that computer program instructions are stored in the computer storage medium, and when the computer program instructions are executed by a processor, they are used to perform the above-mentioned one information processing method or another information processing method.
[0027] On the one hand, an embodiment of the present application provides a computer program product or a computer program, wherein the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor of a program testing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, and when the computer instructions are executed by the processor, they are used to execute the above-mentioned information processing method.
[0028] On the one hand, an embodiment of the present application provides a computer program product or a computer program, wherein the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor of a program execution device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, and when the computer instructions are executed by the processor, they are used to execute the above-mentioned another information processing method.
[0029] In an embodiment of the present application, the running memory required for compiling each shader variant referenced by the target application can be determined based on the processing of the test application, that is, the compiling memory of each shader variant referenced by the target application can be determined based on the processing of the test application; wherein the test application is used to test the N shader variants referenced by the target application, and the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application, and N is a positive integer. In a specific implementation, before compiling the nth shader variant among the N shader variants referenced by the test application, the first running memory occupied by the test application can be obtained, and after compiling the nth shader variant, the second running memory occupied by the test application can be obtained, and n is a positive integer less than or equal to N; based on the first running memory and the second running memory, the compiling memory of the nth shader variant is determined. Based on the processing of the test application, the compiled memory of each shader variant referenced by the target application can be determined, and then the shader variant that needs to be precompiled can be determined from the various shader variants based on the compiled memory of each shader variant, thereby solving the compilation jam problem that may be caused by real-time compilation of shader variants and avoiding the program crash problem that may be caused by precompilation, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 It is a structural diagram of an information processing system provided by an embodiment of the present application;
[0032] Figure 2 It is a flowchart of an information processing method provided by an embodiment of the present application;
[0033] Figure 3 This is a schematic diagram of memory distribution of a process of an application program obtained based on a memory query command provided in an embodiment of the present application;
[0034] Figure 4a is a schematic diagram of obtaining a first running memory occupied by a test application provided in an embodiment of the present application;
[0035] Figure 4b is another schematic diagram of obtaining the first running memory occupied by the test application provided in an embodiment of the present application;
[0036] Figure 5 It is a schematic diagram provided by an embodiment of the present application of implementing a second reflection function to reflectively call a memory output interface provided by a memory information class to obtain an execution code of a first running memory;
[0037] Figure 6 It is a flowchart of another information processing method provided by an embodiment of the present application;
[0038] Figure 7 It is a flowchart of another information processing method provided by an embodiment of the present application;
[0039] Figure 8 is a statistical diagram of the number of shader variants provided in an embodiment of the present application;
[0040] Fig. 9 is a schematic diagram of compiled code corresponding to a shader variant provided in an embodiment of the present application;
[0041] Fig.10 is a schematic diagram of a performance evaluation result of a shader function provided in an embodiment of the present application;
[0042] Fig.11 is a schematic diagram of a performance evaluation report provided in an embodiment of the present application;
[0043] Fig.12 is a structural schematic diagram of a program testing device provided in an embodiment of the present application;
[0044] Fig.13 It is a structural diagram of a program execution device provided in an embodiment of the present application;
[0045] Fig.14 It is a structural schematic diagram of a program testing device provided in an embodiment of the present application;
[0046] Fig.15 It is a structural diagram of a program execution device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] The embodiment of the present application provides an information processing scheme, which can determine the compiled memory of each shader variant referenced by the target application based on the processing of the test application, and then determine the shader variant that needs to be precompiled from each shader variant based on the compiled memory of each shader variant, and then solve the compilation jamming problem that may be caused by real-time compilation of the shader variant and avoid the program crash problem that may be caused by precompilation, thereby improving the user experience. Among them, the shader variant is compiled for rendering the application screen, the test application is used to test the shader variant referenced by the target application, the shader variant referenced by the test application is consistent with the shader variant referenced by the target application, and the compiled memory of each shader variant referenced by the target application indicates the running memory required when compiling each shader variant.
[0049] In one embodiment, a shader variant is compiled for rendering an application screen, that is, an application screen in an application is rendered based on a shader variant referenced by the application. A shader variant is a combination of macros defined in a shader, and a shader is an editable program that can replace a fixed rendering pipeline for image rendering. A shader usually defines multiple macros, and different rendering effects are achieved based on the combination of different macros in the multiple macros defined in the shader. Furthermore, a macro defined in a shader can be maintained by a keyword (shader-keywords), which indicates a macro used to render an application screen and the shader to which the macro belongs. A shader variant corresponds to a keyword combination (shader-keywords combination). For example, when developing an application, a technician creates a shader 1 (the shader 1 is identified as shader1) and a shader 2 (the shader 2 is identified as shader2); three macros are defined in shader 1, namely macro 1, macro 2 and macro 3, and the keywords corresponding to the three macros are shader1-k1, shader1-k2 and shader1-k3, respectively; four macros are defined in shader 2, namely macro 1, macro 2, macro 3 and macro 4, and the keywords corresponding to the four macros are shader2-k1, shader2-k2, shader2-k3 and shader2-k4. and shade2-k4. If an application screen 1 in the application needs to be rendered based on macro 1, macro 2 in shader 1 and macro 1 and macro 3 in shader 2, then the keyword combination corresponding to the application screen 1 includes: shader1-k1, shader1-k2, shader2-k1 and shade2-k3. If an application screen 2 in the application needs to be rendered based on macro 1 in shader 1 and macro 2 and macro 3 in shader 2, then the keyword combination corresponding to the application screen 2 includes: shader1-k1, shader2-k2 and shade2-k3. Furthermore, when writing the execution code of the application, by designing a reference to the keyword combination, the graphics processor (GPU) in the electronic device running the application compiles the shader variant corresponding to the keyword combination and renders the application screen based on the compiled shader variant.
[0050] Based on the above information processing solution, the present application embodiment provides an information processing system. Figure 1 , is a structural diagram of an information processing system provided in an embodiment of the present application. Figure 1The information processing system shown may include a program development device 101, a program testing device 102, and a program execution device 103. Among them, the program development device 101 can be a terminal device, for example, it can be any one or more of a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart car, and a smart wearable device, or it can be a server, for example, it can be an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms; the program testing device 102 and the program execution device 103 can be terminal devices, for example, it can be any one or more of a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart car, and a smart wearable device. The program development device 101, the program testing device 102, and the program execution device 103 can be directly or indirectly connected in communication through wired or wireless communication, and this application does not limit it here. Optionally, the related functions implemented by the information processing system can also be executed by the same electronic device, which can be a terminal device such as a smart phone, tablet computer, laptop computer, desktop computer, smart car-mounted device, and smart wearable device.
[0051] In one embodiment, the program development device 101 is used to develop an application program. A program development platform runs in the program development device 101. The program development platform running in the program development device 101 can be a development platform required for developing any type of application program; for example, it can be a game development platform required for developing a game application program, such as a unity engine. A technician can develop an application program through the program development platform running in the program development device 101. Generally speaking, a technician can create a project engineering file of an application program, and then develop the application program in the project engineering file, such as writing code in the project engineering file, such as creating a shader required for rendering an application screen in the application program, such as writing a keyword combination for determining a shader variant required for rendering an application screen in the application program, and so on. The project engineering file includes relevant content for implementing the functions of the application program, such as a shader required for rendering an application screen in the application program and a keyword combination for determining a shader variant required for rendering an application screen in the application program, and so on; wherein the shader is stored in a shader file in the project engineering file, and the keyword combination is stored in a material file in the project engineering file; and the material file includes attribute parameters required for rendering an application screen, and so on. Furthermore, after the development of the application is completed in the project engineering file of the application, the application can be generated based on the relevant content included in the project engineering file. The target application can be any application developed by the technician.
[0052] In one embodiment, the program testing device 102 is used to run a test application, and the test application is used to test the shader variant referenced by the target application, and the shader variant referenced by the test application is consistent with the shader variant referenced by the target application; specifically, the program testing device 102 determines the compiled memory of the shader variant referenced by the test application by running the test application, and then determines the compiled memory of the shader variant referenced by the target application. Optionally, the test application can be an application created based on the shader variant referenced by the target application and having a function different from that implemented by the target application; or it can be an application obtained by adding a test function on the basis of the function implemented by the target application, and the newly added test function is used to obtain the compiled memory of the shader variant referenced by the target application. After the program testing device 102 determines the compiled memory of each shader variant referenced by the target application by running the test application, the compiled memory of each shader variant referenced by the target application can be stored in the target application, so that the graphics processor in the program execution device 103 running the target application can determine the shader variant that needs to be precompiled in the target application from the various shader variants based on the compiled memory of each shader variant, and precompile the shader variant that needs to be precompiled when the target application is running.
[0053] In one embodiment, the program execution device 103 is used to run a target application, which may be any application. The program execution device 103 may compile the shader variant referenced by the target application through a graphics processor in the program execution device 103, and then render the application screen in the target application based on the compiled shader variant, and display it through the program execution device 103. When the program execution device 103 compiles the shader variant referenced by the target application through the graphics processor in the program execution device 103, it usually compiles the shader variant corresponding to the target application screen in real time when the target application screen is triggered to be displayed, and renders the target application screen based on the compiled shader variant, and displays it through the program execution device 103; if the program execution device 103 cannot display all the screen contents in the target application screen at the same time due to reasons such as the display screen size limitation, then when the target application screen is triggered to be displayed, the program execution device 103 compiles the shader variant corresponding to the target screen content in the target application screen to be displayed on the display screen of the program execution device 103 in real time through the graphics processor, renders the target screen content in the target application screen based on the compiled shader variant, and displays it through the display screen in the program execution device 103.
[0054] In one embodiment, a technician can create a project engineering file of a target application based on a program development platform running in the program development device 101, and develop the target application in the project engineering file, such as writing code in the project engineering file, such as creating a shader required for rendering an application screen in the target application, such as writing a keyword combination for determining a shader variant required for rendering an application screen in the target application, and so on; after completing the development of the target application in the project engineering file, the program development device 101 can generate a target application based on the relevant content included in the project engineering file, and generate a test application for testing the shader variant referenced by the target application based on the shader and keyword combination included in the project engineering file. The program testing device 102 can determine and obtain each shader variant referenced by the test application based on the shader and keyword combination of the test application by running the test application, and determine the compiled memory of each shader variant referenced by the test application, and the compiled memory of each shader variant determined by the program testing device 102 running the test application is the compiled memory of the shader variant corresponding to the target application. After the program testing device 102 determines the compiled memory of each shader variant referenced by the target application by running the test application, the compiled memory of each shader variant referenced by the target application can be stored in the target application. The program execution device 103 can determine the shader variants that need to be precompiled in the target application from the various shader variants based on the compiled memory of each shader variant referenced by the target application by running the target application, and precompile the shader variants that need to be precompiled when the target application is running, and when triggering the display of the application screen that needs to be rendered based on the precompiled shader variant, call the precompiled shader variant to render and display the application screen.
[0055] Based on the above information processing solution and information processing system, the present application embodiment provides an information processing method. Figure 2 , which is a flow chart of an information processing method provided in an embodiment of the present application. Figure 2 The information processing method shown can be executed by a program testing device. Figure 2 The information processing method shown may include the following steps:
[0056] S201, obtaining N shader variants referenced by the test application.
[0057] The test application is used to test the N shader variants referenced by the target application, which is an application developed by a technician to implement any function; the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application, and N is a positive integer. The N shader variants are compiled for rendering the application screen, that is, the N shader variants referenced by the test application are compiled when the test application is running to render the application screen in the test application; the N shader variants referenced by the target application are compiled when the target application is running to render the application screen in the target application.
[0058] In one embodiment, the test application is generated based on the shader and keyword combination included in the project engineering file of the target application, so the shader and keyword combination of the test application are consistent with the shader and keyword combination of the target application, and then the shader variant referenced by the test application is consistent with the shader variant referenced by the target application; based on this, the compiled memory of the shader variant referenced by the test application can be determined by determining the compiled memory of the shader variant referenced by the test application. The shader of the target application and the keyword combination of the target application are written by the technician based on the functional requirements of the target application.
[0059] In one embodiment, the test application can be an application that is obtained by adding a test function on the basis of the function implemented by the target application, and the newly added test function is used to obtain the compiled memory of the shader variant referenced by the target application; it can also be an application created based on the shader variant referenced by the target application and having a different function from the target application, that is, it can also be an application created based on the shader and keyword combination included in the project engineering file of the target application and having a different function from the target application; for example, the function implemented by the test application can be: rendering the same test object in an application screen based on all shader variants referenced by the test application to determine the compiled memory of each shader variant referenced by the test application.
[0060] S202, before compiling the nth shader variant among the N shader variants referenced by the test application, obtaining a first running memory occupied by the test application, and after compiling the nth shader variant, obtaining a second running memory occupied by the test application.
[0061] In one embodiment, the program test device calls the graphics processor in the program test device to compile the shader variants referenced by the test application. Therefore, before the program test device calls the GPU to compile the nth shader variant among the N shader variants referenced by the test application, the first running memory occupied by the test application obtained is the running memory currently occupied by the test application in the GPU of the program test device; after compiling the nth shader variant, the second running memory occupied by the test application obtained is the running memory currently occupied by the test application in the GPU of the program test device, where n is a positive integer less than or equal to N. Since the compiled shader variant generated by compiling the shader variant will be stored in the GPU of the program test device and occupy the available running memory of the GPU, the available running memory occupied by the compiled shader variant will not be released until the test application is closed. Therefore, the second running memory occupied by the test application obtained by the program test device includes the available running memory of the GPU occupied when the compiled shader variant is stored in the GPU of the program test device.
[0062] In a specific implementation, the program testing device obtains the first running memory occupied by the test application, which may include: calling a memory acquisition function to obtain the first running memory occupied by the test application; calling a memory call interface to reflectively obtain the first running memory obtained by the memory acquisition function. Among them, the memory acquisition function is a function provided by the system corresponding to the test application for obtaining the memory distribution of the process of any application. For example, if the system corresponding to the test application is the Android system, that is, the test application is a program created based on the Android system, that is, the target application is a program developed based on the Android system, then the memory acquisition function is the memory query command (that is, the adb shell dumpsysmeminfo command) provided in the Android Native Development Kit (Android NDK). The program testing device can query the memory distribution of the process when the test application is running based on the memory query command. The memory distribution of the process when the test application is running queried based on the memory query command includes the first running memory occupied by the test application when the memory query command is executed, that is, the memory of the GPU of the program testing device occupied by the test application. Figure 3As shown, it is a schematic diagram of the memory distribution of a process of a certain application program obtained based on a memory query command provided by an embodiment of the present application, wherein the parameter part as marked 301, that is, the parameter part indicated by Gfx dev is: when the memory query command is executed, the first running memory occupied by the certain application program, that is, the GPU memory occupied by the certain application program; wherein the parameter Pss Total represents the physical memory actually used.
[0063] In one embodiment, the memory query command provided in the Android native development toolkit can store the memory distribution information of the process when the test application is running in the memory information class (MemoryInfo class) after obtaining the memory distribution of the process when the test application is running; that is, the first running memory occupied by the test application can be stored in the memory information class. The program testing device calls the memory acquisition function to obtain the first running memory occupied by the test application; when calling the memory call interface to reflectively obtain the first running memory obtained by the memory acquisition function, the first running memory occupied by the test application can be obtained based on the memory query command, and the first running memory can be stored in the memory information class; the program testing device can call the memory call interface to reflectively obtain the first running memory stored in the memory information class; in a specific implementation, when the program testing device calls the memory call interface to reflectively obtain the first running memory stored in the memory information class, it can be obtained by reflecting by calling the reflection function; such as Figure 4a As shown in FIG. 1 , a schematic diagram of obtaining the first running memory occupied by the test application provided in an embodiment of the present application is provided. For example, if the test application is written in C# language, and the shader of the test application is written in C++ language, such as Figure 4b As shown, it is a schematic diagram of another method for obtaining the first running memory occupied by the test application provided in an embodiment of the present application, wherein the program test device runs the test application, calls the memory calling interface to obtain the first running memory obtained by the first reflection function, and the memory calling interface is written based on the C# language, and the first reflection function is written based on the C++ language; wherein, the first running memory obtained by the first reflection function is obtained by reflecting the first running memory obtained by the second reflection function, and the second reflection function is written based on the Java language; the second reflection function is to call the memory output interface provided by the memory information class through reflection, and obtain the first running memory stored in the memory information class from the memory information class; wherein, the memory output interface provided by the memory information class can be a getOtherPrivate interface, such as Figure 5As shown, it is a schematic diagram of an embodiment of the present application to implement a second reflection function reflection call provided by the memory output interface of the memory information class to obtain the execution code of the first running memory. Among them, the process of obtaining the second running memory occupied by the test application after the program test device compiles the nth shader variant is similar to the process of obtaining the first running memory occupied by the test application before compiling the nth shader variant among the N shader variants referenced by the test application, and will not be repeated here.
[0064] S203: Determine the compilation memory of the nth shader variant based on the first running memory and the second running memory.
[0065] The compiled memory of the nth shader variant indicates the running memory required when compiling the nth shader variant, and the compiled memory of the nth shader variant is used to determine whether the nth shader variant needs to be precompiled when the target application runs.
[0066] In a specific implementation, the program testing device determines the compilation memory of the nth shader variant based on the first running memory and the second running memory, which may include: determining the difference between the second running memory and the first running memory as the compilation memory of the nth shader variant.
[0067] In one embodiment, if the test application is obtained by adding a test function based on the function implemented by the target application, the newly added test function is used to obtain the compiled memory of the shader variant referenced by the target application; then when the program testing device determines the compiled memory of the shader variant referenced by the target application based on the test application, it can determine the compiled memory of the shader variant required for rendering each application screen of the target application, that is, it can determine the compiled memory of the shader variant corresponding to each application screen of the target application.
[0068] In an embodiment of the present application, the running memory required for compiling each shader variant referenced by the target application can be determined based on the processing of the test application, that is, the compiling memory of each shader variant referenced by the target application can be determined based on the processing of the test application; wherein the test application is used to test the N shader variants referenced by the target application, and the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application, and N is a positive integer. In a specific implementation, before compiling the nth shader variant among the N shader variants referenced by the test application, the first running memory occupied by the test application can be obtained, and after compiling the nth shader variant, the second running memory occupied by the test application can be obtained, and n is a positive integer less than or equal to N; based on the first running memory and the second running memory, the compiling memory of the nth shader variant is determined. Based on the processing of the test application, the compiled memory of each shader variant referenced by the target application can be determined, and then the shader variant that needs to be precompiled can be determined from the various shader variants based on the compiled memory of each shader variant, thereby solving the compilation jam problem that may be caused by real-time compilation of shader variants and avoiding the program crash problem that may be caused by precompilation, thereby improving the user experience.
[0069] Based on the above information processing system and information processing method embodiments, the present application embodiment provides another information processing method. Figure 6 , which is a flow chart of another information processing method provided in an embodiment of the present application. Figure 6 The information processing method shown can be executed by a program execution device. Figure 6 The information processing method shown may include the following steps:
[0070] S601, obtaining N compiled memories of N shader variants referenced by a target application.
[0071] Each of the N shader variants has a compiled memory, and the N shader variants are compiled when the target application is running to render the application screen in the target application. The compiled memory of each shader variant is obtained by testing in a test application that references the N shader variants, and N is a positive integer.
[0072] In one embodiment, the compiled memory of each shader variant of the target application is obtained by testing in a test application that references N shader variants, specifically, by running the test application that references N shader variants of the target application through a program test device. After the program test device determines the compiled memory of each shader variant referenced by the target application by running the test application, the compiled memory of each shader variant referenced by the target application can be stored in the target application; optionally, the compiled memory of each shader variant referenced by the target application can be stored in a server corresponding to the target application, then the program execution device can obtain the N compiled memories of the N shader variants referenced by the target application from the server corresponding to the target application; optionally, the compiled memory of each shader variant referenced by the target application can be compiled into the installation package of the target application, then when the target application is installed in the program execution device, the compiled memory of each shader variant referenced by the target application included in the installation package will be stored in the memory of the program execution device, and further, the program execution device can obtain the N compiled memories of the N shader variants referenced by the target application from the memory of the program execution device.
[0073] S602 : Determine a target shader variant from the N shader variants based on the N compile memories of the N shader variants and the available running memory of the graphics processor.
[0074] In a specific implementation, the program execution device determines the target shader variant from the N shader variants based on the N compilation memories of the N shader variants and the available running memory of the graphics processor, which may include: obtaining a pre-compilation rule, the pre-compilation rule indicating the compilation memory threshold of the pre-compiled single shader variant; determining the shader variant with a compilation memory greater than the compilation memory threshold among the N shader variants as a candidate shader variant; and determining the target shader variant from the candidate shader variants based on the available running memory of the graphics processor, wherein the total compilation memory of the target shader variant is less than the available running memory of the graphics processor. Among them, the shader variant with a compilation memory greater than the compilation memory threshold among the N shader variants referenced by the target application is determined as a candidate shader variant, and the target shader variant is determined based on the candidate shader variant because the shader variant with a larger compilation memory consumes a longer time to be compiled, so the shader variant with a larger compilation memory is pre-compiled, and the shader variant with a smaller compilation memory is compiled in real time, which can shorten the rendering time of the application screen in the target application, avoid the compilation jam problem, and improve the response speed when the application screen display is triggered, thereby improving the user experience.
[0075] If a large number of shader variants are precompiled, the precompiled shader variants will occupy the available running memory of the graphics processor in the program execution device, resulting in the available memory of the graphics processor being too small or even full. Then, when the graphics processor needs to be called for real-time compilation of the shader variants, the available memory of the graphics processor is too small or even full, and the shader variants that need to be compiled in real time cannot be compiled, resulting in a program crash. Based on this, when the program execution device determines the target shader variant from the candidate shader variants based on the available running memory of the graphics processor, it is necessary to ensure that the total compilation memory of the target shader variant is less than the available running memory of the graphics processor, and it is necessary to ensure that the total compilation memory of the target shader variant is less than or equal to the available precompiled memory of the graphics processor, which is the remaining running memory except for the real-time compilation memory reserved in the available running memory of the graphics processor for real-time compilation of the shader variants. The memory capacity of the real-time compilation memory can be set according to different requirements. For example, 60% of the memory capacity of the available running memory of the graphics processor can be reserved to ensure the real-time compilation of the shader variant. In this case, the total compilation memory of the target shader variant is required to be less than or equal to 40% of the memory capacity of the available running memory of the graphics processor.
[0076] In one embodiment, the target application usually includes multiple application screens, that is, the N shader variants referenced by the target application are used to render multiple application screens in the target application, and one application screen corresponds to one or more shader variants, that is, one application screen is rendered based on one or more shader variants; then, the program execution device determines the target shader variant from the N shader variants based on the N compiled memories of the N shader variants and the available running memory of the graphics processor, which may include: determining the target shader variant corresponding to each application screen from the one or more shader variants corresponding to each application screen. In a specific implementation, the program execution device may obtain a pre-compilation rule, which indicates the compiled memory threshold of a single pre-compiled shader variant; determine the shader variant with a compiled memory greater than the compiled memory threshold among the one or more shader variants corresponding to each application screen as the candidate shader variant corresponding to each application screen; determine the target shader variant corresponding to each application screen from the candidate shader variants corresponding to each application screen based on the available running memory of the graphics processor, and the total compiled memory of the target shader variant is less than the available running memory of the graphics processor. Furthermore, the program execution device may determine the target shader variant corresponding to each application screen from one or more shader variants corresponding to each application screen according to the priority of each application screen in the target application, and the total amount of compiled memory of the target shader variant is less than the available running memory of the graphics processor. In a specific implementation, the available pre-compiled memory corresponding to each application screen may be allocated according to the priority of each application screen in the target application, wherein the available pre-compiled memory corresponding to the application screen with a high priority is greater than the available pre-compiled memory corresponding to the application screen with a low priority; based on the available pre-compiled memory corresponding to each application screen, the target shader variant corresponding to each application screen is determined from the candidate shader variants corresponding to each application screen, and the total amount of compiled memory of the target shader variant corresponding to each application screen is less than the available pre-compiled memory corresponding to each application screen.
[0077] S603, when the target application is running, load the target shader variant and precompile the target shader variant.
[0078] In one embodiment, the program execution device can determine the target shader variants corresponding to all application screens in the target application when the target application is started, and load all target shader variants and precompile all target shader variants when the target application is started; it can also precompile the target shader variant corresponding to the target application screen when receiving an operation instruction to switch to the target application screen in the target application, and compile the shader variant corresponding to the target screen content in the target application screen to be displayed on the display screen of the program execution device in real time; that is, when the target application screen is larger than the application screen that can be displayed on the display screen of the program execution device, the program execution device can precompile all target shader variants corresponding to the target application screen when receiving an operation instruction to switch to the target application screen, and compile the shader variant corresponding to the target screen content in the target application screen to be displayed on the display screen of the program execution device in real time; when the program execution device receives an operation instruction to slide and display other screen contents in the target application screen except the target screen content, the program execution device will compile the shader variants corresponding to the other screen contents in the target application screen to be displayed on the display screen of the program execution device in real time. For example, if the target application is a game application, a screen formed when all displayable screen contents in a game scene of the game application are displayed simultaneously is used as an application screen of the game application; because a game scene is usually very large and includes a lot of displayable screen contents, a general program execution device cannot simultaneously display all displayable screen contents in the game scene on the display screen. Then, when the program execution device receives an operation instruction to switch to the target application screen corresponding to the target game scene, it can pre-compile all target shader variants corresponding to the target game scene, and compile in real time the shader variants corresponding to the target screen content in the target game scene to be displayed on the display screen of the program execution device; when the program execution device receives an operation instruction to slide and display other screen contents in the target game scene except the target screen content, the program execution device will compile in real time the shader variants corresponding to the other screen contents in the target game scene to be displayed on the display screen of the program execution device.
[0079] In an embodiment of the present application, after obtaining N compiled memories of N shader variants referenced by the target application; based on the N compiled memories of the N shader variants and the available running memory of the graphics processor, determine the target shader variant from the N shader variants; when the target application is running, load the target shader variant and precompile the target shader variant. The target shader variant that needs to be precompiled can be determined based on the compiled memory, and the target shader variant can be precompiled, that is, some of the shader variants in the shader variants used for real-time compilation are compiled, which can shorten the rendering time of the application screen in the target application, avoid the compilation jam caused by real-time compilation of too many shader variants, and improve the response speed when triggering the application screen display, thereby improving the user experience.
[0080] Based on the above information processing system and information processing method embodiments, the present application embodiment provides another information processing method. Figure 7 , which is a flow chart of another information processing method provided in an embodiment of the present application. Figure 7 The information processing method shown can be executed by a program testing device. Figure 7 The information processing method shown may include the following steps:
[0081] S701, obtaining N shader variants referenced by the test application.
[0082] Among them, the test application is used to test N shader variants referenced by the target application, and the target application is an application developed by technicians to implement arbitrary functions; the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application, and N is a positive integer.
[0083] S702, before compiling the nth shader variant among the N shader variants referenced by the test application, obtaining the first running memory occupied by the test application, and after compiling the nth shader variant, obtaining the second running memory occupied by the test application.
[0084] S703: Determine the compilation memory of the nth shader variant based on the first running memory and the second running memory.
[0085] Among them, steps S701 to S703 are consistent with the above-mentioned steps S201 to S203 and are not repeated here.
[0086] S704 , based on the N compiled memories of the N shader variants, determine a target shader variant corresponding to a graphics processor with different available execution memories from the N shader variants.
[0087] Among them, each shader variant in the N shader variants has a compilation memory, and the target shader variant is the shader variant that needs to be precompiled. In a specific implementation, the program test device determines the target shader variant corresponding to the graphics processors with different available running memories from the N shader variants based on the N compilation memories of the N shader variants, which may include: obtaining a precompilation rule, the precompilation rule indicates the compilation memory threshold of the precompiled single shader variant; determining the shader variant with a compilation memory greater than the compilation memory threshold among the N shader variants as a candidate shader variant; determining the target shader variant corresponding to the graphics processors with different available running memories from the candidate shader variants, and the total amount of compilation memory of the target shader variant corresponding to any graphics processor with available running memory is less than any available running memory. Furthermore, different available running memories and target shader variant collections (Shader Variant Collection, SVC) corresponding to each available running memory can be stored in the target application (a target shader variant collection corresponding to an available running memory may include a keyword combination of multiple target shader variants), so that the program execution device running the target application can determine the target shader variant corresponding to the available running memory of the graphics processor in the program execution device based on the available running memory of the graphics processor in the program execution device, and then load the target shader variant and precompile the target shader variant. Among them, when the program testing device determines the target shader variant corresponding to the graphics processor with different available running memories from the candidate shader variants, it is similar to the process of the program execution device determining the target shader variant from the candidate shader variants based on the available running memory of the graphics processor in the above step S602, and will not be repeated here.
[0088] In one embodiment, the target application mentioned in the relevant embodiments of the present application can be created based on the optimization of the performance evaluation results, wherein the performance evaluation results are obtained during the creation process of the target application based on the evaluation of the relevant performance of the N shader variants referenced by the target application. Wherein, the creation process of the target application refers to: from creating a project engineering file of the target application, and developing the application in the project engineering file, to the entire process of generating the application based on the relevant content included in the project engineering file after the development of the application is completed in the project engineering file of the target application. That is to say, during the creation process of the target application, after the development of the target application is completed in the project engineering file of the target application, the relevant performance of the N shader variants included in the project engineering file can be evaluated to obtain the performance evaluation results, at which time the shader variants included in the project engineering file are the shader variants referenced by the target application; and the target application is optimized based on the performance evaluation results. Furthermore, after the project engineering file of the target application is created, the relevant performance of the shader variants included in the project engineering file of the target application can be evaluated at any time during the creation process of the target application, and the performance evaluation result of the shader variants in the project engineering file of the target application at any time can be obtained, and the shader variants included in the project engineering file of the target application can be optimized based on the performance evaluation result. That is to say, when developing the target application, the performance test of the shader variants included in the project engineering file of the target application can be performed at any time during the development to obtain the performance evaluation result, and then the optimization can be carried out in time based on the performance evaluation result, which can shorten the development time of the target application.
[0089] Since the relevant performance of the shader variants included in the project engineering file of the target application is evaluated, the evaluation process is implemented based on the program development device before creating the test application. In the specific implementation, after receiving the operation instruction to evaluate the performance of the shader variants included in the project engineering file of the target application, the program development device can obtain all the keyword combinations included in the project engineering file; based on all the keyword combinations included in the project engineering file, the shader variants corresponding to each keyword combination are compiled in turn to obtain the compiled code corresponding to each shader variant; the performance evaluation tool is called to perform performance evaluation on the compiled code corresponding to each shader variant to obtain the performance evaluation result corresponding to each shader variant.
[0090] In one embodiment, when the program development device obtains all keyword combinations included in the project engineering file, since the keyword combination used to determine the shader variant required to render the application screen in the target application is stored in the material file in the project engineering file of the target application, the program development device can obtain all keyword combinations included in the project engineering file by traversing the material files in the project engineering file of the target application.
[0091] Furthermore, the program development device compiles the shader variants corresponding to each keyword combination in turn based on all the keyword combinations included in the project engineering file, and the compiled code corresponding to each shader variant obtained is the code of the target shader language, and the target shader language is predetermined by the technician. That is to say, when the project engineering file of the target application is created in the program development platform of the program development device to develop the target application, it is developed based on the specified language of the program development platform. When the program development platform compiles the shader variant, the code developed in the specified language can be compiled into the shader language code, so that the shader interface can be called to render the application screen; wherein the shader language corresponds to the shader interface, for example, the shader interface can include GLES and Vulkan.
[0092] In one embodiment, the program development device compiles the shader variants corresponding to each keyword combination in turn based on all keyword combinations included in the project engineering file to obtain the compiled code corresponding to each shader variant. The reason why the program development device does not compile the shader variants corresponding to all keyword combinations included in the project engineering file at the same time is that the project engineering file may include a large number of keyword combinations, such as Figure 8 The information shown in the 801 mark indicates that the number of shader variants corresponding to all keyword combinations included in a project engineering file is 219117. Since compiling the shader variant corresponding to each keyword combination will obtain a target shader language code, when the shader variants corresponding to all keyword combinations included in the project engineering file are compiled at the same time, the program development platform may be stuck or even crash. Therefore, the program development device can improve the compilation efficiency by compiling the shader variant corresponding to each keyword combination in turn based on all keyword combinations included in the project engineering file.
[0093] In a specific implementation, the program development device can call the shader compilation function to compile the shader variant corresponding to each keyword combination; then, the program development device will first convert each keyword combination in all the keyword combinations included in the project engineering file into a shader keyword set (i.e., ShaderKeywordSet) corresponding to each keyword combination, wherein a shader keyword set corresponding to a keyword combination can indicate the code path of the macro corresponding to each keyword in the keyword combination. The ShaderKeywordSet corresponding to each keyword combination is passed into the shader compilation function as an input parameter of the shader compilation function, and the ShaderKeywordSet passed into the shader compilation function is arranged in order according to the time of passing in; then, the ShaderKeywordSet passed into the shader compilation function can be compiled in sequence by running the shader variant function. Fig. 9 As shown, it is a schematic diagram of the compiled code corresponding to a shader variant provided in an embodiment of the present application, wherein, as shown by the 901 mark, it indicates that the target shader language is gles3, as shown by the 902 mark, it indicates the type of the shader, and as shown by the 903 mark, it indicates the keywords in all keyword combinations included in the project engineering file.
[0094] Furthermore, after the program development device obtains the compiled code corresponding to each shader variant, it will cache the compiled code corresponding to each shader variant. Specifically, it can be cached in the Compiled-xxx.shader file in the Temp folder, which contains the compiled code of the shader variants corresponding to all keyword combinations. If the compiled code is surrounded by "Keywords set in this variant:Key1 Key2 Key3", it means that the compiled code is compiled based on the shader variant corresponding to the keyword combination composed of the combination of keywords Key1, Key2 and Key3. In a specific implementation, the program development device calls the performance evaluation tool to perform performance evaluation on the compiled code corresponding to each shader variant. When the performance evaluation result corresponding to each shader variant is obtained, the compiled code corresponding to all shader variants can be cut according to the keywords to obtain the compiled code corresponding to each keyword, wherein the compiled code corresponding to one keyword refers to the compiled code of the shader variant that only includes the one keyword in the keyword combination; the performance evaluation tool is called to perform performance evaluation on the compiled code corresponding to each keyword to obtain the performance evaluation result of the shader variant corresponding to each keyword; based on the evaluation result of the shader variant corresponding to each keyword and the keyword combination, the evaluation result of the shader variant corresponding to each keyword combination is obtained, and the evaluation result of the shader variant corresponding to each keyword combination obtained based on the keyword combination is the evaluation result of the shader variant corresponding to the keyword combination included in the project engineering file. Further, a performance evaluation report including the evaluation result of the shader variant corresponding to each keyword combination can be generated, wherein the evaluation result of the shader variant corresponding to one keyword combination is composed of the evaluation results of the shaders corresponding to all the keywords included in the one keyword combination.
[0095] In one embodiment, the performance evaluation tool can be Arm's official Mali-Offline-Compiler tool. Since the performance evaluation tool can only analyze shader functions, the program development device calls the performance evaluation tool to perform performance evaluation on the compiled code corresponding to each keyword. When obtaining the performance evaluation results of the shader variants corresponding to each keyword, it is necessary to first cut the compiled code corresponding to each shader into shader function codes such as vertex shaders, fragment shaders, geometry shaders, tessellation shaders, and tessellation control shaders, and then call the performance evaluation tool to evaluate the code of each shader function to obtain the performance evaluation results of each shader function, and then obtain the performance evaluation results of the shader variants corresponding to each keyword. In one embodiment, if the target shader language is GLES3.0, since the code of the fragment shader obtained by cutting does not set the default precision of data with data types of floating point type (float) and integer type (int), the performance evaluation tool may fail in the code evaluation of the fragment shader. Therefore, it is necessary to set the default precision of data with data types of floating point type and integer type in the code of the fragment shader obtained by cutting. For example, the default precision definition of floating point type data can be added after the statement #version, which can be precision highp float; and the default precision definition of integer data can be added, which can be precision highpint.
[0096] like Fig.10As shown, it is a schematic diagram of the performance evaluation result of a shader function provided in an embodiment of the present application, wherein the performance evaluation result indicates the number of working registers (Work registers) occupied by the shader function, for example, 32, as well as performance evaluation parameters such as total instruction cycles (Total instruction cycles), shortest path cycles (Shortest path cycles) and longest path cycles (Longest path cycles). For example, it can indicate that the total instruction cycle of the arithmetic fused multiply accumulate unit (FMA) is 3.74, the shortest path cycle is 3.74, and the longest path cycle is 3.74; the total instruction cycle of the arithmetic conversion unit (CVT) is 0.8, the shortest path cycle is 0.77, and the longest path cycle is 0.8; the total instruction cycle of the arithmetic special functions unit (SFU) is 1.31, the shortest path cycle is 1.31, and the longest path cycle is 1.31; the total instruction cycle, the shortest path cycle, and the longest path cycle of the load / store unit (LS) are all 0; the total instruction cycle of the varying unit (V) is 2.5, the shortest path cycle is 2.5, and the longest path cycle is 2.5; the total instruction cycle of the texture unit (T) is 1.5, the shortest path cycle is 1.5, and the longest path cycle is 1.5. Fig.11 As shown, it is a schematic diagram of a performance evaluation report provided by an embodiment of the present application, and the performance evaluation report is composed of the evaluation results of the shader variants corresponding to each keyword combination, wherein the evaluation result of the shader variant corresponding to a keyword combination is composed of the evaluation results of the shaders corresponding to all the keywords included in the keyword combination; for example, the content shown by the 1001 mark indicates that in the evaluation result of the shader variant corresponding to the keyword, the total instruction cycle of the arithmetic fusion multiply accumulation unit is 4.82; the total instruction cycle of the arithmetic conversion unit is 1.27; the total instruction cycle of the arithmetic special function unit is 1.88; the total instruction cycle of the load / store unit is 13; the total instruction cycle of the variable unit is 0; the total instruction cycle of the texture unit is 1; the evaluation result of the shader corresponding to the keyword is based on the evaluation results of the functions with function identifiers 356 and 357.
[0097] In an embodiment of the present application, after determining the N compiled memories of the N shader variants referenced by the target application, the program testing device can determine, based on the N compiled memories of the N shader variants, from the N shader variants the target shader variants that need to be precompiled corresponding to the graphics processors with different available running memories, wherein each of the N shader variants has a compiled memory; when running the target application, the program execution device can obtain the available running memory of the graphics processor in the program execution device, and based on the target shader variants corresponding to the graphics processors with different available running memories determined by the program testing device, determine the target shader variant corresponding to the graphics processor in the program execution device, and precompile the target shader variant; the rendering time of the application screen in the target application can be shortened, the compilation jamming problem caused by real-time compilation of too many shader variants can be avoided, the response speed when triggering the application screen display can be improved, and the user experience can be improved.
[0098] Based on the above method embodiment, the present application embodiment provides a program testing device. Fig.12 , is a structural diagram of a program testing device provided in an embodiment of the present application, and the program testing device may include an acquisition unit 1201 and a processing unit 1202. Fig.12 The program test device shown can run the following units:
[0099] The acquisition unit 1201 is used to acquire N shader variants referenced by the test application; wherein the test application is used to test the N shader variants referenced by the target application, and the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application; the N shader variants are compiled for rendering an application screen, and N is a positive integer;
[0100] The processing unit 1202 is used to obtain a first running memory occupied by the test application before compiling an nth shader variant among N shader variants referenced by the test application, and obtain a second running memory occupied by the test application after compiling the nth shader variant, where n is a positive integer less than or equal to N;
[0101] The processing unit 1202 is also used to determine the compilation memory of the nth shader variant based on the first running memory and the second running memory, the compilation memory of the nth shader variant indicates the running memory required when compiling the nth shader variant, and the compilation memory of the nth shader variant is used to determine whether the nth shader variant needs to be precompiled when the target application is running.
[0102] In one embodiment, when the processing unit 1202 obtains the first running memory occupied by the test application, it specifically performs the following operations:
[0103] Calling a memory acquisition function to acquire a first running memory occupied by the test application;
[0104] A memory calling interface is called to reflectively obtain the first running memory obtained by the memory obtaining function.
[0105] In one embodiment, when the processing unit 1202 determines the compilation memory of the nth shader variant based on the first running memory and the second running memory, the processing unit 1202 specifically performs the following operations:
[0106] A difference between the second running memory and the first running memory is determined as the compilation memory of the nth shader variant.
[0107] In one embodiment, the target application is created based on optimization of performance evaluation results, and the performance evaluation results are obtained during the creation of the target application based on evaluating the relevant performance of N shader variants referenced by the target application.
[0108] According to one embodiment of the present application, Figure 2 as well as Figure 7 The steps involved in the information processing method shown can be Fig.12 The program shown is executed by each unit in the test device. For example, Figure 2 Step S201 shown can be performed by Fig.12 The program test device shown in the figure is executed by the acquisition unit 1201, Figure 2 Steps S302 to S303 shown in FIG. Fig.12 The program test device shown is executed by the processing unit 1202. Figure 7 Step S701 shown can be performed by Fig.12 The program test device shown in the figure is executed by the acquisition unit 1201, Figure 7 Steps S702 to S704 shown in FIG. Fig.12 The program shown is executed by the processing unit 1202 in the testing device.
[0109] According to another embodiment of the present application, Fig.12Each unit in the program test device shown can be respectively or all merged into one or several other units to constitute, or some (some) units therein can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effect of the embodiment of the application. The above-mentioned units are based on logical function division, and in practical applications, the function of a unit can also be realized by multiple units, or the function of multiple units is realized by one unit. In other embodiments of the application, the program test device based on logical function division can also include other units, and in practical applications, these functions can also be assisted by other units to realize, and can be realized by the collaboration of multiple units.
[0110] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 as well as Figure 7 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Fig.12 The program testing device shown in and the information processing method of the embodiment of the present application are implemented. The computer program can be recorded on, for example, a computer-readable storage medium, and loaded into the above-mentioned computing device through the computer-readable storage medium, and run therein.
[0111] In an embodiment of the present application, the running memory required for compiling each shader variant referenced by the target application can be determined based on the processing of the test application, that is, the compiling memory of each shader variant referenced by the target application can be determined based on the processing of the test application; wherein the test application is used to test the N shader variants referenced by the target application, and the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application, and N is a positive integer. In a specific implementation, the processing unit 1202 can obtain the first running memory occupied by the test application before compiling the nth shader variant among the N shader variants referenced by the test application, and obtain the second running memory occupied by the test application after compiling the nth shader variant, where n is a positive integer less than or equal to N; based on the first running memory and the second running memory, the compiling memory of the nth shader variant is determined. Based on the processing of the test application, the compiled memory of each shader variant referenced by the target application can be determined, and then the shader variant that needs to be precompiled can be determined from the various shader variants based on the compiled memory of each shader variant, thereby solving the compilation jam problem that may be caused by real-time compilation of shader variants and avoiding the program crash problem that may be caused by precompilation, thereby improving the user experience.
[0112] Based on the above method embodiment, the present application embodiment provides a program execution device. Fig.13 , is a structural diagram of a program execution device provided in an embodiment of the present application, and the program execution device may include an acquisition unit 1301 and a processing unit 1302. Fig.13 The program execution device shown can run the following units:
[0113] The acquisition unit 1301 is used to acquire N compiled memories of N shader variants referenced by the target application; each of the N shader variants has a compiled memory, the N shader variants are compiled when the target application is running to render an application screen in the target application, and the compiled memory of each shader variant is obtained by testing in a test application that references the N shader variants, and N is a positive integer;
[0114] The processing unit 1302 is configured to determine a target shader variant from the N shader variants based on the N compile memories of the N shader variants and the available run memory of the graphics processor;
[0115] The processing unit 1302 is further configured to load the target shader variant and precompile the target shader variant when the target application is running.
[0116] In one embodiment, when the processing unit 1302 determines the target shader variant from the N shader variants based on the N compiled memories of the N shader variants and the available running memory of the graphics processor, the processing unit 1302 may specifically perform the following operations:
[0117] Obtain a pre-compilation rule, wherein the pre-compilation rule indicates a compilation memory threshold of a single shader variant to be pre-compiled;
[0118] Determine, among the N shader variants, a shader variant whose compiled memory is greater than the compiled memory threshold as a candidate shader variant;
[0119] The target shader variant is determined from the candidate shader variants based on the available running memory of the graphics processor, and the total amount of compiled memory of the target shader variant is less than the available running memory of the graphics processor.
[0120] In one embodiment, the N shader variants are used to render multiple application screens in the target application, and one application screen corresponds to one or more shader variants;
[0121] When the processing unit 1302 determines the target shader variant from the N shader variants based on the N compiled memories of the N shader variants and the available running memory of the graphics processor, the processing unit 1302 may specifically perform the following operations:
[0122] According to the priority of each application screen among the multiple application screens, a target shader variant corresponding to each application screen is determined from one or more shader variants corresponding to each application screen, and the total amount of compiled memory of the target shader variant is less than the available running memory of the graphics processor.
[0123] According to one embodiment of the present application, Figure 6 The steps involved in the information processing method shown can be Fig.13 The program execution device shown in FIG. 1 is executed by each unit in the program execution device. For example, Figure 6 Step S601 shown can be performed by Fig.13 The program execution device shown in the figure is used to execute the acquisition unit 1301, Figure 6 Steps S602 to S603 shown in FIG. Fig.13 The program is executed by the processing unit 1302 in the program execution device shown.
[0124] According to another embodiment of the present application, Fig.13 The various units in the program execution device shown can be respectively or all merged into one or several other units to constitute, or some of the units (some) can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of a unit can also be realized by multiple units, or the function of multiple units can be realized by one unit. In other embodiments of the present application, the program execution device based on the logical function division can also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0125] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 6 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Fig.13 The program execution device shown in and the information processing method of the embodiment of the present application are implemented. The computer program can be recorded on, for example, a computer-readable storage medium, and loaded into the above-mentioned computing device through the computer-readable storage medium, and run therein.
[0126] In the embodiment of the present application, the processing unit 1302 can obtain the N compiled memories of the N shader variants referenced by the target application after the acquisition unit 1301 obtains them; based on the N compiled memories of the N shader variants and the available running memory of the graphics processor, determine the target shader variant from the N shader variants; when the target application is running, load the target shader variant and precompile the target shader variant. The target shader variant that needs to be precompiled can be determined based on the compiled memory, and the target shader variant can be precompiled, that is, some of the shader variants in the shader variants used for real-time compilation are compiled, which can shorten the rendering time of the application screen in the target application, avoid the compilation jam caused by real-time compilation of too many shader variants, and improve the response speed when the application screen display is triggered, thereby improving the user experience.
[0127] Based on the above method embodiment and device embodiment, the present application also provides a program testing device. Fig.14 , is a structural diagram of a program testing device provided in an embodiment of the present application. Fig.14 The program testing device shown may include at least a processor 1401, an input interface 1402, an output interface 1403, and a computer storage medium 1404. The processor 1401, the input interface 1402, the output interface 1403, and the computer storage medium 1404 may be connected via a bus or other means.
[0128] The computer storage medium 1404 can be stored in the memory of the program testing device. The computer storage medium 1404 is used to store a computer program. The computer program includes program instructions. The processor 1401 is used to execute the program instructions stored in the computer storage medium 1404. The processor 1401 (or CPU (Central Processing Unit)) is the computing core and control core of the program testing device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the above-mentioned information processing method flow or corresponding functions.
[0129] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in a program testing device for storing programs and data. It is understandable that the computer storage medium here can include both the built-in storage medium in the terminal and the extended storage medium supported by the terminal. The computer storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor 1401 are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed random access memory (RAM) memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.
[0130] In one embodiment, the processor 1401 and the input interface 1402 may load and execute one or more instructions stored in the computer storage medium to implement the above-mentioned Figure 2 as well as Figure 7 In the corresponding steps of the method in the information processing method embodiment, in a specific implementation, one or more instructions in the computer storage medium are loaded by the processor 1401 and the input interface 1402 and execute the following steps:
[0131] An input interface 1402 is used to obtain N shader variants referenced by a test application; wherein the test application is used to test the N shader variants referenced by a target application, and the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application; the N shader variants are compiled for rendering an application screen, and N is a positive integer;
[0132] Processor 1401 is used for obtaining a first running memory occupied by the test application before compiling an nth shader variant among N shader variants referenced by the test application, and obtaining a second running memory occupied by the test application after compiling the nth shader variant, where n is a positive integer less than or equal to N;
[0133] The processor 1401 is also used to determine the compilation memory of the nth shader variant based on the first running memory and the second running memory, the compilation memory of the nth shader variant indicates the running memory required when compiling the nth shader variant, and the compilation memory of the nth shader variant is used to determine whether the nth shader variant needs to be pre-compiled when the target application is running.
[0134] In one embodiment, when the processor 1401 obtains the first running memory occupied by the test application, the processor 1401 may specifically perform the following operations:
[0135] Calling a memory acquisition function to acquire a first running memory occupied by the test application;
[0136] A memory calling interface is called to reflectively obtain the first running memory obtained by the memory obtaining function.
[0137] In one embodiment, when the processor 1401 determines the compilation memory of the nth shader variant based on the first running memory and the second running memory, the processor 1401 may specifically perform the following operations:
[0138] A difference between the second running memory and the first running memory is determined as the compilation memory of the nth shader variant.
[0139] In one embodiment, the target application is created based on optimization of performance evaluation results, and the performance evaluation results are obtained during the creation of the target application based on evaluating the relevant performance of N shader variants referenced by the target application.
[0140] Based on the above method embodiment and apparatus embodiment, the present application also provides a program execution device. Fig.15 , is a structural diagram of a program execution device provided in an embodiment of the present application. Fig.15 The program execution device shown may include at least a processor 1501, an input interface 1502, an output interface 1503, and a computer storage medium 1504. The processor 1501, the input interface 1502, the output interface 1503, and the computer storage medium 1504 may be connected via a bus or other means.
[0141] The computer storage medium 1504 may be stored in the memory of the program execution device. The computer storage medium 1504 is used to store a computer program. The computer program includes program instructions. The processor 1501 is used to execute the program instructions stored in the computer storage medium 1504. The processor 1501 (or CPU (Central Processing Unit)) is the computing core and control core of the program execution device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the above-mentioned information processing method flow or corresponding functions.
[0142] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in a program execution device for storing programs and data. It is understandable that the computer storage medium here can include both the built-in storage medium in the terminal and the extended storage medium supported by the terminal. The computer storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor 1501 are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed random access memory (RAM) memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.
[0143] In one embodiment, the processor 1501 and the input interface 1502 may load and execute one or more instructions stored in the computer storage medium to implement the above-mentioned Figure 6 In the specific implementation, one or more instructions in the computer storage medium are loaded by the processor 1501 and the input interface 1502 and execute the following steps:
[0144] An input interface 1502 is used to obtain N compiled memories of N shader variants referenced by a target application; each of the N shader variants has a compiled memory, the N shader variants are compiled when the target application is running to render an application screen in the target application, and the compiled memory of each shader variant is obtained by testing in a test application that references the N shader variants, where N is a positive integer;
[0145] Processor 1501, configured to determine a target shader variant from the N shader variants based on N compile memories of the N shader variants and available run memory of a graphics processor;
[0146] The processor 1501 is further configured to load the target shader variant and precompile the target shader variant when the target application is running.
[0147] In one embodiment, the processor 1501 specifically performs the following operations when determining a target shader variant from the N shader variants based on the N compiled memories of the N shader variants and the available running memory of the graphics processor;
[0148] Obtain a pre-compilation rule, wherein the pre-compilation rule indicates a compilation memory threshold of a single shader variant to be pre-compiled;
[0149] Determine, among the N shader variants, a shader variant whose compiled memory is greater than the compiled memory threshold as a candidate shader variant;
[0150] The target shader variant is determined from the candidate shader variants based on the available running memory of the graphics processor, and the total amount of compiled memory of the target shader variant is less than the available running memory of the graphics processor.
[0151] In one embodiment, the N shader variants are used to render multiple application screens in the target application, and one application screen corresponds to one or more shader variants;
[0152] When the processor 1501 determines the target shader variant from the N shader variants based on the N compiled memories of the N shader variants and the available running memory of the graphics processor, the processor 1501 specifically performs the following operations:
[0153] According to the priority of each application screen among the multiple application screens, a target shader variant corresponding to each application screen is determined from one or more shader variants corresponding to each application screen, and the total amount of compiled memory of the target shader variant is less than the available running memory of the graphics processor.
[0154] The present application embodiment provides a computer program product or a computer program. The computer program product includes a computer program, which is stored in a computer storage medium; a processor of a program testing device reads the computer program from the computer storage medium, and the processor executes the computer program, so that the program testing device performs the above-mentioned Figure 2 as well as Figure 7 The computer-readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0155] The present application provides a computer program product or a computer program. The computer program product includes a computer program, which is stored in a computer storage medium. A processor of a program execution device reads the computer program from the computer storage medium, and the processor executes the computer program, so that the program execution device performs the above-mentioned Figure 6 The method embodiment shown.
[0156] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An information processing method, characterized in that: include: Obtaining N shader variants referenced by a test application; wherein the test application is used to test the N shader variants referenced by a target application, and the N shader variants referenced by the test application are consistent with the N shader variants referenced by the target application; the N shader variants are compiled for rendering an application screen, where N is a positive integer; Before compiling an nth shader variant among N shader variants referenced by the test application, obtaining a first running memory occupied by the test application, and after compiling the nth shader variant, obtaining a second running memory occupied by the test application, where n is a positive integer less than or equal to N; Based on the first running memory and the second running memory, the compilation memory of the nth shader variant is determined, the compilation memory of the nth shader variant indicates the running memory required when compiling the nth shader variant, and the compilation memory of the nth shader variant is used to determine whether the nth shader variant needs to be precompiled when the target application is running.
2. The method according to claim 1, wherein The obtaining of the first running memory occupied by the test application includes: Calling a memory acquisition function to acquire a first running memory occupied by the test application; The memory calling interface is called to reflectively obtain the first running memory obtained by the memory obtaining function.
3. The method according to claim 1, wherein The determining, based on the first running memory and the second running memory, the compilation memory of the nth shader variant includes: A difference between the second running memory and the first running memory is determined as the compilation memory of the nth shader variant.
4. The method according to claim 1, wherein The target application is created based on an optimized performance evaluation result, wherein the performance evaluation result is obtained during the creation of the target application based on an evaluation of relevant performances of N shader variants referenced by the target application.
5. An information processing method, characterized in that: include: Obtaining N compiled memories of N shader variants referenced by a target application; each of the N shader variants has a compiled memory, the N shader variants are compiled when the target application is running to render an application screen in the target application, the compiled memory of each shader variant is determined by the method according to any one of claims 1 to 4, where N is a positive integer; Determine a target shader variant from the N shader variants based on N compiled memories of the N shader variants and available runtime memory of the graphics processor; When the target application is run, the target shader variant is loaded and precompiled.
6. The method according to claim 5, wherein The determining a target shader variant from the N shader variants based on the N compilation memories of the N shader variants and the available running memory of the graphics processor comprises: Obtain a precompilation rule, wherein the precompilation rule indicates a compilation memory threshold of a single shader variant to be precompiled; Determine, among the N shader variants, a shader variant whose compiled memory is greater than the compiled memory threshold as a candidate shader variant; The target shader variant is determined from the candidate shader variants based on the available running memory of the graphics processor, wherein the total amount of compiled memory of the target shader variant is smaller than the available running memory of the graphics processor.
7. The method according to claim 5, wherein The N shader variants are used to render multiple application screens in the target application, and one application screen corresponds to one or more shader variants; The determining a target shader variant from the N shader variants based on the N compiled memories of the N shader variants and the available running memory of the graphics processor includes: Determine, according to a priority of each application screen among the multiple application screens, a target shader variant corresponding to each application screen from one or more shader variants corresponding to each application screen, wherein a total amount of compiled memory of the target shader variant is less than an available running memory of the graphics processor.
8. A program testing device, characterized in that: include: an acquisition unit, configured to acquire N shader variants referenced by a test application; wherein the test application is used to test the N shader variants referenced by a target application, the N shader variants referenced by the test application being consistent with the N shader variants referenced by the target application; the N shader variants are compiled for rendering an application screen, where N is a positive integer; a processing unit, configured to obtain, before compiling an nth shader variant among N shader variants referenced by the test application, a first running memory occupied by the test application, and after compiling the nth shader variant, obtain a second running memory occupied by the test application, where n is a positive integer less than or equal to N; The processing unit is further used to determine the compilation memory of the nth shader variant based on the first running memory and the second running memory, the compilation memory of the nth shader variant indicates the running memory required when compiling the nth shader variant, and the compilation memory of the nth shader variant is used to determine whether the nth shader variant needs to be precompiled when the target application is running.
9. A program execution device, characterized in that: include: an acquisition unit, configured to acquire N compiled memories of N shader variants referenced by a target application; each of the N shader variants has one compiled memory, the N shader variants being compiled when the target application is running for rendering an application screen in the target application, the compiled memory of each shader variant being determined by the method according to any one of claims 1 to 4, where N is a positive integer; a processing unit configured to determine a target shader variant from the N shader variants based on N compiled memories of the N shader variants and available running memory of a graphics processor; The processing unit is further configured to load the target shader variant and precompile the target shader variant when the target application is running.
10. A program testing device, characterized in that: The program testing device includes an input interface and an output interface, and further includes: a processor adapted to implement one or more instructions; and A computer storage medium storing one or more instructions, wherein the one or more instructions are suitable for being loaded by the processor and executing the information processing method according to any one of claims 1 to 4.
11. A program execution device, characterized in that: The program execution device includes an input interface and an output interface, and further includes: a processor adapted to implement one or more instructions; and A computer storage medium storing one or more instructions, wherein the one or more instructions are suitable for being loaded by the processor and executing the information processing method according to any one of claims 5 to 7.
12. A computer storage medium, characterized in that The computer storage medium stores computer program instructions, and when the computer program instructions are executed by the processor, the information processing method according to any one of claims 1 to 4 or the information processing method according to any one of claims 5 to 7 is implemented.
13. A computer program product, characterized in that The computer program product includes a computer program, and when the computer program is executed by a processor, it implements the information processing method according to any one of claims 1 to 4 or the information processing method according to any one of claims 5 to 7.
