The described embodiments relate generally to graph streaming processing. More particularly, the described embodiments relate to methods, apparatuses and systems for cascading graph streaming processors.
The onset of computation heavy applications is causing a paradigm shift from centralized computing to parallel and distributed computing. Parallel computing includes distributing computing jobs to the various computing resources. These resources include several central processing units (CPU), memory, storage, and support for networking.
Centralized computing works well in many applications, but falls short in the execution of computation rich applications, which are increasingly popular. Programs can be executed in a serial fashion or distributed to be executed on multiple processors. When programs are executed in a serial fashion, only one processor can be utilized and hence the throughput is limited to the speed of the processor. Such systems with one processor are adequate for many applications but not for compute intensive applications. Code can be executed in parallel in multi-processor systems leading to higher throughput. Multi-processor systems entail breaking of code into smaller code blocks and efficiently managing the execution of code. In order for the processors to execute in parallel, data to each of the processors has to be independent. Instances of a same code block can be executed on several processors simultaneously to improve the throughput.
It is desirable to have a method, apparatus and system for improved graph stream processing.
One embodiment includes a cascade of graph streaming processors. The cascade of graph streaming processors includes a plurality of graph streaming processors, wherein each of the graph streaming processor includes a processor array and a thread manager. The thread manager includes a plurality of stages and a plurality of command buffers located between each of the plurality of stages, wherein each stage includes physical hardware operative to schedule each of a plurality of threads of the stage, including an input command buffer parser operative to interpret commands within a corresponding input command buffer and generate the plurality of threads. The cascade of graph streaming processors further includes one or more shared command buffers located between each of the plurality of graph streaming processors, wherein each shared command buffer includes a buffer address, a write pointer, and a read pointer, wherein for each of the shared command buffers a first graph streaming processor of the plurality of graph streaming processors operates to write commands to the shared command buffer as indicated by the write pointer of the shared command buffer and a second graph streaming processor of the plurality of graph streaming processors operates to read commands from the shared command buffer as indicated by the read pointer by interpreting commands of the shared command buffer by an input command buffer parser of a first stage of the second graph streaming processor. For each one of the shared command buffers, at least one graph streaming processor scheduler operates to manage the write pointer and the read pointer to avoid overwriting unused commands of the shared command buffer.
Another embodiment includes a method of graph processing. The method includes processing scheduling, by a thread manager of each of a plurality of graph streaming processors, a plurality of threads operating on an array of processors of the graph streaming processor. The scheduling includes interpreting, by an input command buffer parser of each stage of a plurality of physical hardware stages of the thread manager, commands within a corresponding input command buffer located between the stage and a previous stage, and generating the plurality of threads based on the interpreted commands. A shared command buffer is located between each of the plurality of graph streaming processors, wherein the shared command buffer includes a buffer address, a write pointer, and a read pointer. The method additionally includes writing, by a first graph streaming processor of the plurality of graph streaming processors, commands to a shared command buffer as indicated by the write pointer, reading, by a second graph streaming processor of the plurality of graph streaming processors, commands from the shared command buffer and indicated by the read pointer, comprising interpreting, by an input command buffer parser of a first physical hardware stage of a thread manager of the second graph streaming processor, commands within the shared command buffer, and managing the write pointer and the read pointer to avoid overwriting unused commands of the shared command buffer.
Other aspects and advantages of the described embodiments will become apparent from the following detailed description, taken in conjunction with the accompanying drawings, illustrating by way of example the principles of the described embodiments.
The described embodiments are embodied in methods, apparatuses and systems for cascading a plurality of GSPs (graph streaming processors). For an embodiment, a shared command buffer is located between at least two of the plurality of GSPs. For an embodiment, the plurality of GSPs includes a GSP scheduler for managing writing and reading commands to and from the shared command buffer. For an embodiment, the GSP scheduler operates to ensure that unprocessed write commands of the shared command buffer are not overwritten. Further, for an embodiment, a last stage of a first GSP writes the commands into the shared command buffer and a first stage of a second GSP reads the commands from the shared command buffer. For an embodiment, the first stage of the second GSP includes a physical piece of hardware in a thread manager of the second GSP which is responsible for scheduling the threads. For an embodiment, each stage includes an input command buffer parser, wherein the input command buffer parser generates the threads of the stage based upon commands of a command buffer located between the stage and the previous stage. That is, the first stage of the second GSP generates threads based on the commands of the shared command buffer located between the first stage of the second GSP and the last stage of the first GSP. The command buffers have commands written into them that provides parallel processing and trigger threads for later occurring stages.
Certain computation situations include computational demands that suggest that cascading of multiple GSPs is useful or desirable. For example, cascading of GSP helps in executing applications with a large number of physical stages. Further, cascading of GSPs can be useful for operating with self-scheduling of the processing by the GSPs without requiring much external software control when executing applications that are highly computationally intensive.
At least some embodiments of Graph Streaming Processor (GSP) architectures are designed for execution of an acyclic data flow graph in a streaming manner. For at least some embodiments, the acyclic flow graph includes connected nodes, wherein the nodes are connected by arcs. For an embodiment, the arcs between the nodes of the acyclic flow graph indicate the dependency between the nodes. For an embodiment, a node includes one or more threads operative on a plurality of processors.
A thread may be dependent on data generated by other threads of the same node, and/or data generated by threads of other nodes. For an embodiment, each node is processed at a depth (wherein the depth merely refers to the relative timing of one stage relative to another stage), which can be represented by an acyclic graph. For an acyclic graph as represented by the complex dependent graph of
For at least some embodiments of GSP, a thread scheduler is responsible for scheduling and management of all the threads and tasks running in an execution core of the GSP.
For an embodiment, a command buffer 120, 122, 124, 125 is located before, after, and between each of the stages 130, 132, 134, 135. For an embodiment, each command buffer 120, 122, 124, 125 consist of commands. As described, each stage writes the commands to the command buffer of the subsequent stage.
For an embodiment, for the stage-0, processing on a host (for example, a host central processing unit (CPU)) populates the command buffer-0 and initiates the processing. For an embodiment, the stage-0 (130) starts scheduling the threads by parsing the commands of the command buffer-0 (120) (for node-00 and node-01 in the example), as the threads are processed by the graph streaming processor, if the dependencies are met, stage-0 writes the commands to its output command buffer i.e. command buffer-1. The Stage-1 then begins parsing the command buffer-1 (122) and the execution continues in a pipelined manner. The streams of a stage commence after the completion of at least one thread of the previous stage, and complete at least one thread before the next stage. Accordingly, for at least some embodiments, multiple stages are simultaneously processing threads of the stage. However, streams of a stage can commence and complete at different times within the stage.
For at least some embodiments, a stage of the graph stream processing includes a physical piece of hardware in a thread manager which is responsible for scheduling the threads corresponding to the node(s) at a particular depth (as determined by timing of the stage relative to other stages) in the graph. For an embodiment, the stage includes an input command buffer parser, wherein the command buffer parser generates the threads of the stage based upon commands of a command buffer located between the stage and the previous stage. For an embodiment, the input command buffer parser is implemented in hardware, and threads of the stage operate on a plurality of thread processors, and a command buffer is located between each stage.
For an embodiment, a thread can only be dependent on threads of an earlier stage, or threads of the same stage that have been dispatched earlier. For an embodiment, a thread cannot be dependent on a thread of the same stage that starts later.
As described, for an embodiment, a thread includes a set of instructions operating on input data and producing output data. A node can include multiple threads wherein all threads run the same set of instructions but operate on different data. For an embodiment, the threads are executed on a plurality of thread processors.
As previously described, each stage includes an input command buffer parser, wherein the command buffer parser generates the threads of the stage based upon commands of a command buffer located between the stage and the previous stage. Further, a temporal relationship exists between threads of a common stage.
For an embodiment, the command state array consists of a pointer of the command buffer location until the position the top stage 210 (Stage-L in
As previously alluded to, there exist scenarios in which a single GSP may not be sufficient to process the whole graph as a single entity. The scenarios include, for example, the data flow graph requires more physical stages than the stages present in one GSP processor chip, and/or the computational power required is more than single GSP processor chip can offer.
The described embodiments that include a cascade of multiple GSPs offer more physical stages and more computational power enabling data streaming between the processors with no host software intervention, thereby avoid all the overhead involved in the work generation by the host software by splitting the graph and executing and synchronizing the subgraphs running on multiple GSP chips. In other words, cascading of GSPs extends the ability of self-scheduling of work not only between the stages of single GSP but also between multiple GSPs.
For an embodiment, each graph streaming processor 410, 420 operatives to process a plurality of threads of the plurality of thread processor arrays 415, 425, wherein processing of at least one of the threads is dependent upon processing of another of the plurality of threads. As previously described, each thread includes a set of instructions operating on the plurality of thread processor arrays 415, 425 and operating on a set of data and producing output data,
The graph streaming processors 410, 420 each include thread managers (also referred to as GSP Schedulers) 461, 463, wherein the thread managers 461, 463 operate to dispatch operation of the plurality of threads (T0, T1, T0′, T1′) of the plurality of thread processor arrays 415, 425.
For an embodiment, the thread managers 461, 463 include stages. That is, the thread manager 461 includes the stages 411, 412, 413, and the thread managers 463 include stages 421, 423. For an embodiment, each of the stages includes an interface to a command buffer of a previous stage to an input command buffer parser of the stages. That is, for example, the stage 412 includes an input command buffer parser 493 which is interfaced to a command buffer 419. In operation, commands are stored in the command buffer 419 by the stage 411. The input command buffer parser 493 of the stage 412 generates streams of the stage 412 based upon the commands stored in the command buffer 419. Further, for example, the stage 421 includes an input command buffer parser 494 which is interfaced to the shared command buffer 430. In operation, commands are stored in the shared command buffer 430 by the stage 413. The input command buffer parser 494 of the stage 421 generates streams of the stage 421 based upon the commands stored in the shared command buffer 430.
As previously described, for an embodiment, each stage (such as shown in stages 412, 415) of the graph streaming processor includes a physical piece of hardware in the GSP scheduler (thread manager) which is responsible for scheduling the threads. For an embodiment, each stage includes the input command buffer parser (such as, input command buffer parsers 493, 494) wherein the input command buffer parser generates the threads of the stage based upon commands of a command buffer located between the stage and the previous stage. The command buffers have command written into them that provides parallel processing and trigger threads for later occurring stages.
As previously described, the plurality of threads run on the plurality of thread processors of the processor arrays 415, 425. For an embodiment, scheduling of a thread on the thread processors by the GSP schedulers (thread managers) 461, 463 is based on availability of resources including a thread slot on a thread processor of the plurality of thread processors, adequate space in the register file, space in the output command buffer for writing the commands produced by the spawn instructions.
Further, as described, a compiler splits up an initial program into code-blocks to enable/optimize task parallelism of the processing. Each of these code-blocks is a set of instructions and along with its inputs and outputs, identifies a stage for which one or more threads can be run. The thread is a code-block which is scheduled for operation on the plurality of thread processors. As previously described, each thread is a physical instance of a set of instructions (kernel/program/code-block) running on a set of data and producing output data. A kernel/program can be a code block of a larger program. For an embodiment, the compiler program splits up the program into code-blocks at points where the vector-ness/width of the code changes to enable/optimize task parallelism. The vector-ness/width indicates the degree of parallel processing.
For an embodiment, a node/task is the code-block along with the inputs, outputs. A node can be split up into one or more threads with each thread running the same code-block but on different data and producing different data. More than one node can be included within a stage. A graph can provide a visual dependency relationship between the nodes. For an embodiment, a stage is a physical piece of hardware in the thread manager which is responsible for scheduling the threads corresponding to the node/s at a particular depth (relative timing of the nodes) in the graph. The stage includes an input command buffer parser. The node generates threads based on the commands in the command buffer.
For an embodiment, the threads running on the processors have instructions embedded by the compiler to spawn/create downstream threads. The execution of these instructions results in commands which are placed in the output command buffer of the stage which in turn becomes the input command buffer for the next (later) stage. That is, for example, the stage 411 of the thread manager 461 of the GSP-0 410 provides, for example, threads T0, T1 for processing on the processor array 415. During processing and execution of the threads T0, T1, commands are spawned from processing of the threads T0, T1 on the processors array 415 that are provided to and stored in the command buffer 419 of the GSP-0 410. The similar process occurs as the stage 413 of the GSP-0 410 provides threads to the processor array 415, wherein processing of these threads on the processors array 415 generate commands that are spawned during the processing of the provided threads which are stored in the shared command buffer 430. During the processing of the threads within the processor array 415, data is stored and retrieved to and from data buffer 471.
Further, the stage 421 of the thread manager 462 of the GSP-1 420 generates threads T0′, and T1′ for processing on the processor array 425 based on parsing of the commands stored in the shared command buffer 430. During processing and execution of the threads T0′, T1′, commands are spawned that are provided to and stored in the command buffer 422 of the GSP-1 420. During the processing of the threads within the processor array 425, data is stored and retrieved to and from data buffer 472.
For an embodiment, the locations of the command buffers between the stages and the hardware implementation of the stages allows for substantial performance advantages over software implementations of the command buffers and schedulers (stages).
As shown in
For an embodiment, the last stage 413 of the first GSP-0 (410) and the first stage 421 of the second GSP-1 (420) share the shared command buffer 430. For embodiments, the shared command buffer 430 can be physically located in memory of either of the GSPs 410, 420, but is located between the delineated stages 413, 421.
As previously described, for an embodiment, a thread scheduler of a GSP maintains a set of pointers to track the command buffer between two stages of the GSP. For an embodiment, these pointers are stored in memory in an array called a command state array. For an embodiment, the number of entries in command state array is equal to the number of stages present in the GSP processor. However, the cascaded plurality of GSPs of
For an embodiment, the GSP-0 (410) writes commands to the shared command buffer 430 as indicated by the write pointer of the shared command buffer 430 and the GSP-1 (420) reads commands from the shared command buffer 430 as indicated by the read pointer.
For an embodiment, for each one of the shared command buffers (such as, shared command buffer 430), at least one graph streaming processor scheduler operates to manage the write pointer and the read pointer to avoid overwriting unused commands of the shared command buffer. For example, the GSP-0 (410) and the GSP-1 (420) operates to manage the write pointer and the read pointer of the shared command buffer 430 respectively to avoid overwriting unused commands of the shared command buffer 430.
For an embodiment, the first graph streaming processor for example GSP 0 (410) operates to provide an indication to the second graph streaming processor for example GSP-1 (420), that commands have been written such that the write pointer has progressed over greater than a selected percentage of the shared command buffer. That is, the indication informs the second graph streaming processor the allocated space of shared command buffer has been written with commands over a selected percentage of the allocated space of the shared command buffer. For a specific embodiment, this includes determining when the first GSP write pointers moves more than a threshold amount (for example, a ¼th) of the size of the shared command buffer.
For an embodiment, the second graph streaming processor (for example GSP-1 (420)) reads the write pointer of the shared command buffer and determines how much of the shared command buffer the second graph streaming processor can read. That is, the second graph streaming processor reads the write pointer of the shared command buffer and determines how much of the shared command buffer the second graph streaming processor can process.
For an embodiment the first stage of the second GSP polls for previous stage's (in this case, the last stage of the first GSP) write pointer stored in the command state array, when the pointer is moved the second GSP starts parsing the commands and schedules the threads to the processor array. Once the first stage of the second GSP has parsed all the commands and scheduled threads, the polling for new write pointer begins again. To reduce the memory read bandwidth, the polling happens at regular timing intervals instead of continuous reads.
For an embodiment, when the command buffer appears full, the last stage of the first GSP polls for the read pointer in the command state array at regular intervals.
For an embodiment, the first graph streaming processor operates to read the read pointer of the shared command buffer when the write pointer matches a current read pointer of the first graph streaming processor, and the shared command buffer appears full.
For an embodiment, the second graph streaming processor dispatches threads based on parsing of the shared command buffer, wherein when the second graph streaming processor parses greater than a selected percentage of the shared command buffer, the second graph streaming processor updates the read pointer of the shared command buffer. For a specific embodiment, when the first stage of the second GSP parses ¼th of the command buffer and dispatches the threads, the second GSP updates the dispatch pointer in the command state array.
For an embodiment, updating the read pointer of the shared command buffer enables the first graph streaming processor to only overwrite commands that have been processed by the second graph streaming processor.
For an embodiment, the first graph streaming processor writes a terminal index command to the shared command buffer when the processing of the first graph streaming processor is complete. For an embodiment, the terminal index command provides a way for the first graph streaming processor to indicate completion of forwarding of all commands to the second graph streaming processor.
For an embodiment, the polling interval can be made configurable. For an embodiment, polling by the second Graph Streaming Processor GSP-1 is initiated when the input command buffer appears empty. For an embodiment, this polling continues until the write pointer is updated such that the input command buffer is not empty. For an embodiment, the frequency of polling is made configurable and should be not too frequent (which would create excess traffic) and not too infrequent (which would delay the processing).
For an embodiment, instead of polling, interrupt-based communication between the cascaded GSPs can be established for pointer synchronization. For an embodiment, an interrupt is generated from the first Graph Streaming Processor GSP-0 to the second Graph Streaming Processor GSP-1 every time the write pointer is updated in the command state array.
The stage-N (531) of the first GSP 510 generates the commands to be stored in a shared command buffer 530.
Further, as shown in
The stage 521 of the second GSP 520 generates and stores the commands to be stored in another command buffer that are used by the next stage of the GSP 520 that corresponds with the node N4 555 of the acyclic graph.
As previously described, for an embodiment, the managing of the at least one graph streaming processor scheduler includes providing an indication to the second graph streaming processor that enough commands have been written that the write pointer has progressed over greater than a selected percentage of the shared command buffer.
As previously described, an embodiment further includes reading, by the second graph streaming processor, the write pointer of the shared command buffer, and determining how much of the shared command buffer the second graph streaming processor can process.
As previously described, an embodiment further includes determining, by the second graph streaming processor, how many of all the commands from the read pointer to the write pointer within the shared command buffer the second graph streaming processor can process.
As previously described, an embodiment further includes dispatching, by the second graph streaming processor, threads based on parsing of the shared command buffer, wherein when the second graph streaming processor parses greater than a selected percentage of the shared command buffer, the second graph streaming processor updates the read pointer of the shared command buffer. For an embodiment, updating the read pointer of the shared command buffer enables the first graph streaming processor to only overwrite commands that have been processed by the second graph streaming processor.
As previously described, an embodiment further includes the first graph streaming processor operating to read the read pointer of the shared command buffer when the write pointer matches a current read pointer of the first graph streaming processor, and the shared command buffer appears full.
As previously described, an embodiment further includes writing, by the first graph streaming processor, a terminal index command to the shared command buffer when the processing of the first graph streaming processor is complete.
For an embodiment, each of the functional blocks 721, 723, 725, 727, 729, 735 are implemented in hardware utilizing digital logic gates. That is, the functional blocks are implemented with sequential and combinatorial logic to realize the functionality of the functional blocks 721, 723, 725, 727, 729, 735. As previously described, the implementation of these functional blocks in hardware provides substantial benefits over a software implementation of such functional blocks.
In summary, for at least some embodiments, each of the stages in the thread manager is responsible for scheduling threads for all the nodes at a particular depth (stage) in a corresponding graph. The scheduling is done by parsing an input command buffer which was written into by threads scheduled by the upstream (previous) stage. For an embodiment, the hardware management of the command buffer in each stage includes the forwarding of information required by every stage from the input command buffer to the output command buffer, allocation of the required amount of memory (for the output thread-spawn commands) in the output command buffer before scheduling a thread, clearing the allocated memory with dummy entries, writing the thread-spawn command/s initiated from the thread/s running on the thread processor/s into the output command buffer, and managing the write, completion and read pointers into the command buffers.
The write pointer of the command buffer moves during the clearing of the allocated memory with dummy entries before thread dispatch. The write pointer after the completion of the dummy entry writes becomes the future completion pointer for the next stage. The completion pointer is updated after thread completion but in an in-order fashion. That is, the completion pointer updates sequentially in the same temporal order as the dispatch.
As previously described, for an embodiment, each of the functional blocks 921, 923, 925, 927, 929, 935 are implemented in hardware utilizing digital logic gates. That is, the functional blocks are implemented with sequential and combinatorial logic to realize the functionality of the functional blocks 921, 923, 925, 927, 929, 935. As previously described, the implementation of these functional blocks in hardware provides substantial benefits over a software implementation of such functional blocks.
As previously described, in summary, for at least some embodiments, each of the stages in the thread manager is responsible for scheduling threads for all the nodes at a particular depth (stage) in a corresponding graph. The scheduling is done by parsing an input command buffer which was written into by threads scheduled by the upstream (previous) stage. For an embodiment, the hardware management of the command buffer in each stage includes the forwarding of information required by every stage from the input command buffer to the output command buffer, allocation of the required amount of memory (for the output thread-spawn commands) in the output command buffer before scheduling a thread, clearing the allocated memory with dummy entries, writing the thread-spawn command/s initiated from the thread/s running on the thread processor/s into the output command buffer, and managing the write, completion and read pointers into the command buffers.
As shown, each of the stages is executed sequentially in time, and threads of each of the stages which are producing data for a thread of a subsequent thread of a subsequent stage are completed before execution of the threads of the next (subsequent) stage. As shown, each of the stages includes one or more nodes, wherein each node includes one or more streams. For an embodiment, a stream includes a code-block operating on the one or more processors of the cascaded graph streaming processors. Further, as previously described, each stage of the cascaded graph streaming processors includes a physical piece of hardware in a thread manager which is responsible for scheduling the threads corresponding to the node/s at a particular depth (as determined by timing of the stage relative to other stages) in the graph. For an embodiment, the stage includes an input command buffer parser, wherein the input command buffer parser generates the threads of the stage based upon commands of a command buffer located between the stage and the previous stage. Further, as described, a node includes one or more code blocks that operate as the stream(s) when executed on the plurality of processors of the graph streaming processor.
As shown in
Although specific embodiments have been described and illustrated, the described embodiments are not to be limited to the specific forms or arrangements of parts so described and illustrated. The embodiments are limited only by the appended claims.
This patent application is a continuation-in-part (CIP) of U.S. patent application Ser. No. 16/270,766, filed Feb. 8, 2019, and this patent application is a continuation-in-part (CIP) of U.S. patent application Ser. No. 15/164,848, filed May 25, 2016, which claims priority to provisional patent application 62/166,507, filed May 26, 2015, which are all herein incorporated by reference.
Number | Date | Country | |
---|---|---|---|
62166507 | May 2015 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 16270766 | Feb 2019 | US |
Child | 16282464 | US | |
Parent | 15164848 | May 2016 | US |
Child | 16270766 | US |