Data processing system
By preparing multiple command streams in the data processing system and using wait commands to synchronize task running, the problem of low utilization efficiency of graphics processor resources is solved, and efficient synchronization between tasks and full utilization of resources are achieved.
Patent Information
- Application Number
- CN201910368576.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-05-05
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2039-05-05
AI Technical Summary
Existing data processing systems cannot effectively utilize processing resources when submitting processing tasks to the graphics processor, especially when there are dependencies between tasks and the mosaic task cannot fully use the processing resources, resulting in inefficient use of resources and complex requirements. drive operation.
Synchronization of tasks and efficient resource utilization are achieved by preparing multiple command streams on the main processor and including wait commands in the command stream, causing processing resources to delay running subsequent commands until a specific position in another command stream is reached.
Without increasing main processor overhead and complex driver operations, the efficiency of processing resource usage is improved and the synchronous operation of dependent tasks is ensured.
Smart Images

Figure CN110443742B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to data processing systems, and more particularly to submitting processing tasks to processing resources (such as graphics processors) of data processing systems. Background Art
[0002] Many data processing systems include processing resources such as a graphics processor (graphics processing unit (GPU)) that can perform processing tasks for, for example, applications that run on a primary (eg, main) processor (CPU) of the data processing system.
[0003] By providing a stream of commands (instructions) to be executed by the processing resource, the processing resource (e.g., a graphics processor) can be caused to run the processing task of the application. For example, a driver for the processing resource can prepare a command stream containing the commands (instructions) to be executed by the processing resource, and provide the command stream to the processing resource (e.g., a graphics processor), and the processing resource then executes the commands (operations indicated by the commands) in the command stream. The command stream can, for example, contain commands (instructions) to set parameters for the processing task, and commands (instructions) to execute the processing task. The processing resource will then work through the command stream in its own way, which sequentially executes the commands (instructions) in the command stream.
[0004] Applicants have recognised that in some cases tasks to be performed by a processing resource may have dependencies between them such that, for example, they need to be run in a particular order. An example of this is geometry tasks for a graphics processor, where there may typically be sequential dependencies between geometry tasks as they must be run in the same order as API (application program interface) draw calls (calldraw). This can be achieved directly by appropriately ordering the geometry tasks in the command stream provided to the graphics processor.
[0005] Applicants have also recognized that it may be the case that a given processing task to be performed by a processing resource is not, by itself, able to fully utilize all available resources of the processing resource. An example of this in a graphics processor may be a situation where tessellation is required, as such tessellation may require multiple sequentially dependent tessellation tasks (followed by a single geometry task), but these tessellation tasks will typically not individually require all processing resources of the graphics processor to complete (e.g., because they will not contain enough work items to be processed fully using the processing resources of the graphics processor). Moreover, such tessellation tasks may run for a relatively long time.
[0006] At this point it would be possible to simply include such smaller (e.g., tessellation) tasks in the command stream in sequence. In this case, such "simplified" processing tasks (e.g., tessellation tasks) would simply be added to the end of the existing command stream being prepared. However, this would then not use the resources of the processing resources (e.g., graphics processor) in the most efficient manner.
[0007] Alternatively, greater use of processing resources (and thereby greater efficiency) in this situation may be achieved by, for example, modifying an existing command stream to insert smaller (e.g., tessellation) tasks at an earlier point in the command stream so that these tasks can then run in parallel with other processing tasks, for example, on a processing resource (e.g., a graphics processor) before their results are needed.
[0008] However, such an operation would require more complex driver operation and thus may incur significant host processor load and overhead for driver operation, for example both because a previously prepared command stream would need to be modified and because appropriate "modification" (e.g., task "insertion") points in the existing command stream would need to be tracked. Furthermore, such "tracking" would need to be done at all times because it is impossible to predict in advance when an existing command stream might need to be modified.
[0009] Applicants therefore believe that there is scope for improvements in the submission of processing tasks for execution to a processing resource of a data processing system, such as a graphics processor. Summary of the invention
[0010] According to a first aspect of the present invention, there is provided a method for operating a data processing system, the data processing system comprising:
[0011] a main processor operable to run an application of the data processing system; and
[0012] a processing resource operable to perform processing tasks of an application running on the host processor;
[0013] The method comprises the following steps:
[0014] In response to a request from an application for a process to be performed by the processing resource, preparing on the host processor a plurality of command streams that cause the processing resource to perform a processing task of the application, each command stream comprising a sequence of commands that cause the processing resource to perform the processing task;
[0015] The steps of preparing the command stream include:
[0016] When a processing task to be added to a command flow among the multiple command flows has a dependency relationship with a processing task to be included in another command flow among the multiple command flows:
[0017] Including, in a command stream that is to include a processing task having a dependency on a processing task to be included in another command stream, a wait command that will cause a processing resource to delay execution of subsequent commands in the command stream that includes the wait command until the processing resource reaches a specific position in the other command stream;
[0018] The method further comprises the following steps:
[0019] The host processor provides a plurality of command streams to the processing resources; and
[0020] The processing resource runs commands in multiple command streams to perform processing tasks of the application;
[0021] The steps for a processing resource to run a command in a command flow include:
[0022] When the command stream includes a wait command, the processing resource does not execute subsequent commands in the command stream including the wait command until the processing resource reaches a specific position in another command stream for the wait command; and
[0023] When the processing resource reaches a specific position in another command stream for the wait command, the processing resource executes a subsequent command after the wait command in the command stream including the wait command.
[0024] According to a second aspect of the present invention, there is provided a data processing system, the data processing system comprising:
[0025] a main processor operable to run an application of the data processing system; and
[0026] a processing resource operable to perform processing tasks of an application running on the host processor;
[0027] Among them, the main processor includes:
[0028] command stream generation circuitry operable to, in response to a request from an application for a process to be performed by the processing resource, prepare a plurality of command streams that cause the processing resource to perform a processing task of the application, each command stream comprising a sequence of commands that cause the processing resource to perform the processing task;
[0029] The command stream generation circuit may further be operable to:
[0030] When a processing task to be added to a command flow among the multiple command flows has a dependency relationship with a processing task to be included in another command flow among the multiple command flows:
[0031] Including, in a command stream that is to include a processing task having a dependency on a processing task to be included in another command stream, a wait command that will cause a processing resource to delay execution of subsequent commands in the command stream that includes the wait command until the processing resource reaches a specific position in the other command stream;
[0032] The main processor also includes:
[0033] processing circuitry operable to provide a plurality of command streams to a processing resource; and
[0034] Processing resources, the processing resources comprising:
[0035] an execution circuit operable to execute commands in the plurality of command streams to perform processing tasks of the application;
[0036] Among them, the operating circuit is configured as:
[0037] In response to the command stream including a wait command, not executing subsequent commands in the command stream including the wait command until the processing resource reaches a specific location in another command stream indicated for the wait command; and
[0038] When the processing resource reaches a specific position in another command stream for a waiting command, a subsequent command after the waiting command in the command stream including the waiting command is executed.
[0039] The present invention relates to a processing resource such as a graphics processor operable to execute command (instruction) structures in a command stream that performs processing tasks of an application running on a host processor.
[0040] However, in the present invention, in addition to simply providing a single command stream for execution to a processing resource, multiple command streams are prepared and provided to the processing resource for execution. In addition, a command stream may include a "wait" command that causes the processing resource to delay executing subsequent commands in the command stream until the processing resource reaches a specific location in another (different) command stream. In other words, a command stream may include a "progress wait" command that causes the processing resource to delay executing subsequent commands in the command stream until the processing resource reaches a specific location in another (different) command stream (making an indicated amount of progress in the other (different) command stream).
[0041] As will be discussed further below, this structure then facilitates more direct synchronization of the execution of processing tasks that have dependencies on each other, and in a manner that can more fully and efficiently utilize the resources of the processing resources, as compared to, for example, structures that use only a single command stream.
[0042] Furthermore, operation in the manner of the present invention and command stream preparation and processing task execution can be accomplished without requiring significant primary (main) processor (CPU) overhead and without requiring, for example, significantly more complex driver operations for processing resources.
[0043] The invention also extends to the operations of preparing the command stream itself and correspondingly to the processing resources executing the command stream itself.
[0044] Thus, according to a further aspect of the invention, there is provided a method of operating a main processor of a data processing system comprising a main processor operable to run an application of the data processing system and processing resources operable to perform processing tasks of the application running on the main processor.
[0045] The method comprises the following steps:
[0046] In response to a request from an application for a process to be performed by the processing resource, preparing on the host processor a plurality of command streams that cause the processing resource to perform a processing task of the application, each command stream comprising a sequence of commands that cause the processing resource to perform the processing task;
[0047] The steps of preparing the command stream include:
[0048] When a processing task to be added to a command flow among the multiple command flows has a dependency relationship with a processing task to be included in another command flow among the multiple command flows:
[0049] Including, in a command stream that is to include a processing task having a dependency on a processing task to be included in another command stream, a wait command that will cause a processing resource to delay execution of subsequent commands in the command stream that includes the wait command until the processing resource reaches a specific position in the other command stream;
[0050] The method further comprises the following steps:
[0051] The host processor provides multiple command streams to the processing resources to execute.
[0052] According to a further aspect of the present invention, there is provided a main processor for a data processing system, the main processor being operable to execute an application of the data processing system and comprising:
[0053] command stream generation circuitry operable to, in response to a request from an application for processing to be performed by a processing resource of the data processing system, prepare a plurality of command streams that cause the processing resource to perform a processing task of the application, each command stream comprising a sequence of commands that cause the processing resource to perform the processing task;
[0054] The command stream generation circuit may further be operable to:
[0055] When a processing task to be added to a command flow among the multiple command flows has a dependency relationship with a processing task to be included in another command flow among the multiple command flows:
[0056] Including, in a command stream that is to include a processing task having a dependency on a processing task to be included in another command stream, a wait command that will cause a processing resource to delay execution of subsequent commands in the command stream that includes the wait command until the processing resource reaches a specific position in the other command stream;
[0057] The main processor also includes:
[0058] Processing circuitry operable to provide a plurality of command streams to a processing resource.
[0059] According to a further aspect of the invention, there is provided a method of operating a processing resource of a data processing system, the processing resource being operable to perform processing tasks of applications, the applications running on a main processor of the data processing system;
[0060] The method comprises the following steps:
[0061] the processing resource receiving a plurality of command streams from a main processor of the data processing system that cause the processing resource to execute processing tasks of an application executed on the main processor, each command stream comprising a sequence of commands that cause the processing resource to execute the processing tasks, and at least one of the command streams comprising a wait command that will cause the processing resource to delay execution of subsequent commands in the command stream that includes the wait command until the processing resource reaches a particular position in another command stream;
[0062] and
[0063] The processing resource runs commands in multiple command streams to perform processing tasks of the application;
[0064] The steps for a processing resource to run a command in a command flow include:
[0065] When the command stream includes a wait command, the processing resource does not execute subsequent commands in the command stream including the wait command until the processing resource reaches a specific position in another command stream for the wait command; and
[0066] When the processing resource reaches a specific position in another command stream for the wait command, the processing resource executes a subsequent command after the wait command in the command stream including the wait command.
[0067] According to a further aspect of the present invention, there is provided a processing resource for a data processing system, the processing resource being operable to perform processing tasks of applications running on a main processor of the data processing system, and the processing resource comprising:
[0068] an execution circuit operable to execute commands in a plurality of command streams received from the host processor to execute processing tasks of an application running on the host processor, each command stream comprising a sequence of commands that cause a processing resource to perform a processing task;
[0069] Among them, the operating circuit is configured as:
[0070] In response to a command stream including a wait command that will cause the processing resource to delay execution of subsequent commands in the command stream including the wait command until the processing resource reaches a specific location in another command stream, not executing subsequent commands in the command stream including the wait command until the processing resource reaches a specific location in another command stream indicated by the wait command;
[0071] and
[0072] When the processing resource reaches a specific position in another command stream for a waiting command, a subsequent command after the waiting command in the command stream including the waiting command is executed.
[0073] The processing resource may be any suitable processing resource operable to perform the processing tasks of the application. In a preferred embodiment, the processing resource is a graphics processor (graphics processing unit (GPU)). In another preferred embodiment, the processing resource is a video processor and / or an image processor.
[0074] The processing to be performed by the processing resource may be any suitable and desired processing that the processing resource in question can perform. This may, and preferably does, therefore depend on the nature of the processing resource.
[0075] In the case of a graphics processor, the processing to be performed preferably includes appropriate graphics processing, such as generating graphics processing output, such as rendering frames (images) for display and / or for other purposes (e.g., render-to-texture operations).
[0076] In a preferred embodiment, in the case of a graphics processor, the processing to be performed includes geometry processing, and specifically geometry processing that may require tessellation (wherein it may or will be necessary to generate and process some tessellated geometry (the geometry processing will include a tessellation step / stage)).
[0077] In another preferred embodiment, in the case of a graphics processor, the processing to be performed is an interleaved rendering operation, i.e., wherein multiple rendering passes are each divided into a number of tasks, which are then interleaved across (multiple) rendering passes (e.g., to reduce the amount of cache required to hold intermediate results).
[0078] In another preferred embodiment, in the case of a graphics processor, the processing to be performed involves graphics shader processing and operations, and specifically involves a structure in which one or more "pilot" shaders (as described, for example, in applicant's earlier U.S. Patent No. 9,189,881) are to be run (followed by a structure in which non-pilot shader programs are to be run).
[0079] The processing tasks to be performed by the processing resources may be any suitable and desired processing that the processing resource in question may perform. They may and preferably do therefore depend on the nature of the processing resources, and on the specific processing to be performed by the processing resources.
[0080] It is contemplated that the present invention is particularly useful in situations where there may be different types of processing tasks to be performed by a processing resource, particularly where the processing tasks have different levels of use of the processing resource and are mutually dependent on each other. Thus, in a particularly preferred embodiment, the processing tasks to be performed by the processing resource include: processing tasks that will more completely (e.g., completely) use the processing resource when executed; and processing tasks that will less completely (and incompletely) use the processing resource when executed (and for example and preferably may therefore be executed in parallel with other processing tasks on the processing resource). Most preferably, one or more of the processing tasks that use the processing resource more completely is dependent on (e.g., requires a result from) one or more of the processing tasks that will use the processing resource less completely.
[0081] An example of this would be graphics geometry processing that includes tessellation operations, in which case "normal" graphics geometry processing can and typically will use the graphics processor's processing more completely, but relies on tessellation processing tasks (e.g., compute jobs) that, by themselves, would not use the graphics processor so completely.
[0082] However, it will also be possible to use the invention for situations where the processing tasks use processing resources roughly equally (but again have mutual dependencies on each other.) An example of this would be interleaved rendering, where different rendering passes will actually use the same processing tasks (and therefore have similar usage of the graphics processor), but will be dependent on each other.
[0083] In the case of a graphics processor, the processing tasks preferably include appropriate graphics processing operations, such as for generating graphics processing output, such as rendering frames (images) for display and / or for other purposes (e.g., render-to-texture operations).
[0084] In a preferred embodiment, the processing tasks to be performed in the case of a graphics processor include one or more of the following: graphics processing tasks other than (or in addition to) graphics computing tasks; and graphics computing tasks (wherein the graphics processor acts as a general-purpose graphics processor (GPGPU) that performs computing processing (computing jobs)).
[0085] In a preferred embodiment of this invention, the graphics computing tasks include computing tasks to perform tessellation and / or the non-computational tasks include graphics geometry processing tasks (geometry operations). Most preferably, the processing tasks include geometry processing tasks and tessellation computing tasks. Thus, in this case, the processing tasks will be related to the generation and processing of the tessellated geometry.
[0086] In such an architecture, particularly in the case of tile-based graphics processing, the geometry processing tasks can and preferably do include geometry processing that processes graphics vertices and prepares the results for a later tile-based fragment rendering task. The geometry processing may consist of, for example, computing vertex coordinates, computing attributes for each vertex, and classifying primitives into tiles. The compute tasks may include, for example, general compute tasks that do not use specific hardware required to classify primitives into tiles or read lists of primitives for each tile, or may be, for example, integrated with tile classification (e.g., a small number of compute tasks that are run on demand based on tile classification). There may also be fragment tasks that render fragments for primitives that apply to each tile.
[0087] In another preferred embodiment, there are one or more processing tasks associated with the wizard shader processing and then associated with a "full" (or at least remaining after the wizard shader operation) shader operation. In this case, the "full" shader operation processing task can depend on the "wizard" shader operation and the processing task.
[0088] Any desired number (multiple) of command streams may be prepared for the processing resources. In a preferred embodiment, only two command streams are prepared, and in other embodiments, more than two command streams are prepared.
[0089] Each command stream may be associated with any suitable and desired processing task.
[0090] In a preferred embodiment, each command stream is related to a different type of processing task. For example and preferably, one (or more) command streams may be related to a processing task that uses resources in the processing resources more completely (e.g., completely) when executed, and another command stream is related to a processing task that uses the processing resources in the processing resources less completely (except completely (incompletely)) when executed.
[0091] In this structure, in the case of a graphics processor, in one embodiment, one (or more) command stream is therefore preferably related to computational tasks for the graphics processor, and the other (or another) command stream is related to non-computational tasks (tasks other than computational tasks). In a particularly preferred structure of this, one (or more) command stream is related to geometric tasks (geometry jobs) for the graphics processor, and the other command stream is related to computational tasks (computation jobs) (and most preferably tessellation computational tasks) for the graphics processor.
[0092] In another embodiment, in the case of a graphics processor, one (or more) command stream is associated with wizard shader tasks for the graphics processor and the other (or another) command stream is associated with other non-wizard shader tasks for the graphics processor.
[0093] In other embodiments, each or at least multiple command streams are related to the same type of task. This may be particularly the case in the case of a graphics processor, for example when performing interleaved rendering, in which case there may be multiple command streams, each command stream comprising a corresponding rendering task, but related to, for example, a different rendering pass of a sequence of rendering passes to be performed for an interleaved rendering operation.
[0094] Each command stream should and preferably does include one or more (and preferably multiple) commands (instructions). In addition to (where appropriate and desired) including (progress) wait commands (instructions) in the manner of the present invention, the command stream may also further include any suitable and desired commands (instructions) that cause the processing resource to perform the desired processing task, for example and preferably according to the command stream operation of the data processing system and processing resource of interest. Thus, the command stream preferably can and preferably does include one or more or all of the following commands: commands (instructions) to set parameters for the processing task, commands (instructions) to run the processing task, commands (instructions) to wait for the completion of the processing task, etc.
[0095] In a particularly preferred embodiment, a command stream may, and preferably does, include (at least) commands (instructions) that cause subsequent execution of the command stream of interest to be stopped (prevented) until a (e.g. and preferably indicated) set or subset of previously issued processing tasks for the command stream of interest is completed. Such a command will therefore cause subsequent execution of commands in the command stream to be delayed until previous commands (and specifically processing tasks) in the command stream of interest are completed. Such a mechanism may therefore be used to ensure that execution of commands in a command stream will wait until a particular processing task for the command stream is completed before executing subsequent commands (instructions) in the command stream. (This should be distinguished from the "wait for progress" command of the present invention, which has the effect of delaying execution of commands in a command stream until a particular point is reached in another, different command stream.)
[0096] Thus, in a particularly preferred embodiment, the command stream can and preferably does include (at least) commands indicating when to start and complete a processing task, such as commands that trigger the execution of a processing task and commands that determine / indicate (wait for) completion of the processing task.
[0097] The "another command stream" progress wait command that may be included in the command stream according to the present invention may take any suitable and desired form that will cause the processing resource to delay executing subsequent commands in the command stream until the processing resource reaches a specific position in the other command stream (i.e., will cause the processing resource not to execute commands following the wait command in the command stream of interest until the processing resource reaches a specific position in the other command stream).
[0098] In a particularly preferred embodiment, the wait command indicates both another command stream to wait for (e.g., and preferably an identifier for that command stream) and a specific position in that other command stream to wait for (i.e., a position that must be reached in the other command stream before the processing resource will run subsequent commands in the command stream that includes the wait command). In a particularly preferred embodiment, the wait command indicates one (and only one) other command stream to wait for. (Where it is desirable to be able to indicate multiple command streams to wait for, then this may be done, for example, and preferably, by including multiple "progress wait" commands in the command stream, e.g., in succession.)
[0099] The specific position in the command stream to be waited (and the determination of when that position is reached in the command stream) can be indicated (and determined) in any timely and desired manner. The specific position preferably corresponds to a specific command in the command stream of interest, and most preferably corresponds to the completion of a specific (preferably selected) processing task of another command stream.
[0100] The indication of the position in the command stream to wait for preferably indicates a minimum position to be reached in the other command stream before continuing to execute commands in the command stream including the wait command.
[0101] In a particularly preferred embodiment, progress along a command stream (and each command stream) is tracked and a particular position to wait for is indicated in view of the progress point reached in the command stream. Most preferably, the command stream (and each command stream) has a progress counter associated with it which can (and is) incremented as commands in the command stream of interest are added / run, and the progress wait command correspondingly indicates a particular progress counter value to wait for (and preferably a minimum progress counter value to wait for).
[0102] The progress counter for a command stream is preferably incremented when (preferably only when) a specific (preferably selected, preferably predetermined) command (e.g., a command of a group of multiple specific (preferably selected, preferably predetermined) commands) is added to / run for the command stream. Thus, preferably only some (but not all) commands that can be (and are) included in a command stream will increment the progress count of the command stream.
[0103] The specific commands that trigger the progress counter to increase are preferably more "significant" commands, such as and preferably commands that indicate the start or completion of processing resource work (e.g., processing tasks), such as and preferably one or more and preferably all of the following commands: commands that submit processing tasks to processing resources to run and commands that wait until processing tasks are completed. In these structures, the progress counter will increase each time one of the specific commands is completed.
[0104] In a particularly preferred embodiment, a command in a command stream may indicate whether a progress counter is to be incremented in response to the command (e.g., completion). This would then allow selective indication of which commands are to increment the progress counter of the command stream. Such indication may be provided as desired, for example by including a flag (bit) in the command encoded in the command stream indicating whether the progress counter is to be incremented.
[0105] In a particularly preferred embodiment, the progress count operation (and its incrementation) is used both when preparing a command stream (such that the progress counter for the command stream is appropriately incremented as commands are added to the command stream and the current value of the progress counter for the command stream is tracked as the command stream is prepared) and correspondingly when a processing resource is executing the command stream (such that the progress counter for the command stream is appropriately incremented when the processing resource executes the command stream to track the position in the command stream that the processing resource reaches when executing the command stream).
[0106] The main processor can prepare multiple command streams for processing resources in response to requests from applications for processing to be performed by the processing resources in any suitable and desired manner. Preferably, the main processor adds each command to each command stream so that the processing resource performs the desired processing task. As discussed above, the main processor should add commands to a given command stream as appropriate (e.g., depending on the desired processing task). For example, the processor can add commands for a particular type of processing task to one command stream and add commands for a different type of processing task to another command stream.
[0107] For example, in the case of a graphics processor, in a preferred embodiment, the main processor will prepare: one command stream comprising a sequence of commands that cause the graphics processor to perform geometric tasks (jobs); and another command stream comprising a sequence of commands that cause the graphics processor to perform computing tasks (computing jobs) (preferably computing jobs to perform tessellation operations).
[0108] As discussed above, in a particularly preferred embodiment, the master processor is operable, as it prepares a command stream, to track, for (and for each) command stream being prepared, the position reached in the command stream (i.e., the latest command added to the command stream). As discussed above, this is preferably done by maintaining a progress counter that tracks how many commands (or at least commands of a particular type) are included in the command stream. Thus, the master processor preferably increments the progress counter as if it added, for example, a particular command to the command stream (and preferably does this for each command stream it prepares).
[0109] Thus, in a preferred embodiment, the main processor will gradually add commands to the command stream (and each command stream) used to cause the processing resource to perform the desired processing task of the application, and while doing so, for each command stream, the main processor keeps track of the current position in the command stream reached (preferably by maintaining a progress counter value for the command stream). Thus, when adding appropriate commands to a command stream, the main processor will also appropriately increase the progress counter value of the command stream to keep track of the current position reached in that command stream.
[0110] In addition to appropriately adding commands to different command streams that cause processing resources to perform desired processing tasks, as discussed above, the host processor can also include appropriate wait commands in command streams when a processing task in one command stream has a dependency on a processing task to be included in another different command stream (i.e., when there is an inter-command stream dependency). Such dependencies can, and in preferred embodiments do, arise when a processing task in one command stream requires a result from a processing task in another command stream before it can be executed, and / or when it is desirable to delay starting a processing task (even if there is no strict dependency on data), for example to reduce the risk of data being generated by a task being evicted from a cache.
[0111] Thus, in a particularly preferred embodiment, the main processor is operable to (and the method includes the following steps) determine whether the processing task to be added to the command stream has a dependency relationship with the processing task to be included in another command stream, and when it is determined that the processing task to be added to the command stream has a dependency relationship with the processing task to be included in another command stream (i.e., an inter-command stream dependency exists), include an appropriate "progress" wait command in the command stream including the processing task having a dependency relationship on the processing task in the other command stream. The main processor can, for example, identify any dependencies itself, or these dependencies can also or instead be specified by the application of the processing that requires attention.
[0112] The applicant recognizes at this point that when a processing task in one (first) command stream has a dependency on a processing task in another command stream, then the processing task in the other command stream will, for example, have to be completed before the processing task in the first command stream can be run. Therefore, in this case, a "progress" wait command is added to the first command stream before (and preferably immediately before) the command for the processing task that depends on the processing task in the other command stream, and the progress wait command will cause the processing resource to delay running any other commands in the first command stream until the processing resource completes the processing task in the other command stream of interest.
[0113] As discussed above, the "progress" wait command should and preferably does identify another command stream that includes a processing task on which the task in the first command stream depends, and a position (e.g. and preferably an appropriate progress counter value) in the other command stream that is after (e.g. and preferably immediately after) the processing task in the other command stream on which the processing task in the first command stream depends (i.e., to delay the execution of the dependent processing task in the first command stream until the required processing task of the other command stream is completed).
[0114] The position in another command stream at which the first command stream (including the wait command) should wait can be identified in any suitable and desired manner. For example, if the processing task in another command stream is already included in the command stream, then the value of the progress counter for the other command stream that has been reached (and / or at the end of the processing task of interest) (if the value is tracked) can be used for the wait command.
[0115] Alternatively or additionally, the main processor may be operated to add appropriate commands to another command stream for executing processing tasks on which the processing tasks in the first command stream depend before adding a "progress" wait command to the first command stream (while tracking the position in the other command stream (e.g., the progress counter value)) to determine the position in the other command stream (e.g., the progress counter value) that will be reached in the other command stream (and thus should be indicated for the "progress" wait command) once the relevant processing tasks in the other command stream are completed.
[0116] In a particularly preferred embodiment, the command waiting for the completion of the processing task in another command stream is included in the other command stream after the command for running the processing task, so that once the "complete wait" command is run, it will be known that the processing task in the other command stream that the processing task in the first command stream depends on is (clearly) completed. The position where the first command stream will wait can then (and preferably) be indicated as the position (progress count) after running the "complete wait" command. This will then allow the completion of the processing tasks in another command stream to be determined more easily (and once these tasks are completed, the position in the command stream will be reached).
[0117] Therefore, in this case, the "Progress Wait" command performed in the manner of the present invention will be used together with the "Completion Wait" command that will be used to increase the progress counter for the (other) command stream to ensure that the "Progress Wait" command will correctly wait for the tasks in the other command stream to complete before running the dependent tasks in the command stream including the "Progress Wait" command.
[0118] Applicants have also recognised that where processing tasks in one command stream are dependent on (the completion of) one or more processing tasks in another command stream, it would be desirable to try to ensure, if possible, that the processing tasks in the other command stream complete before (but preferably not too long before) the processing tasks in the first command stream that depend on them (e.g., need their results). This is to try to ensure, for example, that the results of the processing tasks in the other command stream are available when the processing tasks in the first command stream are to be executed, but equally to ensure that these results are preferably present in a more local memory (such as a cache) of the processing resource (as opposed to, for example, being written to main memory and therefore needing to be fetched from main memory to more local memory before they can be used).
[0119] Thus, the applicant recognizes that it would be preferable to control the triggering of the execution of a processing task in another command stream relative to a processing task that is dependent on (e.g., requires the results of) the processing task in another command stream, for example and preferably so that the results of the processing task in the other command stream still exist (and are available) in the local memory of the processing resource when the processing task that is dependent on (e.g., requires these results) is to be run.
[0120] The applicant also recognizes that this can also be achieved by including appropriate "progress wait" commands in another command stream that is to include processing tasks on which the processing tasks in the first command stream depend, so as to trigger the completion of these processing tasks at an appropriate point before the processing tasks in the first command stream that depend on the processing tasks in the other command stream.
[0121] Thus, in a particularly preferred embodiment, when a processing task to be added to the (first) command stream has a dependency relationship with a processing task in another command stream (i.e., there is an inter-command stream dependency), a "progress wait" command is also included in the other command stream, which will cause the processing resource to delay running subsequent commands in the other command stream (after the wait command) until the processing resource reaches a specific position in the (first command stream) including the processing task, which has a dependency relationship with the processing task in the other command stream. The progress wait command in the other command stream should and preferably is included in the other command stream before the command for executing the processing task, on which the processing task in the first command stream depends.
[0122] Thus, in a particularly preferred embodiment, the main processor will also include the progress wait command of the present invention in another command stream before the command for the processing task in another command stream on which the processing task in the first command stream depends, so as to trigger the execution of the processing task in the other command stream (only) once the processing resource reaches a specific position in the first command stream including the processing task that depends on the processing task in the other command stream.
[0123] This will then delay the execution of the processing tasks that the processing tasks in the first command stream depend on until the processing resource reaches a specific position in the first command stream (and is triggered by it). In this way, the execution of dependent processing tasks can be synchronized more easily and efficiently.
[0124] Thus, in a particularly preferred embodiment, when a processing task of a command stream to be added to a plurality of command streams has a dependency relationship with a processing task to be included in another command stream to be included in the plurality of command streams, the main processor includes, in addition to including a "progress wait" command in the command stream to include a processing task having a dependency relationship with the processing task to be included in the other command stream, such "progress wait" command also is included in the other command stream, wherein the other command stream includes a processing task on which the first command stream has a dependency relationship, and the progress wait command will cause the processing resources to delay running subsequent commands in the other command stream until the processing resources reach a specific position in the first command stream, wherein the first command stream includes a processing task having a dependency relationship with the processing task to be included in the other command stream.
[0125] Correspondingly, in a particularly preferred embodiment, the method of the present invention comprises the following steps (and the main processor is operable to):
[0126] determining that a processing task to be added to a first command stream of the plurality of command streams has a dependency relationship with a processing task to be included in another command stream of the plurality of command streams;
[0127] And in response to this:
[0128] including a wait command in the first command stream, the wait command causing the processing resource to delay execution of subsequent commands for the processing tasks in the first command stream until the processing resource reaches a specific location in another command stream; and
[0129] A wait command is included in the other command stream, the wait command causing the processing resource to delay execution of subsequent commands in the other command stream until the processing resource reaches a specific position in the first command stream.
[0130] The specific position in the first command stream indicated by the (progress) wait command in another command stream should and preferably is a position in the first command stream before the processing task in the first command stream that is dependent on the processing task in the other command stream. Most preferably, the specific position in the first command stream to be waited for is a position before one or more processing tasks of the processing task in the first command stream that are dependent on the processing task in the other command stream, to allow time for the processing task in the other command stream to be completed before the processing task in the first command stream that is dependent on the processing task in the other command stream is reached.
[0131] How long a processing task that is dependent on a processing task in another command stream is triggered before a processing task in the other command stream can be determined as desired, for example, based on predetermined (e.g., based on testing and benchmarking) processing task timings and operating conditions and parameters for the data processing system of interest. Typically, it is preferred to have a processing task triggered some (e.g., one or two) processing tasks before a processing task that is dependent on a processing task in another command stream.
[0132] The determination of the position in the first command stream to be waited for and the indication of the position may be achieved in any suitable and desired manner. This may be achieved, for example and preferably, by subtracting a specific (e.g. predetermined, preferably selected) value from the current value of the progress counter for the first command stream to trigger the execution of a processing task in another command stream before the current position is reached in the first command stream.
[0133] In a particularly preferred embodiment, when a processing task to be added to a (first) command stream among the plurality of command streams has a dependency relationship with a processing task to be included in another command stream among the plurality of command streams, the method comprises the following steps (and the main processor is configured to):
[0134] adding a wait command to another command stream, the wait command causing the processing resource to delay running subsequent commands until the processing resource reaches a specific location in the first command stream, the other command stream including the processing tasks that the processing tasks in the first command stream depend on;
[0135] adding, to another command stream following the wait command, one or more commands for executing a processing task in another command stream on which the processing task in the first command stream depends, preferably followed by a command for identifying completion of the processing task in another command stream on which the processing task in the first command stream depends;
[0136] adding a wait command to the first command stream, the wait command causing the processing resource to delay running subsequent commands in the first command stream until the processing resource completes a processing task in another command stream on which the processing task in the first command stream depends; and
[0137] One or more commands are added to the first command stream following the wait command, the one or more commands causing the processing resource to perform a processing task that is dependent on a processing task in another command stream.
[0138] Thus, in a particularly preferred embodiment, in the case of a graphics processor and a tessellation application, the host processor prepares (at least) two command streams (a geometry task command stream and a compute task command stream), and preferably identifies when a tessellation draw call occurs, and in that case:
[0139] Add a wait command to the (tessellation) calculation task command stream to wait for a specific position in the geometry task command stream;
[0140] Then adding to the computing task command stream after the wait command a command to execute the mosaic computing task, and preferably thereafter adding an instruction to identify completion of the mosaic computing task;
[0141] Before adding the mosaic geometry task to the geometry task command stream, a wait command is added to the geometry task command stream, so that the mosaic geometry task in the geometry task command stream is postponed until the mosaic computation task in the computation task command stream is completed.
[0142] The preparation of command streams when there are dependencies between command streams is discussed in detail above. It may also be the case that the processing tasks included in the same command stream have dependencies on each other (i.e., there are intra-command stream dependencies). This structure can and preferably is solved by sorting the processing tasks (and commands for processing tasks) in the command stream of interest in the appropriate order.
[0143] The preparation of the command stream by the host processor may be performed by any suitable and desired elements and components of the host processor. In a preferred embodiment, a driver for the processing resource of interest prepares the command stream (and thus operates in the manner of the invention). Thus, in a preferred embodiment, the command stream generation circuitry comprises a programmable processing circuit that can be programmed (e.g. and preferably operates as a driver for a processing resource) to prepare the command stream in a desired manner.
[0144] Thus, according to a further aspect of the present invention, there is provided a driver for a processing resource of a data processing system, the processing resource being operable to perform processing tasks of applications running on a main processor of the data processing system, the driver being operable to:
[0145] In response to a request from an application for processing to be performed by a processing resource, preparing a plurality of command streams that cause the processing resource to perform a processing task of the application, each command stream comprising a sequence of commands that cause the processing resource to perform the processing task;
[0146] The processing of preparing the command stream includes:
[0147] When a processing task to be added to a command flow among the multiple command flows has a dependency relationship with a processing task to be included in another command flow among the multiple command flows:
[0148] In a command stream that is to include a processing task having a dependency on a processing task to be included in another command stream, a wait command is included that will cause a processing resource to delay execution of subsequent commands in the command stream including the wait command until the processing resource reaches a specific position in the other command stream.
[0149] Once a command stream, including any appropriate (progress) waiting commands, is prepared by the host processor, the command stream is provided to the processing resource (eg, graphics processor) for execution, and the processing resource (eg, graphics processor) will then execute the command stream appropriately.
[0150] The command stream may be provided to a processing resource, such as a graphics processor, in any suitable and desired manner. For example, they may be stored in an appropriate command stream storage (such as a buffer) from which commands may be read appropriately by the processing resource to execute. Other structures are of course possible.
[0151] The execution of the command stream by the processing resource may be configured and implemented in any suitable and desired manner. For example, the processing resource may include a suitable supervisory controller, such as a microcontroller, which is operable to handle the scheduling of the command stream on the hardware execution resource of the processing resource (and in a preferred embodiment, this is the case). Other structures are of course possible.
[0152] Correspondingly, in a preferred embodiment, the hardware execution resources of the processing resources include a plurality of command stream execution units, which are operable to execute (and these command stream execution units execute) commands in the command stream to execute the processing tasks of the application.
[0153] The processing resource (e.g., graphics processor) may correspondingly execute the command streams in any suitable and desired manner. The execution of multiple command streams is preferably started simultaneously with the processing resource (e.g., graphics processor), and then the commands in each command stream are appropriately processed in sequence (and in parallel if the processing resource has the ability to appropriately process the commands in each command stream and where appropriate) (and according to and based on any waiting commands included in the command stream).
[0154] Thus, in a particularly preferred embodiment, the processing resource will execute the commands in the command stream sequentially (and in order), and as it does so, it will, for the command stream it is executing (and for each command stream), track its progress through (along) the command stream (the position it has currently reached in the command stream), for example and preferably by maintaining a progress count for the command stream, which progress count is (preferably) automatically incremented when a command stream command is executed that increments the progress counter. The current command stream position (progress count) may, for example, be maintained in a suitable register of or accessible to the processing resource.
[0155] Correspondingly, when a processing resource encounters a (progress) wait command in a running command stream, the processing resource will identify from the (progress) wait command another command stream that the current command stream is waiting for, and a specific position (for example and preferably a progress count) that the command stream must reach in order to continue running the current command stream.
[0156] In response to such a wait command, the processing resource is therefore preferably operative to determine whether the indicated particular position has been reached in the other command stream, and if so, the processing resource simply continues to execute the commands in the current command stream. On the other hand, if the indicated position in the other command stream has not yet been reached, execution of the current command stream is stopped until the indicated position in the other command stream is reached.
[0157] The determination of whether and when an indicated position in another command stream for a (progress) waiting command is reached may be performed in any suitable and desired manner.
[0158] In a preferred embodiment, in addition to maintaining an indication of the position currently reached in a command stream (eg, a progress count) for each command stream, a record is maintained of any position in the command stream at which another command stream is waiting.
[0159] Thus, in this case, there will be two "positions" ("progress counts") maintained (e.g. and preferably in registers) for the command stream (and each command stream) being executed: a first position (progress count) which tracks the position reached in the command stream; and a second "compare" position (progress count) which indicates the position (progress count) reached in the command stream for the other command stream waiting for the command stream of interest to continue its execution. Thus, the "compare" position (progress count) is preferably capable of being set in use and is preferably set in use to the appropriate position (e.g. progress count value) indicated in a (progress) wait command in the other command stream (in response to a (progress) wait command in the other command stream).
[0160] In these structures, when a "compare" position (progress count value) is set for a command stream, the "compare" position is preferably compared with the position reached in the command stream periodically and continuously until it is determined that the "compare" position (progress count) is reached in the command stream (in which case the operation then proceeds to restart waiting for the execution of commands in the command stream).
[0161] The actual mechanism for resuming the execution of a command stream upon reaching an appropriate position in another command stream can be implemented and configured as desired. For example, this can be done under the control of a supervisory controller (microcontroller), such as generating an interrupt to the controller when the command stream reaches the current "compare" position (progress count value), the controller responding to such an interrupt then (e.g., under software control) identifies which (progress) wait command is encountered, and resuming the execution of the corresponding command stream at the next command after the (progress) wait command.
[0162] Thus, in a preferred embodiment, the processing resources include:
[0163] a plurality of command stream execution units operable to execute commands in the command stream to execute processing tasks of the application; and
[0164] a controller operable to control execution of the command stream by the command stream execution unit;
[0165] And the method further includes the following steps (and the command flow execution unit and the controller are operable to):
[0166] Each command stream execution unit maintains a record of the position currently reached in the command stream it is executing, and a record of the position in the command stream for which another command stream is waiting;
[0167] as well as
[0168] When the command stream execution unit encounters a waiting command in the command stream being executed, the command stream execution unit notifies the controller; and
[0169] The controller responds to signals from the command flow execution unit:
[0170] Identify that the command flow execution unit encounters a waiting command;
[0171] From the wait command, identifying another command stream for which execution of the command stream is to wait and a specific position in the other command stream to which execution of the command stream including the wait command is to be continued;
[0172] determining whether a particular position has been reached in another command stream; and
[0173] When a specific position in another command stream has been reached, the command stream execution unit is notified to continue executing commands in the command stream including the waiting command.
[0174] In this preferred embodiment, when the controller has not yet reached a specific position in another command stream:
[0175] For another command stream that must reach a specific position in order to continue running the command stream including the waiting command, setting a record of the position where the other command stream is waiting to the specific position to be reached in the other command stream in order to continue running the command stream including the waiting command; and
[0176] configuring a command stream execution unit executing another command stream to notify the controller when reaching a set position in the other command stream that the execution of the command stream containing the wait command needs to wait for the other command stream;
[0177] and the command stream execution unit for the other command stream notifies the controller when it reaches a set position in its execution of the other command stream; and
[0178] In response to the signal, the controller identifies for which waiting command a specific position in another command stream is reached, and notifies the command stream execution unit to restart the execution of the command stream including the waiting command that has reached the specific position.
[0179] In these structures, a command stream supervisory controller (e.g., a microcontroller) can also be used to handle exceptions to operation, such as when the command stream to be waited is not currently scheduled on the hardware execution resource and / or more than one command stream is waiting on the same command stream.
[0180] In another preferred embodiment, instead of maintaining a "compare" position (progress count) for each command stream, when a (progress) wait command is encountered in a command stream, the indicated wait position in the (progress) wait command is compared with the current position reached for the other command stream to be waited for (e.g., the progress count value), and if the current position for the other command stream is greater than or equal to the position indicated for the (progress) wait command, then the execution of the command stream including the (progress) wait command continues, but if not, the execution of the command stream including the (progress) wait command is stopped.
[0181] Thus, in a preferred embodiment, the processing resources include:
[0182] a plurality of command stream execution units operable to execute commands in the command stream to execute processing tasks of the application; and
[0183] a controller operable to control execution of the command stream by the command stream execution unit;
[0184] And the method further includes the following steps (and the command flow execution unit is operable to):
[0185] Each command stream execution unit maintains a record of the current position reached in the command stream it is executing;
[0186] and
[0187] When a command flow execution unit encounters a waiting command in the command flow being executed, the command flow execution unit:
[0188] From the wait command, identifying another command stream for which execution of the command stream is to wait and a specific position in the other command stream to which execution of the command stream including the wait command is to be continued;
[0189] determining whether a specific position has been reached in the other command stream based on a record of the position currently reached in the command stream maintained by the command stream execution unit that is executing the identified other command stream; and
[0190] When a specific position in another command stream has been reached, continue to execute commands in the command stream including the waiting command;
[0191] When a specific position in another command stream has not been reached, stopping the command stream including waiting for commands until the specific position in another command stream is reached.
[0192] In this case, the (progress) wait command (and the checking of the current position of the command stream being waited for) may be retried again periodically (e.g., at specific intervals), but in a particularly preferred embodiment, the (progress) wait command is only retried in response to the occurrence of a specific (preferably selected, preferably predetermined) event.
[0193] Thus, in a preferred embodiment, when a command stream execution unit that is waiting for a command is encountered in a running command stream before reaching a specific position in another command stream:
[0194] In response to the occurrence of a specific event, the retry determines whether a specific position is reached in another command stream based on a record of the currently reached position in the command stream maintained by the command stream execution unit that is executing the identified another command stream.
[0195] In a preferred embodiment, the check of the current position reached in the command stream being waited for is (only) retried when the current position (e.g., progress count) for the command stream is updated (increased). In this case, the (progress) wait command can be checked again when the position (progress count) for any command stream is updated, or the operation can be such that the (progress) wait command is only retried when the position (progress count) for the specific command stream being waited for is updated.
[0196] In a preferred embodiment, the (progress) wait command is also retried when there is a change in the identity of the command stream being run by the processing resource. This may be particularly applicable to the following situation: a processing resource (e.g., a graphics processor) can only run fewer command streams in parallel than the total number of command streams that have been prepared and are to be run. In this case, the command stream run schedule may change the command stream currently being run (e.g., for scheduling purposes), thereby changing the group of command streams currently being run. In this case, it is possible to make the command stream being waited for valid (when it was not run before), and vice versa (invalidate). At least in the former case, if the command stream is now run when the command stream being waited for was not run before, it will be appropriate to retry the (progress) wait command in the command stream waiting for the command stream, because there will now be progress in the run of the command stream being waited for.
[0197] To facilitate this operation (among other things), in a particularly preferred embodiment, in addition to maintaining a record of the current position (progress count) reached in the command stream being executed, this position indication (progress count) is also associated with an identifier for the command stream of interest (which identifier should, and preferably does, match the identifier that will be used in the (progress) wait command to identify the command stream being waited for. In this case, when a (progress) wait command is encountered in a command stream, processing preferably first operates to determine whether there are any currently valid command streams having the same command stream identifier as the identifier used to indicate the command stream to be waited for in the (progress) wait command. This will then allow the command stream being waited for to be identified.
[0198] If when encountering a (progress) wait command, it is determined that the command stream being waited for is not currently being executed, then the execution of the command stream including the (progress) wait command should and preferably be stopped. Most preferably, in this structure, an appropriate signal (e.g., interrupt) is issued to a command stream execution supervisor (e.g., a microcontroller) to allow appropriate handling of special situations (exceptions) (e.g., by scheduling the wait for the command stream that is currently running).
[0199] In a preferred embodiment, when the execution of a command stream is stopped because it is waiting for another command stream, an indication of this (e.g., an interrupt) is preferably sent to a command stream execution supervisor (e.g., a microcontroller) to indicate that the command stream of interest is currently "blocked". This will then allow, for example, the command stream execution supervisor to schedule an alternative command stream to execute in place of the "blocked" command stream, for example in an architecture where the processing resources are only capable of running fewer command streams in parallel than the total number of command streams to be executed. Such an indication can be configured, for example, to be generated only on the first attempt (progress) to wait for a command (if desired).
[0200] Thus, in a preferred embodiment, when it is determined that a specific position in another command stream has not been reached according to the record of the current reached position in the command stream maintained by the command stream execution unit that is executing the identified other command stream, the command stream execution unit that encounters a waiting command in the command stream that is being executed:
[0201] A controller operable to control execution of a command stream by a command stream execution unit is notified that execution of the command stream including the wait command has stopped.
[0202] The above specifically describes the operation performed in the manner of the present invention when there are dependencies between command streams. In some cases, it will also be possible that there are no dependencies between command streams for the processing operations to be performed by the processing resources (for example, in the case where there are no different types of processing tasks to be run that have dependencies on each other). In this case, there will not be any need to use the progress wait command in the manner of the present invention, and for example, it will be possible to prepare and run only a single command stream (if desired).
[0203] The present invention can be used for all forms of output that the processing resources of a data processing system can be used to generate. For example, in the case of graphics processing, a graphics processor can generate frames for display, render to texture output, etc. The output data values from the processing are preferably output to external (e.g., main) memory for storage, and (such as in the case of graphics processing) a frame buffer for a display.
[0204] In some embodiments, the data processing system includes and / or communicates with one or more memories and / or storage devices that store the data described herein and / or store software for performing the processes described herein. The data processing system may also include or communicate with a display for displaying images based on data generated by the data processing system.
[0205] The present invention is applicable to any suitable form or configuration of processor or data processing system. It is particularly applicable to block-based graphics processors and graphics processing systems. Thus, in a preferred embodiment, the data processing system and the processing resource are block-based graphics processing systems and processors, respectively.
[0206] In a particularly preferred embodiment, the various functions of the present invention are executed on a single data processing platform that generates and outputs data.
[0207] The invention may be implemented in any suitable system, such as a suitably configured microprocessor-based system. In a preferred embodiment, the invention is implemented in a computer and / or microprocessor-based system.
[0208] The various functions of the present invention can be operated in any desired and suitable manner. For example, the functions of the present invention can be implemented in hardware or software (as desired). Thus, for example, unless otherwise indicated, the various functional elements, stages, and "devices" of the technology described herein may include suitable processors, controllers, functional units, circuits, processing logic, microprocessor structures, etc., which are operable to perform various functions, etc., such as appropriate dedicated hardware elements and / or programmable hardware elements that can be programmed to operate in a desired manner.
[0209] It should also be noted here that, as will be appreciated by those skilled in the art, the various functions of the present invention etc. may be repeated and / or run in parallel on a given processor. Equally, the various processing stages may share processing circuitry etc. (if desired).
[0210] Subject to any hardware necessary to run the specific functions discussed above, the data processing system and pipeline may otherwise include any one or more or all of the usual functional units and the like that data processing systems and pipelines include.
[0211] It will also be appreciated by those skilled in the art that all described aspects and embodiments of the present invention may (and preferably do) include any one or more or all of the preferred and optional features described herein, as appropriate.
[0212] The method according to the invention may be implemented at least in part using software (e.g., a computer program). It will be seen from this that when viewed from another aspect, the invention provides computer software that is specifically adapted to run the method described herein when installed on a data processing device; a computer program element that includes a computer software code portion for executing the method described herein when the program element is running on a data processing device; and a computer program that includes code means that are adapted to execute all steps of the method described herein when the program is running on a data processing system. The data processor may be a microprocessor system, a programmable FPGA (field programmable gate array), or the like.
[0213] The invention also extends to a computer software carrier comprising such software which, when used to operate a processor, in combination with said data processor causes said processor, renderer or microprocessor system to run the steps of the method of the invention. Such a computer software carrier may be a physical storage medium such as a ROM chip, CD ROM, RAM, flash memory, or disk, or may be a signal such as an electrical signal on a wire, an optical signal such as to a satellite or a radio signal, etc.
[0214] It will also be appreciated that not all steps of the method of the invention need to be executed by computer software, thus according to a broader aspect the invention provides computer software and such software is installed on a computer software carrier for executing at least one of the steps of the method set out herein.
[0215] The present invention may therefore be suitably embodied as a computer program product for use with a computer system. Such an implementation may include a series of computer-readable instructions fixed on a tangible, permanent medium, such as a computer-readable medium, for example, a disk, CD-ROM, ROM, RAM, flash memory, or hard disk. A series of computer-readable instructions may also be included, which may be sent to a computer system via a modem or other interface device on a tangible medium (including but not limited to, optical or analog communication lines), or intangibly using wireless technology (including but not limited to, microwave, infrared or other transmission technology). The series of computer-readable instructions implements all or part of the functions previously described herein.
[0216] Those skilled in the art will appreciate that such computer readable instructions may be written in a variety of programming languages for use with many computer architectures or operating systems. Further, such instructions may be stored using any storage technology (storage technology now or in the future includes but is not limited to semiconductor, magnetic or optical), or sent using any communication technology (communication technology now or in the future includes but is not limited to optical, infrared or microwave). It is contemplated that such computer program products may be distributed as removable media, with printed or electronic documentation, e.g., off-the-shelf software; preloaded with a computer system, e.g., on a system ROM or fixed disk; or distributed over a network (e.g., the Internet or the World Wide Web) from a server or bulletin board. BRIEF DESCRIPTION OF THE DRAWINGS
[0217] Several preferred embodiments of the present invention will now be described, by way of example only, and with reference to the accompanying drawings, in which:
[0218] Figure 1 An exemplary graphics processing system is shown;
[0219] Figure 2 A graphics processor that may be operated in the manner of the present invention is schematically illustrated;
[0220] Figure 3 schematically illustrates a command flow for execution by a graphics processor;
[0221] Figure 4 , Figure 5 as well as Figure 6 Schematically illustrates the preparation of a command stream for execution by a graphics processor in an embodiment of the present invention;
[0222] Figure 7 shows an exemplary command flow prepared in an embodiment of the present invention;
[0223] Figure 8 and Fig. 9 schematically illustrates the execution of a command stream by a graphics processor in an embodiment of the present invention; and
[0224] Fig.10 and Fig.11 The diagram schematically shows the execution of a command stream by a graphics processor in another embodiment of the present invention.
[0225] Like reference numerals are used for like parts in the drawings where appropriate. DETAILED DESCRIPTION
[0226] Various embodiments of the present invention will now be described in the context of processing computer graphics for display. However, it will be appreciated that the techniques described herein for synchronizing the execution of processing tasks may also be used in non-graphics contexts.
[0227] Figure 1 An exemplary graphics processing system is shown. An application 2 (such as a game) running on a host processor 1 will require graphics processing operations to be performed by an associated graphics processing unit (graphics processor) 3. To do this, the application will generate API (application programming interface) calls that are interpreted by a driver 4 of the graphics processor 3, which runs on the host processor 1, to generate appropriate commands to the graphics processor 3 to generate the graphics output required by the application 2. To facilitate this, a set of "commands" will be provided to the graphics processor 3 in response to commands from an application 2 running on the host system 1 for graphics output (e.g., to generate a frame to be displayed).
[0228] In the present embodiment, appropriate commands and data for executing the processing tasks required by application 2 are provided to graphics processor 3 in the form of one or more command streams, each command stream comprising a sequence of commands (instructions) that cause the graphics processor to perform the desired processing tasks.
[0229] The command streams are prepared by the driver 4 on the host processor 1 and may be stored, for example, in appropriate command stream buffers from which they may then be read for execution by the graphics processor 3. Each command stream will contain commands (instructions) to set parameters for a graphics processor task, commands (instructions) to execute the task, etc.
[0230] To facilitate this operation, the graphics processor 3 may Figure 2The illustrated system includes a command stream front end 20 including a command stream supervisor (controller) 21 (in the form of a microcontroller) operable to schedule and issue commands from command streams to various command stream execution units 22. The command stream execution units 22 then execute the commands in the various command streams to trigger a processing execution unit 23 of the graphics processor (shown as a plurality of shader cores in this example, but other structures would of course be possible) to perform the desired processing tasks.
[0231] The implementation of command stream preparation and execution in the manner of the present invention will now be described with particular reference to the processing of tessellation geometry on the graphics processor 3 .
[0232] In these embodiments, it is assumed that a normal graphics draw call (without tessellation) results in a single geometry task for the graphics processor 3. On the other hand, a draw call with tessellation will result in multiple (e.g., about 10) sequentially dependent computation tasks that generate tessellated geometry, followed by a single geometry task that processes the tessellated geometry thus generated. Since the geometry tasks must be run in the same order as the graphics API draw calls, there will typically also be sequential dependencies between them.
[0233] Figure 3 This is illustrated and both a chain 30 of geometry tasks from non-tessellation draw calls and a chain 31 of geometry tasks including tessellation draw calls are shown. In the latter case where there are tessellation draw calls it can be seen that in addition to the chain 31 of geometry tasks including tessellation geometry tasks 33 there will also be a corresponding chain 32 of tessellation calculation jobs that need to be completed before the tessellation geometry tasks 33.
[0234] In such a configuration where there is some tessellation processing to be done, then the tessellation calculation tasks 32 can simply be included in the overall geometry task chain 31 in the desired order. However, this may result in reduced throughput due to low loading on the graphics processor 3, as the tessellation geometry tasks typically do not have enough work items to fully utilize the graphics processor and can run for a long time.
[0235] This embodiment solves this problem by using the second command stream for the mosaic computing task and using the “progress wait” command to synchronize the execution of the two command streams.
[0236] Thus, in the present embodiment, when there is a possibility that tessellation will be required, the driver 4 prepares a geometry command stream for a geometry task of the graphics processor 3 and a separate calculation task command stream for a tessellation calculation task.
[0237] Each command stream has an associated progress counter that is used to track the position reached in the respective command stream. In the present embodiment, the progress counter is incremented when a "significant" command (such as a command that submits a task to the graphics processor and a command that determines the completion of a graphics processor task) is added to / completed in the command stream. The encoding of a "significant" command that increments the progress counter of a command stream includes a bit that indicates whether the progress counter is to be incremented.
[0238] Additionally, the driver may also include a "progress_wait" command in the command stream that causes execution of the command stream including the command to wait for another, different command stream. The progress wait command takes two parameters: the identity of the other command stream to wait for and the minimum value of the progress counter for the command stream to wait for (i.e., the position in the other command stream that must be reached before continuing to execute the command stream including the progress wait command). These progress wait commands facilitate synchronizing the execution of commands and processing tasks in different command streams as will be discussed further below.
[0239] Thus, in this embodiment, when the application needs to process a draw call without tessellation, the graphics processor driver 4 will add appropriate commands for the draw call to the geometry command stream, but when there is a draw call with tessellation, the driver 4 will add commands for the tessellation calculation task to the calculation task command stream, and add geometry processing for the draw call to the geometry command stream.
[0240] Figure 4 This is illustrated and shows that the driver 4 adds a draw call to the geometry command stream for a draw call without tessellation 40, but for a draw call with tessellation, adds a tessellation task to the compute task command stream and adds a draw call to the geometry command stream 41. (As shown in FIG. Figure 4 As shown, once the rendering pass of interest is completed, the generated command stream is submitted 42 to the graphics processor 3 for execution.)
[0241] In the absence of tessellated draw calls, the driver will simply add draw calls to the command stream while appropriately updating the progress counter for the geometry command stream. Figure 5 This is illustrated, and shows that when the driver receives a draw call from an application without tessellation (step 50), it will then add the appropriate command for the draw call to the geometry command stream (step 51), thereby simultaneously updating the progress counter for the geometry command stream (to keep track of where the driver has reached in that command stream) (step 52), and then return to the application (step 53) to await the next draw call.
[0242] In the case of a draw call with tessellation, as discussed above, the driver will add a tessellation calculation task to the calculation task command stream and a corresponding geometry processing task to the geometry command stream. Moreover, the driver will use the progress wait command in both command streams to synchronize the running of the tessellation calculation task in the geometry command stream and the independent tessellation geometry processing task.
[0243] Figure 6 is a flow chart showing this operation in more detail.
[0244] like Figure 6 As shown, when the driver receives a draw call with tessellation (step 60), it first adds a progress wait instruction to the compute task command stream, which indicates that the execution of subsequent commands in the command stream should wait until the graphics processor reaches a specific position in the geometry command stream (step 61). This will then cause the execution of subsequent tessellation compute tasks in the compute task command stream to be triggered (only) when the specific position in the geometry command stream is reached.
[0245] The specific position in the geometry command stream to wait for is determined to be a position in the geometry command stream a specific period of time before the current position in the geometry command stream (e.g., based on benchmarking) to trigger the running of the tessellation computation task long enough (but not too long) before the (tessellation) geometry task that will process the tessellation computation task (the dependent tessellation computation task). The position to wait for can be determined, for example, by subtracting a specific (e.g., predetermined) value from a progress counter value for the geometry command stream.
[0246] The driver then adds a command (instruction) to submit the mosaic computing task to the computing task command stream after the progress wait command, followed by a command (instruction) to wait for the mosaic computing task to be completed (step 62). The progress counter value (position) for the mosaic command stream is then updated to the expected count value when the mosaic task of interest is about to be completed (step 63).
[0247] The driver then adds a progress wait command to the geometry command stream so that the progress wait command waits for the tessellation compute task to complete before running the command in the geometry command stream following the progress wait command (step 64). In this case, the position (progress count) in the compute task (tessellation) command stream set for the progress wait command corresponds to the determined expected value of the progress counter for the compute task (tessellation) command stream when the tessellation compute task is completed (as determined in step 63).
[0248] This progress wait command in the geometry command stream will therefore ensure that the compute command stream tessellation computation tasks are completed before starting the tessellation geometry tasks.
[0249] The driver then adds instructions for geometry processing for the tessellation geometry task to the geometry command stream (step 65), thereby then updating the progress counter value for the geometry command stream (step 66), and returns to the application (step 67).
[0250] Figure 7 An exemplary geometry command stream 70 and computation command stream 71 so generated are shown.
[0251] Therefore, if Figure 7 As shown, the geometry command stream 70 includes a sequence of geometry processing tasks, but before the geometry processing task 72 for tessellation geometry, there is a progress wait command 73 that waits for the computation command stream 71 to reach a specific position (progress counter value) m.
[0252] Correspondingly, the computing task command stream 71 includes a progress wait command 75 before the tessellation computing task 74 that will generate the tessellation geometry. The progress wait command will operate to trigger the start of the tessellation computing task 74 when the geometry command stream 70 reaches the progress count n+1 before the tessellation geometry task 72.
[0253] This will then allow tessellation calculation tasks 74 to run in parallel with other geometry work on the graphics processor ahead of tessellation geometry tasks 72 that require the results of these tessellation calculation tasks 74, thereby facilitating a higher load on the graphics processor 3. Furthermore, using the progress wait command in this way means that no additional driver overhead is added if tessellation is not used.
[0254] Once the command stream is prepared, it is provided to the graphics processor 3 for execution. This may be done in any suitable and desired manner. For example, the driver 4 may build a command stream buffer which is then called from a circular command buffer (ring buffer), the graphics processor executing the hardware then executing the circular command buffer following a call to the command stream buffer. Other structures would of course be possible.
[0255] When executing the command stream, the supervisory microcontroller 21 handles the scheduling of the command stream on the hardware execution resources (shader cores) 23 of the graphics processor 3.
[0256] In this embodiment, execution of the geometry task and compute task command streams begins simultaneously, with the graphics processor executing the commands in each command stream sequentially (and according to appropriate scheduling between commands and tasks of different command streams, such as performed via the supervisory microcontroller 21, as appropriate).
[0257] While the command stream is being run, the progress count for the command stream of interest is automatically incremented according to the commands that are indicated to increment the progress count while the command stream is being run.
[0258] Figure 8 and Fig. 9The execution of the command flow in the first embodiment is shown in more detail.
[0259] like Figure 8 As shown, assuming that a plurality of command streams 81 prepared by the driver 4 are appropriately stored in the memory 80, the commands are read from the memory under the control of the supervisory microcontroller 21 and then executed by the respective command stream execution units 22 of the graphics processor 3.
[0260] In this case, in order to execute any progress waiting instructions in the command stream, such as Figure 8 As shown, each command stream execution unit 22 executing a command stream has a set of control and status registers 82, which include, among other things, a progress_counter_live value register 83 that acts as a progress counter for the command stream in question. This register is automatically incremented when a command stream command is executed that increments the progress count.
[0261] Each command stream execution unit 22 also maintains a separate progress_counter_compare register 84, which is used to store the value (position) of the progress count of the command stream of interest that another command stream is waiting for (if any), as will be discussed further below. When the progress_counter_live value is greater than or equal to the progress_counter_compare value, an interrupt is generated to the microcontroller 21 to indicate that the position (progress count) being waited for in the command stream has been reached.
[0262] Fig. 9 The operation in this embodiment is shown when the command stream execution unit encounters a progress wait command in the command stream.
[0263] like Fig. 9 As shown, when a progress wait command (instruction) is encountered in the command stream (step 90), the command stream is stopped and an interrupt is generated to the microcontroller 21. The microcontroller will receive the interrupt and identify the progress wait command (step 91), and then check whether the required progress count (position) has been reached in the command stream being waited for (step 92). If yes, the microcontroller will restart the command stream including the progress wait command (step 93). If not, the microcontroller 21 will therefore set the progress_counter_compare register for the command stream being waited for, and enable the interrupt when the wait position is encountered (step 94).
[0264] The microcontroller 21 will then return from the interrupt and will continue command flow execution for any command stream that is not currently pending.
[0265] Then, when the progress_counter_compare position (progress count) for the command stream being waited for is reached, an interrupt will be generated to the microcontroller 21, which will then operate to identify which progress wait command is now encountered, and therefore restart the command stream including the progress wait command (and return from the interrupt) at the next command (step 95).
[0266] Execution of the command stream will then continue until such time as another progress wait command is encountered.
[0267] This embodiment uses the supervisory microcontroller 21 to handle progress wait operations. This provides the advantage of allowing simpler hardware, but also provides the supervisory microcontroller 21 with information about when a command stream is waiting, thereby facilitating, for example, making better scheduling decisions for hardware execution resources.
[0268] The microcontroller may also be used to handle "exceptional" situations, such as when the command stream to be waited is not currently scheduled on the hardware execution resource (the command stream is not currently resident on the hardware execution resource). This may occur, for example, in a configuration where the hardware resources used to execute the command streams are only capable of simultaneously supporting the execution of fewer command streams than all will be able to execute. To allow for this possibility, the microcontroller 21 may be configured to also initially check whether the command stream to be waited is resident on the hardware execution resource 23 of the graphics processor (if desired).
[0269] The supervisory microcontroller 21 may also be used to handle the situation where more than one progress wait instruction (from different command streams) is waiting for the same command stream (in which case, for example, the microcontroller may and preferably does configure the progress counter compare value for the command stream being waited for to be the lowest value being waited for).
[0270] Fig.10 and Fig.11 The operation of the command flow in another embodiment is shown in more detail.
[0271] This embodiment provides a more complete hardware implementation for the progress counter and progress wait command mechanisms, thereby reducing the involvement of the microcontroller 21 in the progress counter and progress wait command operations (which may therefore, for example, reduce or avoid any delays that may be associated with such microcontroller 21 operations).
[0272] like Fig.10 As shown, in this embodiment, each command stream execution unit again maintains a set of control and status registers 82, which include, in particular, a progress_counter_live value register 83, which acts as a progress counter for the command stream of interest (and is again automatically increased when executing appropriate commands in the command stream of interest).
[0273] However, the progress_counter_compare register is not maintained for each command stream execution unit (for each command stream being executed). Fig.10 As shown, each command stream running on a hardware resource is marked with a (unique) identifier, which corresponds to an identifier to be used to identify the command stream in the progress waiting command, and the command stream identifier is stored in the command_stream_ID register 100 of the command stream execution unit concerned.
[0274] exist Fig.11 2 shows the operation of the command stream execution unit when it encounters a progress wait command in the command stream in this embodiment.
[0275] like Fig.11 As shown, when a progress wait command (instruction) is encountered in a command stream (step 110), it is first checked whether the command stream to be waited for (as indicated by the command stream ID in the progress wait command) matches the command stream ID stored for one (and only one) command stream currently running on the hardware execution resource (currently present in the command stream execution unit) (step 111). This check allows to determine whether the command stream being waited for is currently resident on the hardware execution resource (and whether some other fault such as two command streams resident on the hardware execution resource both having the same ID exist).
[0276] If there is no match to the identity of a command stream resident on a hardware execution resource, this indicates that the command stream being waited for is not currently executing. Fig.11 As shown, the execution of the command stream including the progress wait command is stopped, and an interrupt is generated to the microcontroller 21, so that the microcontroller 21 then handles the situation that the waited command stream is not currently executed (step 112).
[0277] On the other hand, if there is a match with the command stream currently running on the hardware execution resource (i.e., the command stream to be waited is currently running on the hardware execution resource), then the processing operation is to check whether the progress counter value to be waited for the other command stream (as indicated in the progress wait command) is less than or equal to the current progress_counter_live value of the identified command stream (step 113). If so, the execution of the command stream including the progress wait command is continued (step 114).
[0278] On the other hand, if the progress counter value to be waited for for the other command stream (as indicated in the progress wait command) is not less than or equal to (in addition to being less than or equal to) the current progress_counter_live value of the identified command stream, then the execution of the command stream including the progress wait command is stopped (step 115).
[0279] like Fig.11 As shown, at this point, an interrupt may be generated to the supervisory microcontroller 21 to indicate that the command stream including the progress wait command is currently blocked (waiting). This may assist the microcontroller 21 when scheduling the command stream to run (e.g., allowing it to reschedule hardware running resources when necessary). The conditions for causing the interrupt may, for example, take into account whether it is the first attempt to progress the wait command or whether the progress wait command has been retried (e.g., to generate an interrupt only when the progress wait command is attempted for the first time).
[0280] The progress waiting command is then scheduled to be retried when an event occurs to update the progress_counter_live register of the waiting command stream (or any command stream) (and optionally, when the command stream ID register of any command stream execution unit is updated (thereby indicating that there is a change in the command stream resident on the hardware execution resource)), (step 116).
[0281] When the appropriate "retry" event occurs, the progress wait command is retried, so the process returns 117 to step 113 to check again whether the progress wait command to be waited for is less than or equal to the progress_counter_live value of the command stream being waited for.
[0282] In this embodiment, the microcontroller 21 can only be involved in the processing when the command stream to be waited for is not resident on the hardware execution resource or when there is a pending command stream that runs when the command stream is blocked. Therefore, this will provide a faster path for both the increment of the progress counter and the waiting progress counter.
[0283] Although the present invention has been described above with particular reference to the performance of tessellation in a graphics processing system, the techniques of the present invention may be equally used in other graphics processing operations (such as interleaved rendering and when using wizard shaders) and in non-graphics processing structures (as desired).
[0284] As can be seen from the above, the present invention, at least in its preferred embodiment, provides a mechanism for more efficiently handling dependencies between different processing tasks and in a manner that should not significantly increase the command stream preparation overhead. This is achieved, at least in the preferred embodiment of the present invention, by preparing multiple command streams, for example, related to different types of processing tasks, and using appropriately configured wait commands to synchronize the execution of tasks in different command streams.
Claims
1. A method of operating a data processing system, the data processing system include: a main processor configured to run an application of the data processing system; and a processing resource configured to perform processing tasks of an application running on the host processor; The method comprises the following steps: In response to a request from an application for a process to be performed by the processing resource, preparing on the host processor a plurality of command streams that cause the processing resource to perform a processing task of the application, each command stream comprising a sequence of commands that cause the processing resource to perform a processing task; The step of preparing the command stream includes: In response to a processing task to be added to a first command stream among the plurality of command streams having a dependency relationship with a processing task to be included in a second command stream which is another command stream among the plurality of command streams: including a wait command in the first command stream, the wait command causing the processing resource to delay executing subsequent commands in the first command stream until the processing resource reaches a specific position in the second command stream; The method further comprises the following steps: The host processor provides the plurality of command streams to the processing resources; and The processing resource executes commands in the plurality of command streams to execute processing tasks of the application; The step of executing commands in the plurality of command streams by the processing resource comprises: In response to the wait command included in the first command stream, the processing resource does not execute subsequent commands in the first command stream until the processing resource reaches the specific position in the second command stream; and In response to the processing resource reaching the specific position in the second command stream, the processing resource executes a subsequent command in the first command stream following the wait command in the first command stream.
2. The method according to claim 1, wherein One of the first command stream and the second command stream is a command stream related to a processing task that more fully utilizes one of the processing resources when executed; and The other of the first command stream and the second command stream is a command stream related to a processing task that less fully utilizes one of the processing resources when executed.
3. The method according to claim 1, in, The processing resource is a graphics processor; One of the first command stream and the second command stream is a command stream related to a computing task of the graphics processor; and The other of the first command stream and the second command stream is a command stream related to a non-computing task of the graphics processor.
4. The method according to claim 3, in, The computational tasks include computational tasks to perform tessellation, and the non-computational tasks include graphics geometry processing tasks.
5. The method according to any one of claims 1 to 4, wherein The following steps are involved: using a progress counter associated with the command stream to track a position reached along the command stream while preparing the command stream; and / or A progress counter associated with a command stream is used while the command stream is running to track the position reached along the command stream.
6. The method according to claim 5, wherein The following steps are involved: The progress counter for a command stream is incremented only when a particular command is added or executed for the command stream.
7. The method according to any one of claims 1 to 4, wherein The following steps are involved: In response to a processing task to be added to the first of the plurality of command streams having a dependency relationship with a processing task to be included in the second of the plurality of command streams, the main processor: In the second command stream, before the command of the processing task in the second command stream that has a dependency relationship with the processing task in the first command stream, a wait command is also included to trigger the execution of the processing task in the second command stream once the processing resources reach a specific position in the first command stream.
8. The method according to claim 7, in, For the wait command in the second command stream, the specific position in the first command stream is a position in the first command stream before one or more processing tasks having a dependency relationship with the processing tasks in the second command stream.
9. The method according to any one of claims 1 to 4, in, The processing resources include: a plurality of command stream execution units configured to execute commands in the command stream to perform processing tasks of the application; and A controller configured to control the execution of the command stream by the command stream execution unit; The method further comprises the following steps: Each command stream execution unit maintains a record of the position currently reached in the command stream being executed, and a record of the position in the command stream where another command stream is waiting; A command flow execution unit among the plurality of command flow execution units executes the first command flow; and When the command stream execution unit encounters the wait command in the first command stream, the command stream execution unit notifies the controller; and The controller responds to the notification from the command flow execution unit: Identify that the command flow execution unit encounters a wait command; According to the waiting command, identifying that the execution of the first command stream is waiting for the second command stream, and the specific position in the second command stream to be reached when the execution of the first command stream continues; determining whether the specific position in the second command stream has been reached; and When the specific position in the second command stream is reached, the command stream execution unit is notified to continue executing the commands in the first command stream.
10. The method according to claim 9, further comprising: The following steps are involved: When the controller has not yet reached the specific position in the second command stream: For the second command stream, setting a record of the specific position in the second command stream to be reached in order to continue executing the first command stream; and configuring the command stream execution unit that is executing the second command stream to notify the controller when reaching the specific position in the second command stream; The method further comprises the following steps: The command stream execution unit for the second command stream notifies the controller when reaching the specific position in the execution of the second command stream; and In response to the notification, the controller recognizes that arrival at the specific position in the second command stream is for the wait command in the first command stream, and notifies the command stream execution unit for the first command stream to resume execution of the first command stream.
11. The method according to any one of claims 1 to 4, in, The processing resources include: a plurality of command stream execution units configured to execute commands in the command stream to perform processing tasks of the application; and A controller configured to control the execution of the command stream by the command stream execution unit; The method further comprises the following steps: Each command stream execution unit maintains a record of the current position reached in the command stream being executed; A command flow execution unit among the plurality of command flow execution units executes the first command flow; and When the command stream execution unit encounters the waiting command in the first command stream, the command stream execution unit: According to the waiting command, identifying that the execution of the first command stream is waiting for the second command stream, and the specific position in the second command stream to be reached when the execution of the first command stream continues; determining whether the specific position in the second command stream has been reached according to a record of the position currently reached in the command stream maintained by the command stream execution unit that is executing the second command stream; and When the specific position in the second command stream has been reached, continue to execute the commands in the first command stream; but When the specific position in the second command stream has not been reached, the execution of the first command stream is stopped until the specific position in the second command stream is reached.
12. The method according to claim 11, further comprising: The following steps are involved: When it is determined that the specific position in the second command stream has not been reached according to the record of the position currently reached in the command stream maintained by the command stream execution unit that is executing the second command stream, the command stream execution unit that encounters the waiting command in the first command stream: The controller configured to control the execution of the command stream by the command stream execution unit is notified that the execution of the first command stream has stopped.
13. The method according to claim 11, further comprising: The following steps are involved: The command stream execution unit encounters the waiting command in the first command stream before reaching the specific position in the second command stream: In response to a specific event occurring, a retry is performed to determine whether the specific position in the second command stream is reached based on a record of the current position reached in the command stream maintained by the command stream execution unit that is executing the second command stream.
14. The method according to any one of claims 1 to 4, in, The processing resource is a graphics processor.
15. A main processor for a data processing system, the main processor being configured to run an application of the data processing system, and include: a command stream generation circuit configured to, in response to a request from an application for a process to be performed by a processing resource of the data processing system, prepare a plurality of command streams that cause the processing resource to perform a processing task of the application, each command stream comprising a sequence of commands that cause the processing resource to perform a processing task; Wherein, the command stream generating circuit is further configured as follows: In response to a processing task to be added to a first command stream among the plurality of command streams having a dependency relationship with a processing task to be included in a second command stream which is another command stream among the plurality of command streams: including a wait command in the first command stream, the wait command causing the processing resource to delay executing subsequent commands in the first command stream until the processing resource reaches a specific position in the second command stream; The main processor also includes: A processing circuit is configured to provide the plurality of command streams to the processing resource.
16. The main processor according to claim 15, in, One of the first command stream and the second command stream is a command stream related to a processing task that more fully utilizes one of the processing resources when executed; and The other of the first command stream and the second command stream is a command stream related to a processing task that less fully utilizes one of the processing resources when executed.
17. The main processor according to claim 15, in, The processing resource is a graphics processor; One of the first command stream and the second command stream is a command stream related to a computing task of the graphics processor; and The other of the first command stream and the second command stream is a command stream related to a non-computing task of the graphics processor.
18. A main processor according to any one of claims 15 to 17, in, The wait command indicates both that it is the second command stream to be waited for and a specific position in the second command stream to be waited for.
19. A main processor according to any one of claims 15 to 17, in, The command stream generation circuit is configured to: In response to a processing task to be added to the first command stream among the plurality of command streams having a dependency relationship with a processing task to be included in the second command stream among the plurality of command streams: In the second command stream, before the command of the processing task in the second command stream that has a dependency relationship with the processing task in the first command stream, a wait command is also included to trigger the execution of the processing task in the second command stream once the processing resources reach a specific position in the first command stream.
20. A processing resource for a data processing system, the processing resource being configured to execute processing tasks of an application, the application running on a main processor of the data processing system, and the processing resource include: an execution circuit configured to execute commands in a plurality of command streams received from a main processor to execute processing tasks of an application running on the main processor, each command stream comprising a sequence of commands for causing the processing resource to execute processing tasks; Wherein, the operating circuit is configured as follows: In response to a first command stream among the plurality of command streams including a wait command, not executing subsequent commands in the first command stream after the wait command in the first command stream until the processing resource reaches a specific position indicated by the wait command in a second command stream as another command stream among the plurality of command streams, wherein the wait command will cause the processing resource to delay execution of subsequent commands in the first command stream until the processing resource reaches the specific position in the second command stream; and: In response to the processing resource reaching the specific position in the second command stream for the wait command, executing a subsequent command in the first command stream following the wait command in the first command stream.
21. The processing resource of claim 20, include: A progress tracking circuit is configured to track a position reached along a command stream while executing the command stream using a progress counter associated with the command stream.
22. A processing resource according to any one of claims 20 to 21, in, The operating circuit comprises: a plurality of command stream execution units configured to execute commands in the command stream to perform processing tasks of the application; and A controller, the controller being configured to control the command stream execution unit to execute the command stream; Each command flow execution unit is configured as: maintaining, for a command stream being run, a record of a position currently reached in the command stream, and a record of a position in the command stream at which another command stream is waiting; and A command flow execution unit among the plurality of command flow execution units is configured to, when executing the first command flow: When encountering the wait command in the first command stream, notifying the controller; and The controller is configured to: In response to the notification from the command flow execution unit: Identify that the command stream execution unit encounters the wait command in the first command stream; According to the waiting command, identifying that the execution of the first command stream is waiting for the second command stream, and the specific position in the second command stream to be reached when the execution of the first command stream continues; determining whether the specific position in the second command stream has been reached; and When the specific position in the second command stream is reached, the command stream execution unit is notified to continue executing the commands in the first command stream.
23. The processing resource of claim 22, in, The controller is configured to, when the specific position in the second command stream has not been reached: For the second command stream, setting a record of the specific position in the second command stream to be reached in order to continue executing the first command stream; and configuring the command stream execution unit that is executing the second command stream to notify the controller when reaching the specific position in the second command stream; And the controller is also configured to: In response to the notification, it is recognized that the arrival of the specific position in the second command stream is for the waiting command in the first command stream, and the command stream execution unit for the first command stream is notified to resume execution of the first command stream.
24. A processing resource according to any one of claims 20 to 21, in, The operating circuit comprises: a plurality of command stream execution units configured to execute commands in the command stream to perform processing tasks of the application; and A controller configured to control the execution of the command stream by the command stream execution unit; Each command flow execution unit is also configured as: maintaining, for a running command stream, a record of the position currently reached in said command stream; executing the first command stream; and When encountering a wait command in the first command stream: According to the waiting command, identifying that the execution of the first command stream is waiting for the second command stream, and the specific position in the second command stream to be reached when the execution of the first command stream continues; determining whether the specific position in the second command stream has been reached based on the record of the position currently reached in the command stream maintained by the command stream execution unit that is executing the second command stream; and When the specific position in the second command stream has been reached, continue to execute the commands in the first command stream; but When the specific position in the second command stream has not been reached, the execution of the first command stream is stopped until the specific position in the second command stream is reached.
25. The processing resource of claim 24, in, Each command flow execution unit can also operate to: When encountering a waiting command in the first command stream and determining that the specific position in the second command stream has not been reached based on the record of the current position reached in the command stream maintained by the command stream execution unit that is executing the second command stream: The controller configured to control the execution of the command stream by the command stream execution unit is notified that the execution of the first command stream has stopped.
26. The processing resource of claim 24, in, Each command flow execution unit can also operate to: When a waiting command in the first command stream is encountered and the specific position in the second command stream has not yet been reached: In response to occurrence of a specific event, a retry is performed to determine whether the specific position in the second command stream is reached based on the record of the current position reached in the command stream maintained by the command stream execution unit that is executing the second command stream.
27. The processing resource of claim 20, in, The processing resource is a graphics processor.
28. A data processing system, the data processing system include: A main processor according to any one of claims 15 to 17; and A processing resource as claimed in claim 20, 21 or 27.
29. A driver for a processing resource of a data processing system, the processing resource being operable to perform processing tasks of applications running on a main processor of the data processing system, the driver being operable to: In response to a request from an application for a process to be performed by the processing resource, preparing a plurality of command streams that cause the processing resource to perform a processing task of the application, each command stream comprising a sequence of commands that cause the processing resource to perform a processing task; in, The process of preparing the command stream includes: In response to a processing task to be added to a first command stream among the plurality of command streams having a dependency relationship with a processing task to be included in a second command stream which is another command stream among the plurality of command streams: A wait command is included in the first command stream, and the wait command will cause the processing resource to delay executing subsequent commands in the first command stream until the processing resource reaches a specific position in the second command stream.
30. A computer-readable storage medium storing a computer program which, when executed on a data processing device, performs the method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Graphics processing
US9189881B2
Gpu pipeline multiple level synchronization controller processor and method
CN1983326A
Data processing
GB2544994A
