Data-driven scheduler on multiple computing cores

Data-driven scheduling in multi-core processors optimizes thread execution by analyzing correlations to minimize memory access latency and improve efficiency through parallel execution of threads with higher memory reuse.

JP7554795B2Active Publication Date: 2024-09-20ADVANCED MICRO DEVICES INC +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
JP2022128766
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2015-12-28
Filing Date
2022-08-12
Publication Date
2024-09-20
Estimated Expiration
2036-09-20

AI Technical Summary

Technical Problem

Multi-core processors experience memory resource contention and increased memory access latency due to poor locality of reference between threads, leading to inefficient execution of threads that do not share sufficient memory resources.

Method used

Implement a data-driven scheduling method that analyzes thread correlations to optimize the execution of threads on multiple computational cores, minimizing evictions from shared caches and reducing memory access latency by scheduling threads that exhibit higher memory reuse together.

Benefits of technology

The data-driven scheduling approach enhances performance by reducing memory access latency and improving efficiency by executing threads with higher memory reuse in parallel, thereby optimizing the utilization of shared memory resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007554795000014
    Figure 0007554795000014
  • Figure 0007554795000012
    Figure 0007554795000012
  • Figure 0007554795000011
    Figure 0007554795000011
Patent Text Reader

Abstract

A method, device and system for data-driven scheduling of multiple computational cores of a processor are provided. The method executes a plurality of threads on a plurality of computing cores according to a default schedule, the plurality of threads are analyzed based on the execution to determine correlations among the plurality of threads, the method further generates a data-driven schedule based on the correlations, and executes the plurality of threads on the plurality of computing cores according to the data-driven schedule.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] (CROSS REFERENCE TO RELATED APPLICATIONS) This application claims priority to U.S. patent application Ser. No. 14 / 981,257, filed Dec. 28, 2015, which is incorporated by reference as if fully set forth herein.

[0002] The disclosed embodiments relate generally to processing devices, and more particularly to memory management in processors having multiple computational units. [Background technology]

[0003] Many modern microprocessors combine multiple processor cores into a single processor to form a multi-core processor. Multi-core processors benefit primarily by performing parallel computing. For example, a multi-core processor may take advantage of thread-level parallelism to run different programs, different threads, groups of threads, or waves of a single program on different parallel cores within the processor.

[0004] Graphics processing units (GPUs) can benefit from implementation as multi-core processors because various graphics processing tasks are particularly well suited to parallel processing. For example, three-dimensional (3D) projection can fall into a category of tasks called "fully parallel" or "embarrassingly parallel".

[0005] In a multi-core architecture, each core may have local memory, such as an L1 cache. However, for various reasons, such as reducing die size, some (or all) of the cores in a multi-core device may share memory, such as a shared L2 or last level (LLC) cache, other types of cache, or other levels in a cache or memory hierarchy. However, sharing memory can result in contention for memory resources between the cores. Summary of the Invention [Means for solving the problem]

[0006] Some embodiments provide a method for data-driven scheduling of multiple compute cores of a processor. A plurality of threads may be executed on the multiple compute cores according to a default schedule. The multiple threads may be analyzed based on the execution to determine correlations between the multiple threads. A data-driven schedule may be generated based on the correlations. The multiple threads may be executed on the multiple compute cores according to the data-driven schedule.

[0007] In some embodiments, a processor configured for data driven scheduling is provided. The processor comprises a plurality of computational cores and a memory shared by each computational core. The processor comprises a dispatch circuit configured to dispatch a plurality of threads for execution on the plurality of computational cores according to a default schedule. The processor comprises a correlation circuit configured to analyze the plurality of threads based on the execution and determine a correlation between the plurality of threads. The processor comprises a scheduling circuit configured to determine a data driven schedule based on the correlation. The dispatch circuit is configured to dispatch the plurality of threads for execution on the plurality of computational cores according to the data driven schedule.

[0008] In some embodiments, a system for memory management of a multi-core processor is provided. The system includes a processor. The processor includes a plurality of computational cores and a memory shared by each computational core. The processor includes a dispatch circuit configured to dispatch a plurality of threads for execution on the computational cores according to a default schedule. The processor includes a correlation circuit configured to analyze the plurality of threads based on the execution and determine a correlation between the plurality of threads. The processor includes a scheduling circuit configured to determine a data-driven schedule based on the correlation. The dispatch circuit is configured to dispatch the plurality of threads for execution on the plurality of computational cores according to the data-driven schedule.

[0009] A more detailed understanding may be had from the following description, given by way of example in conjunction with the accompanying drawings, in which: [Brief description of the drawings]

[0010] [Figure 1] FIG. 1 is a block diagram of an example device capable of implementing one or more disclosed embodiments. [Diagram 2] 4 is a flowchart illustrating an example method for scheduling a number of threads for execution on a number of cores of a multi-core processor. [Diagram 3] 5 is a flowchart illustrating another exemplary method for scheduling a number of threads for execution on a number of cores of a multi-core processor. [Figure 4] FIG. 1 is a block diagram illustrating an example system for implementing data-driven scheduling. [Diagram 5] 11 is a table showing an example of a state of a correlation array. [Figure 6] FIG. 2 is a block diagram illustrating another example system for implementing data-driven scheduling. [Figure 7] 11 is a table showing an example of another state of the correlation array. [Figure 8] FIG. 2 is a block diagram illustrating another example system for implementing data-driven scheduling. [Figure 9] 11 is a table showing an example of another state of the correlation array. [Figure 10] FIG. 2 is a block diagram illustrating another example system for implementing data-driven scheduling. [Figure 11] 11 is a table showing an example of another state of the correlation array. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0011] 1 is a block diagram of an example device 100 capable of implementing one or more disclosed embodiments. Device 100 may include, for example, a computer, a gaming device, a handheld device, a set-top box, a television, a mobile phone, or a tablet computer. Device 100 includes a processor 102, a memory 104, a storage 106, one or more input devices 108, and one or more output devices 110. Additionally, device 100 may optionally include an input driver 112 and an output driver 114. It will be understood that device 100 may include additional components not shown in FIG. 1.

[0012] The processor 102 may include a central processing unit (CPU), a graphics processing unit (GPU), a CPU and a GPU located on the same die, or one or more processor cores, each of which may be a CPU or GPU, a shader engine (SE), a compute unit (CU), or a single instruction, multiple data (SIMD) unit of a CPU or GPU. The memory 104 may be located on the same die as the processor 102 or may be located separately from the processor 102. The memory 104 may include volatile or non-volatile memory, such as, for example, random access memory (RAM), dynamic RAM, or cache. Each processor core may have local memory, such as a local L1 cache memory, and / or may share memory with one or more other cores, such as a shared L2 cache memory.

[0013] Storage 106 may include fixed or removable storage, such as, for example, a hard disk drive, a solid state drive, an optical disk, or a flash drive. Input devices 108 may include a keyboard, a keypad, a touch screen, a touch pad, a detector, a microphone, an accelerometer, a gyroscope, a biometric scanner, or a network connection (e.g., a wireless local area network card for transmitting and / or receiving wireless IEEE 802 signals). Output devices 110 may include a display, a speaker, a printer, a haptic feedback device, one or more lights, an antenna, or a network connection (e.g., a wireless local area network card for transmitting and / or receiving wireless IEEE 802 signals).

[0014] The input driver 112 communicates with the processor 102 and the input device 108, allowing the processor 102 to receive input from the input device 108. The output driver 114 communicates with the processor 102 and the output device 110, allowing the processor 102 to send output from the output device 110. It should be noted that the input driver 112 and the output driver 114 are optional components, and the device 100 operates the same in the absence of the input driver 112 and the output driver 114.

[0015] In a multi-core processor, starvation can occur when two (or more) cores that share a cache execute threads (or groups of threads, waves, or other types of instruction groups) in parallel (e.g., simultaneously or contemporaneously during overlapping time periods) that access significant amounts of different information from memory. The threads may access different information, for example, due to poor locality of reference between the threads. Locality of reference in this context may refer to the same information referenced by each thread.

[0016] In such a situation, data loaded into the shared cache by the execution of one thread may be evicted by data loaded into the shared cache by the execution of the other thread. This may depend on the number of memory accesses required by each thread and / or whether each thread accesses information that is different from the information accessed by the other thread. Such evictions may continue to come and go as the threads execute, and may result in a substantial and undesirable increase in memory access latency.

[0017] Therefore, it may be desirable to configure a multi-core processor to run threads that use more of the same information and / or that exhibit greater memory reuse in parallel on separate cores, if possible. Memory reuse in this context may mean that information is retrieved from memory by one thread and also used by another thread. In a scenario where one of these threads runs on one core and the other runs on another core, if the two cores share a cache, the information may be stored in a shared cache for access by both threads. Thus, for threads that are scheduled to run within a given time, it may be preferable to run the thread that exhibits more shared locality of reference in parallel, rather than running the other thread in parallel. This may have the advantage of reducing the number of evictions from the shared data cache, and therefore reducing memory access latency. For example, if many pixels use the same texture data and are processed by a GPU with many processing units, it may be more efficient to process pixels that share texture data in parallel, rather than serially, to gain the advantage of shared locality of reference.

[0018] 2 is a flow chart illustrating an example method 200 for scheduling a number (X) of threads to execute on a number (Y) of cores of a multi-core processor, where the Y cores share at least one memory, such as a shared L2 cache. Method 200 may be implemented using, for example, part or all of device 100. For example, a processor may correspond to processor 102 shown in FIG.

[0019] In step 210, the threads are analyzed, for example, by an analysis module of a multi-core processor, to determine the amount of memory reuse or "correlation" between threads. For example, if X=4 and Y=2, then the X threads may be analyzed to determine which pair of threads has the highest correlation between the threads. In another example, if X=8 and Y=4, then the X threads may be analyzed to determine which group of four threads has the highest correlation between the threads. These thread group correlations may be ranked, for example, by the analysis module. The analysis may be performed in any suitable manner, including examples described further herein.

[0020] In step 220, the threads are scheduled, for example by a scheduling module of a multi-core processor, such that the Y threads identified in step 210 as having the greatest correlation are scheduled to run in parallel on the Y cores. If X=2Y, then the remaining threads of the X threads may be scheduled to run in parallel on the Y cores. If X>2Y, then the remaining threads may be scheduled to run in parallel based on the greatest correlation between the threads.

[0021] It should be noted that different sets of Y threads may be scheduled for parallel execution based on the balance of correlations instead of threads. For example, in a situation where the Y threads identified in step 210 are to be executed in parallel as having the greatest correlation, the remaining threads may be executed in parallel with poorer correlation than a different selection of threads, and each of the Y sets of threads may be selected such that the correlation of both sets of Y threads is maximized.

[0022] In step 230, the X threads are executed on the Y cores scheduled in step 220. Because the X threads are executed on the Y cores in the subset with the best available correlation, eviction from shared memory (e.g., a shared L2 cache) can be minimized, helping to minimize memory access latency and improve performance.

[0023] However, it should be noted that method 200 may require analysis of X threads for correlation before executing these threads on Y cores, which may not be possible if, for example, X threads are not programmed to utilize correlation-based multi-core scheduling, etc. Therefore, it may be advantageous to dynamically determine the correlation.

[0024] 3 is a flow chart illustrating another example method 300 for scheduling X threads to execute on Y cores of a multi-core processor, where the Y cores share at least one memory, such as a shared L2 cache. In the method 300, the correlation is dynamically determined. The method 300 may be implemented using, for example, part or all of the device 100. For example, the processor may correspond to the processor 102 shown in FIG. 1.

[0025] In step 310, X threads are scheduled for execution on Y cores. In this step, the correlation between the X threads is unknown. Therefore, a default scheduling pattern, such as a "round robin" pattern, is used first. Thus, if X=4 and threads are T0, T1, T2, and T3, and Y=2 and cores are CU0 and CU1, then the round robin scheduling is T0=C0, T1=C1, T2=C0, T3=C1.

[0026] In step 320, X threads are executed on Y cores according to the current scheduling of the threads. Thus, if the scheduling follows the round robin pattern of step 310, threads T0 and T1 will execute in parallel on C0 and C1, followed by T2 and T3 on C0 and C1.

[0027] In step 330, the X threads are analyzed for correlation based on execution. The analysis of step 330 may actually be performed during execution in combination with step 320, or may be performed after execution on data collected during step 320. Correlation may be determined using any suitable technique, examples of which are described further herein.

[0028] In step 340, the X threads are scheduled for execution on the Y cores based on the correlations determined in step 330. In this step, the correlations between the X threads are known. Therefore, the default scheduling pattern is not used and the threads are scheduled according to the known correlations. In an example where X=4 and threads are T0, T1, T2, and T3, and Y=2 and cores are CU0 and CU1, in step 330, it may be determined that the highest correlation among various possible thread pairs is between T0 and T2. The correlation based scheduling is T0=C0, T2=C1, T1=C0, T3=C1. Since this scheduling is based on the correlation data generated by the analysis in step 330, such scheduling can be referred to as data-driven scheduling, and a device or combination of devices for implementing this scheduling can be referred to as a data-driven scheduler.

[0029] Alternatively, the data-driven scheduling may be based on maximized correlation in the execution of all threads. For example, if the correlation between T1 and T3 is particularly low, then executing these threads in parallel with the schedule T0=C0, T2=C1, T1=C0, T3=C1 will introduce memory access latency that offsets or negates the memory access latency reduction provided by executing T0 and T2 in parallel. To address this, the second (or third or fourth, etc.) highest correlation value among various possible thread pairs may be considered by the data-driven scheduler. In one example, the second highest correlation may be between T0 and T3. Using this pair to schedule the execution results in T0=C0, T3=C1, T1=C0, T2=C1. In an example where the low correlation between T1 and T3 offsets the highest correlation between T0 and T2, this new schedule may minimize memory access latency in the execution of all X threads. Note that this scheduling by itself may not provide the highest average correlation across all threads, and all possible combinations may be analyzed to determine the best average correlation and / or minimum memory access latency across all threads. However, a data-driven scheduler configured in this manner to maximize the correlation between all X threads may require additional circuitry and / or additional delays to implement.

[0030] In step 350, X threads are executed on Y cores according to the schedule. Thus, if the scheduling follows T0=C0, T2=C1, T1=C0, T3=C1, threads T0 and T2 are executed in parallel on C0 and C1, followed by T1 and T3 on C0 and C1.

[0031] Flow may return to step 330, for example, for further analysis of the running threads (e.g., analysis between memory accesses of the running threads). This allows for more dynamic control of execution scheduling. For example, in some embodiments, the scheduling may adjust the scheduling while the threads are running by context saving the currently running thread, scheduling the thread to a different core based on an updated schedule, and then restoring the context (e.g., if indicated by changing the correlation value).

[0032] 4 is a block diagram illustrating an example system 400 that implements data-driven scheduling. In one implementation, the system 400 may be a function of the processor 102. The system 400 includes a processing unit 410, a cache memory 420 shared by the processing unit 410, a data-driven scheduler 430, and a thread group dispatcher 440. In the example of the system 400, the processing unit 410 includes two cores (in this case, shader engines SE0 and SE1). The data-driven scheduler 430 includes a correlation array 450 and a decision unit 460 to determine a thread group level schedule. A group of threads grouped for parallel execution on a shader engine may be referred to as a thread group in this context.

[0033] Shader engines SE0 and SE1 may comprise, for example, a cluster of processing units within a graphics processor, although it should be noted that such a cluster may be referred to by terms other than "shader engine" in various architectures.

[0034] In this example, cache memory 420 is an L2 cache, but it should be noted that cache memory 420 may be any suitable level of cache memory or another shared memory shared by shader engines SE0 and SE1. Cache memory 420 is shared by shader engines SE0 and SE1.

[0035] A data-driven scheduler 430 schedules thread groups for execution on the processing units 410. A correlation array 450 calculates correlations between thread groups. A decision unit 460 decides which thread group to dispatch to a particular one of the processing units 410 at a particular time.

[0036] Before correlation data is available for scheduling, the data-driven scheduler 430 schedules thread groups for execution on the shader engines SE0 and SE1 using a default (e.g., non-data-driven) scheduling pattern. This default pattern may be a round-robin pattern. In the exemplary system 400, scheduling is performed at a granularity of four thread groups. Thus, if the first four thread groups are called TG0, TG1, TG2, and TG3, the scheduling of the first four thread groups in a round-robin manner is TG0=SE0, TG1=SE1, TG2=SE0, TG3=SE1. The thread group dispatcher 440 then dispatches the thread groups for execution on SE0 and SE1 according to the default schedule.

[0037] In response to a new memory request from SE0 and / or SE1 to cache 420, cache 420 may forward an index and a cache tag corresponding to the memory request to correlation array 450. The index may correspond to an identification (e.g., TG ID) of the requesting thread group, and the tag may include the requested memory address, a data mask, and / or auxiliary information. Thus, cache 420 provides information to correlation array 450 regarding memory accesses required by currently executing thread groups. For example, if correlation array 450 is implemented in a physical address space, the address of the physical memory being accessed at cacheline granularity may be suitable correlation information. If correlation array 450 is implemented in a virtual address space, additional information such as some form of process ID may be required.

[0038] Correlation array 450 may store index and tag information and may use this information to calculate correlation values ​​for the thread groups, as described further below. Correlation array 450 may report these correlation values ​​to determination unit 460. Determination unit 460 may use the reported correlation values ​​to determine data-driven scheduling for execution of thread groups TG0, TG1, TG2, TG3 on SE0 and SE1. Thread group dispatcher 440 may then dispatch the thread groups for execution on SE0 and SE1 according to the data-driven schedule.

[0039] 5 is a table 500 illustrating an example state of correlation array 450 at a point in time during the execution of thread groups TG0, TG1, TG2, and TG3. Exemplary system 400 schedules at a granularity of four thread groups. Thus, table 500 includes four keys 510, 510', 510'', 510''', each corresponding to one of thread groups TG0, TG1, TG2, and TG3, respectively.

[0040] Each key 510, 510', 510'', 510''' includes a corresponding tag list (not shown) and a set of contributing correlation values ​​520, 520', 520'', 520'''. The set of contributing correlation values ​​520, 520', 520'', 520''' reflects the correlation of each pair of thread groups TG0, TG1, TG2, and TG3. For example, key 510 stores a set of contributing correlation values ​​520 for TG0. The set of contributing correlation values ​​520 stores a contributing correlation value C01 corresponding to the correlation between TG0 and TG1, a contributing correlation value C02 corresponding to the correlation between TG0 and TG2, and a contributing correlation value C03 corresponding to the correlation between TG0 and TG3. Each of the other keys 510', 510'', 510''' stores a similar set of contributing correlation values ​​520', 520'', 520''', as reflected in FIG. 5. Before correlation information is available to the correlation array 450 (eg, as in step 310 of method 300), the tag list may be empty and the contributing correlation values ​​may be zero.

[0041] For a new memory request by SE0 or SE1 during the execution of the thread group, correlation array 450 receives the corresponding index and tag information of the memory request from the cache. If the index and tag information matches an entry in table 500, the corresponding contributing correlation value may be incremented, increased, or changed to reflect the increased correlation. For example, if correlation array 450 receives index TG1 and tag tag3 and reflects that the tag list for TG0 also includes tag3, then contributing correlation value CO1 reflecting the correlation between TG0 and TG1 may be increased (e.g., incremented by 1).

[0042] If the received index matches a key in table 500, but the received tag does not match any tag in the tag list, the received tag may be inserted into the tag list for that key. If the received index does not match a key in table 500, but the received tag matches a tag in the tag list.

[0043] After TG0, TG1, TG2 and TG3 have finished running on SE0 and SE1, the contributing correlation values ​​C01 and C10 may be summed (or otherwise combined) to determine a correlation value c01 reflecting the correlation between TG0 and TG1. Other matching contributing correlation values ​​may be similarly summed to determine correlation values ​​for other TG pairs. For example, c02 may be the correlation value of TG0 and TG2 calculated by summing the contributing correlation values ​​C02 and C20, etc. These correlation values ​​c01, c02, c03, c12, c13, c23 may be reported to the decision unit 460.

[0044] Note that rather than waiting until TG0, TG1, TG2 and TG3 have finished executing on SE0 and SE1, the contribution correlation values ​​may be summed and / or reported after a period of time (e.g., 1,000 processor clock cycles). Thus, the correlation values ​​may be calculated before the completion of execution or after several executions of TG0, TG1, TG2 and TG3. This allows for dynamic scheduling and / or scheduling based on higher resolution data.

[0045] Returning to FIG. 4, the determination unit 460 may determine the issue order (i.e., data-driven schedule) of the next four TGs (TG0, TG1, TG2, TG3) based on the reported correlation values ​​c01, c02, c03, .... Table 1 shows pseudocode reflecting an example of a partial algorithm by which the determination unit 460 makes this determination. The thread group dispatcher 440 receives the data-driven schedule from the determination unit 460 and dispatches thread groups to SE0 and SE1 according to the data-driven schedule. In some implementations, the thread group dispatcher 440 may only update its schedule based on a determination that the schedule has changed. In some implementations, provided that the schedule has changed, thread groups currently executing on SE0 and SE1 may be suspended, the context may be saved, the updated schedule may be applied to the thread groups (i.e., the thread groups may be reassigned to different shader engines and / or execution times), the context may be restored, and execution may be resumed according to the updated schedule. [Table 1]

[0046] In other exemplary systems, scheduling may be based on other than thread groups, for example, wave-level based scheduling may be appropriate depending on the system architecture.

[0047] 6 is a block diagram illustrating an example system 600 for implementing data-driven scheduling. In one implementation, the system 600 may be a function of the processor 102. The system 600 includes a processing unit 610, a cache memory 620 shared by the processing unit 610, a data-driven scheduler 630, and a wave dispatcher 640. In the example of the system 600, the processing unit 610 includes two cores (in this case, compute units CU0 and CU1). The data-driven scheduler 630 includes a correlation array 650 and a decision unit 660 to determine a wave-level schedule.

[0048] Each of the compute units CU0 and CU1 may include a single instruction, multiple data (SIMD) core. In this context, a group of threads executing in parallel on a SIMD core may be referred to as a wave.

[0049] In this example, cache memory 620 is an L2 cache, but it should be noted that cache memory 620 may be any suitable level of cache memory or another shared memory shared by compute units CU0 and CU1. Cache memory 620 is shared by compute units CU0 and CU1.

[0050] A data-driven scheduler 630 schedules waves for execution on the processing units 610. A correlation array 650 calculates correlations between waves. A decision unit 660 decides which waves to dispatch to a particular one of the processing units 610 at a particular time.

[0051] Before correlation data is available for scheduling, data-driven scheduler 630 schedules thread groups for execution on compute units CU0 and CU1 using a default (e.g., non-data-driven) scheduling pattern. This default pattern may be a round-robin pattern. In the example system 600, scheduling is done at a granularity of four waves. Thus, if the first four waves are called wave0, wave1, wave2, and wave3, the scheduling of the first four waves in a round-robin manner is wave0=CU0, wave1=CU1, wave2=CU0, wave3=CU1. Wave dispatcher 640 then dispatches waves for execution on CU0 and CU1 according to the default schedule.

[0052] In response to a new memory request from CU0 and / or CU1 to cache 620, cache 620 may transfer an index and a cache tag corresponding to the memory request to correlation array 650. The index may correspond to an identification of the requesting wave (e.g., a wave ID), and the tag may include the requested memory address, a data mask, and / or auxiliary information. Thus, cache 620 provides correlation array 650 with information regarding memory accesses required by the currently executing wave. The tag may be a physical address or a virtual address combined with a virtual memory identifier. The tag may be similar to tags used in data caches.

[0053] Correlation array 650 may store index and tag information and may use this information to calculate correlation values ​​for the waves, as described further below. Correlation array 650 may report these correlation values ​​to decision unit 660. Decision unit 660 may use the reported correlation values ​​to determine data-driven scheduling for executing waves wave0, wave1, wave2, wave3 on CU0 and CU1. Wave dispatcher 640 may then dispatch the waves for execution on CU0 and CU1 according to the data-driven schedule.

[0054] 7 is a table 700 illustrating an example state of correlation array 650 at a point in time during the execution of waves wave0, wave1, wave2, and wave3. The example system 600 schedules at a granularity of four waves. Thus, table 700 includes four keys 710, 710', 710'', 710''', each corresponding to one of the waves wave0, wave1, wave2, and wave3, respectively.

[0055] Each key 710, 710', 710'', 710''' includes a corresponding tag list (not shown) and a set of contributing correlation values ​​720, 720', 720'', 720'''. The sets of contributing correlation values ​​720, 720', 720'', 720''' reflect the correlation of each pair of waves wave0, wave1, wave2, and wave3. For example, key 710 stores a set of contributing correlation values ​​720 for wave0. The set of contributing correlation values ​​720 stores a contributing correlation value C01 corresponding to the correlation between wave0 and wave1, a contributing correlation value C02 corresponding to the correlation between wave0 and wave2, and a contributing correlation value C03 corresponding to the correlation between wave0 and wave3. Each of the other keys 710', 710'', 710''' stores a similar set of contributing correlation values ​​720', 720'', 720''', as reflected in FIG. 7. Before correlation information is available to the correlation array 650 (eg, as in step 310 of method 300), the tag list may be empty and the contributing correlation values ​​may be zero.

[0056] For a new memory request by CU0 or CU1 during the execution of a wave, correlation array 650 receives the corresponding index and tag information of the memory request from the cache. If the index and tag information matches an entry in table 700, the corresponding contributing correlation value may be incremented, increased, or changed to reflect the increased correlation. For example, if correlation array 650 receives index wave1 and tag tag3 and reflects that the tag list for wave0 also includes tag3, then contributing correlation value C01, reflecting the correlation between wave0 and wave1, may be increased (e.g., incremented by 1).

[0057] If the received index matches a key in table 700 but the received tag does not match any tag in the tag list, the received tag may be inserted into the tag list for that key. If the received index does not match a key in table 700 but the received tag matches a tag in the tag list, a new key may be added to the index and correlations to other keys may be adjusted if the tags match.

[0058] After wave0, wave1, wave2, and wave3 have finished executing on CU0 and CU1, the contributing correlation values ​​C01 and C10 may be summed (or otherwise combined) to determine a correlation value c01 reflecting the correlation between wave0 and wave1. Other matching contributing correlation values ​​may be similarly summed to determine correlation values ​​for other wave pairs. For example, c02 may be the correlation value for wave0 and wave2 calculated by summing the contributing correlation values ​​C02 and C20, etc. These correlation values ​​c01, c02, c03, c12, c13, c23 may be reported to the decision unit 660.

[0059] Note that rather than waiting until wave0, wave1, wave2, and wave3 have finished executing on CU0 and CU1, the contributing correlation values ​​may be summed and / or reported after a period of time (e.g., 1,000 processor clock cycles). Thus, correlation values ​​may be calculated before the completion of execution or after several executions of wave0, wave1, wave2, and wave3. This allows for dynamic scheduling and / or scheduling based on higher resolution data.

[0060] Returning to FIG. 6, the decision unit 660 may determine the issue order (i.e., data-driven schedule) of the next four waves (wave0, wave1, wave2, wave3) based on the reported correlation values ​​c01, c02, c03, .... Table 2 shows pseudocode reflecting an example of a partial algorithm by which the decision unit 660 makes this decision. The wave dispatcher 640 receives the data-driven schedule from the decision unit 660 and dispatches waves to CU0 and CU1 according to the data-driven schedule. In some implementations, the wave dispatcher 640 may only update its schedule based on a determination that the schedule has changed. In some implementations, provided that the schedule has changed, waves currently executing on CU0 and CU1 may be suspended, the context may be saved, the updated schedule may be applied to the waves (i.e., the waves may be reassigned to different compute units and / or execution times), the context may be restored, and execution may resume with the updated schedule. [Table 2]

[0061] In other exemplary systems, scheduling may be based on other than thread groups or waves. For example, scheduling based on a thread level may be appropriate depending on the system architecture. It should be noted that the techniques described herein are applicable to other levels of abstraction other than threads, thread groups, or waves without departing from this invention.

[0062] 8 is a block diagram illustrating an example system 800 for implementing data-driven scheduling. In one implementation, the system 800 may be a function of the processor 102. The system 800 includes a processing unit 810, two cache memories 820, 825 shared by the processing unit 810, a data-driven scheduler 830, and a thread dispatcher 840. In the example of the system 800, the processing unit 810 includes two cores (in this case, SIMD units, SIMD0 and SIMD1). The data-driven scheduler 830 includes a correlation array 850 and a decision unit 860 to determine a thread-level schedule.

[0063] In this example, cache memories 820, 825 are L1 and L2 caches, respectively. However, cache memories 820, 825 may be any appropriate level cache memory or other shared memory shared by SIMD units SIMD0 and SIMD1. Cache memories 820, 825 are shared by SIMD units SIMD0 and SIMD1.

[0064] A data-driven scheduler 830 schedules threads for execution on the processing units 810. A correlation array 850 calculates correlations between threads. A decision unit 860 decides which threads to dispatch to a particular one of the processing units 810 at a particular time.

[0065] Before correlation data is available for scheduling, data-driven scheduler 830 schedules thread groups for execution on SIMD units SIMD0 and SIMD1 using a default (e.g., non-data-driven) scheduling pattern. This default pattern may be a round-robin pattern. In the exemplary system 800, scheduling is done at a granularity of four threads. Thus, if the first four threads are called thread0, thread1, thread2, and thread3, the scheduling of the first four threads in a round-robin manner is thread0=SIMD0, thread1=SIMD1, thread2=SIMD0, thread3=SIMD1. Thread dispatcher 840 then dispatches threads for execution on SIMD0 and SIMD1 according to the default schedule.

[0066] In response to a new memory request from SIMD0 and / or SIMD1 to cache 820 or cache 825, the cache receiving the request may forward an index and a cache tag corresponding to the memory request to correlation array 850. The index may correspond to an identification of the requesting thread (e.g., a thread ID), and the tag may include the requested memory address, a data mask, and / or auxiliary information. Thus, cache 820 or 825 provides information to correlation array 850 regarding memory accesses required by currently executing threads. The tag may be similar to tags used in data caches. The tag may be, for example, a physical address or a virtual address combined with a virtual memory identifier.

[0067] Correlation array 850 may store index and tag information and may use this information to calculate correlation values ​​for threads, as described further below. Correlation array 850 may report these correlation values ​​to decision unit 860. Decision unit 860 may use the reported correlation values ​​to determine data-driven scheduling for executing threads thread0, thread1, thread2, and thread3 on SIMD0 and SIMD1. Thread dispatcher 840 may then dispatch the threads for execution on SIMD0 and SIMD1 according to the data-driven schedule.

[0068] 9 is a table 900 illustrating an example state of correlation array 650 at a point in time during the execution of threads thread0, thread1, thread2, and thread3. Exemplary system 800 schedules at a granularity of four threads. Thus, table 900 includes four keys 910, 910', 910'', 910''', each corresponding to one of threads thread0, thread1, thread2, and thread3, respectively.

[0069] Each key 910, 910', 910'', 910''' includes a corresponding tag list (not shown) and a set of contribution correlation values ​​920, 920', 920'', 920'''. The set of contribution correlation values ​​920, 920', 920'', 920''' reflects the correlation between each pair of threads thread0, thread1, thread2, and thread3. For example, key 910 stores a set of contribution correlation values ​​920 for thread0. The set of contribution correlation values ​​920 stores a contribution correlation value C01 corresponding to the correlation between thread0 and thread1, a contribution correlation value C02 corresponding to the correlation between thread0 and thread2, and a contribution correlation value C03 corresponding to the correlation between thread0 and thread3. Each of the other keys 910', 910'', 910''' stores a similar set of contributing correlation values ​​920', 920'', 920''', as reflected in Figure 9. Before correlation information is available to the correlation array 850 (e.g., as in step 310 of method 300), the tag list may be empty and the contributing correlation values ​​may be zero.

[0070] For a new memory request by SIMD0 or SIMD1 during the execution of a thread, correlation array 850 receives the corresponding index and tag information of the memory request from the cache. If the index and tag information matches an entry in table 900, the corresponding contributing correlation value may be incremented, increased, or changed to reflect the increased correlation. For example, if correlation array 850 receives index thread1 and tag tag3 and reflects that the tag list for thread0 also includes tag3, then contributing correlation value C01 reflecting the correlation between thread0 and thread1 may be increased (e.g., incremented by 1).

[0071] If the received index matches a key in table 900 but the received tag does not match any tag in the tag list, the received tag may be inserted into the tag list for that key. If the received index does not match a key in table 900 but the received tag matches a tag in the tag list, a new key may be added to the index and correlations to other keys may be adjusted if the tags match.

[0072] After thread0, thread1, thread2, and thread3 have finished executing on SIMD0 and SIMD1, the contribution correlation values ​​C01 and C10 may be summed (or otherwise combined) to determine a correlation value c01 reflecting the correlation between thread0 and thread1. Other matching contribution correlation values ​​may be similarly summed to determine correlation values ​​for other thread pairs. For example, c02 may be the correlation value for thread0 and thread2 calculated by summing the contribution correlation values ​​C02 and C20, etc. These correlation values ​​c01, c02, c03, c12, c13, c23 may be reported to the decision unit 660.

[0073] Note that rather than waiting until thread0, thread1, thread2 and thread3 finish executing on SIMD0 and SIMD1, the contribution correlation values ​​may be summed and / or reported after a period of time (e.g., 1,000 processor clock cycles). Thus, the correlation values ​​may be calculated before the completion of execution or after several executions of threads thread0, thread1, thread2 and thread3. This allows for dynamic scheduling and / or scheduling based on higher resolution data.

[0074] Returning to FIG. 8, the decision unit 860 may determine the issue order (i.e., data-driven schedule) of the next four threads (thread0, thread1, thread2, and thread3) based on the reported correlation values ​​c01, c02, c03, . . . . Table 3 shows pseudocode reflecting an example of a partial algorithm by which the decision unit 860 makes this decision. The thread dispatcher 840 receives the data-driven schedule from the decision unit 860 and dispatches threads to CU0 and CU1 according to the data-driven schedule. In some implementations, the thread dispatcher 840 may only update its schedule based on a determination that the schedule has changed. In some implementations, provided that the schedule has changed, the threads currently executing on SIMD0 and SIMD1 may be suspended, the context may be saved, the updated schedule may be applied to the threads (i.e., the threads may be reassigned to different SIMDs and / or execution times), the context may be restored, and execution may resume with the updated schedule. [Table 3]

[0075] 10 is a block diagram illustrating an exemplary system 1000 that implements data-driven scheduling. In one implementation, the system 1000 may be a function of the processor 102. The system 1000 includes a processing unit 1010, a cache memory 1020 shared by the processing unit 1010, a data-driven scheduler 1030, and a thread dispatcher 1040. In the example of the system 1000, the processing unit 1010 includes four cores (in this case, computing units CU0, CU1, CU2, and CU3). The data-driven scheduler 1030 includes a correlation array 1050 and a decision unit 1060 to determine a thread dispatcher-level schedule.

[0076] In this example, cache memory 1020 is an L2 cache, but it should be noted that cache memory 1020 may be any suitable level of cache memory or another shared memory shared by compute units CU0, CU1, CU2, and CU3. Cache memory 1020 is shared by compute units CU0, CU1, CU2, and CU3.

[0077] A data-driven scheduler 1030 schedules waves for execution on the processing units 1010. A correlation array 1050 calculates correlations between waves. A decision unit 1060 decides which waves to dispatch to a particular one of the processing units 1010 at a particular time.

[0078] Before correlation data is available for scheduling, the data-driven scheduler 1030 schedules waves for execution on compute units CU0, CU1, CU2, and CU3 using a default (e.g., non-data-driven) scheduling pattern. This default pattern may be a round-robin pattern. In the exemplary system 1000, scheduling is done at a granularity of eight waves. Thus, if the first eight threads are called wave0, wave1, wave2, wave3, wave4, wave5, wave6, and wave7, the scheduling of the first eight waves in a round-robin manner is wave0=CU0, wave1=CU1, wave2=CU2, wave3=CU3, wave4=CU0, wave5=CU1, wave6=CU2, wave7=CU3. The thread dispatcher 1040 then dispatches waves for execution on CU0, CU1, CU2, and CU3 according to the default schedule.

[0079] In response to a new memory request from CU0, CU1, CU2, and / or CU3 to the cache 1020, the cache 1020 may transfer an index and a cache tag corresponding to the memory request to the correlation array 1050. The index may correspond to an identification of the requesting wave (e.g., a wave ID), and the tag may include the requested memory address, a data mask, and / or auxiliary information. Thus, the cache 1020 provides information to the correlation array 1050 regarding memory accesses required by the currently executing wave. The tag may be a physical address or a virtual address combined with a virtual memory identifier.

[0080] The correlation array 1050 may store index and tag information and may use this information to calculate correlation values ​​for the waves. The correlation array 1050 may report these correlation values ​​to the determination unit 1060. The determination unit 1060 may use the reported correlation values ​​to determine data-driven scheduling for executing waves wave0, wave1, wave2, wave3, wave4, wave5, wave6, and wave7 on CU0, CU1, CU2, and CU3. The wave dispatcher 1040 may then dispatch the waves for execution on CU0, CU1, CU2, and CU3 according to the data-driven schedule.

[0081] 11 is a table 1100 illustrating an example state of correlation array 650 at a point in time during the execution of waves wave0, wave1, wave2, wave3, wave4, wave5, wave6, and wave7. The exemplary system 1000 schedules at a granularity of eight waves. Thus, table 1100 includes eight keys 1110a, 1110b, 1110c, 1110d, 1110e, 1110f, 1110g, 1110h, each of which corresponds to one of the waves wave0, wave1, wave2, wave3, wave4, wave5, wave6, and wave7.

[0082] Each key 1110a, 1110b, 1110c, 1110d, 1110e, 1110f, 1110g, 1110h includes a corresponding tag list (not shown) and a set of contributing correlation values ​​1120a, 1120b, 1120c, 1120d, 1120e, 1120f, 1120g, 1120h. The sets of contributing correlation values ​​1120a, 1120b, 1120c, 1120d, 1120e, 1120f, 1120g, 1120h reflect the correlation of each pair of waves wave0, wave1, wave2, wave3, wave4, wave5, wave6, and wave7. For example, key 1110a stores the set of contributing correlation values ​​1120a for wave0. The set of contributing correlation values ​​1120a stores a contributing correlation value CO1 corresponding to the correlation between wave0 and wave1, a contributing correlation value CO2 corresponding to the correlation between wave0 and wave2, a contributing correlation value CO3 corresponding to the correlation between wave0 and wave3, etc. Each of the other keys 1110b, 1110c, 1110d, 1110e, 1110f, 1110g, 1110h stores a similar set of contributing correlation values ​​1120b, 1120c, 1120d, 1120e, 1120f, 1120g, 1120h reflected in Figure 11. Before correlation information is available to the correlation array 1050 (e.g., as in step 310 of method 300), the tag list may be empty and the contributing correlation values ​​may be zero.

[0083] For a new memory request by CU0, CU1, CU2, or CU3 during the execution of a wave, correlation array 1050 receives the corresponding index and tag information of the memory request from the cache. If the index and tag information matches an entry in table 1100, the corresponding contributing correlation value may be incremented, increased, or changed to reflect the increased correlation. For example, if correlation array 1050 receives index wave1 and tag tag3 and reflects that the tag list for wave0 also includes tag3, then contributing correlation value C01, reflecting the correlation between wave0 and wave1, may be increased (e.g., incremented by 1).

[0084] If the received index matches a key in table 1100 but the received tag does not match any tag in the tag list, the received tag may be inserted into the tag list for that key. If the received index does not match a key in table 1100 but the received tag matches a tag in the tag list, a new key may be added to the index and correlations to other keys may be adjusted if the tags match.

[0085] After wave0, wave1, wave2, wave3, wave4, wave5, wave6, and wave7 have finished execution on CU0, CU1, CU2, and CU3, the contributing correlation values ​​C01 and C10 may be summed (or otherwise combined) to determine a correlation value c01 reflecting the correlation between wave0 and wave1. Other matching contributing correlation values ​​may be similarly summed to determine correlation values ​​for other thread pairs. For example, c02 may be the correlation value for wave0 and wave2 calculated, such as by summing the contributing correlation values ​​C02 and C20. These correlation values ​​c01, c02, c03, c04, c05, c06, c07, c12, c13, c14, c15, c16, c17, c23, c24, c25, c26, c27, c34, c35, c36, c37, c45, c46, c47, c56, c57, c67 may be reported to the decision unit 660.

[0086] Note that rather than waiting until wave0, wave1, wave2, wave3, wave4, wave5, wave6, and wave7 have finished executing on CU0, CU1, CU2, and CU3, the contributing correlation values ​​may be summed and / or reported after a period of time (e.g., 1,000 processor clock cycles). Thus, correlation values ​​may be calculated before the completion of execution or after several executions of CU0, CU1, CU2, and CU3. This allows for dynamic scheduling and / or scheduling based on higher resolution data.

[0087] Returning to diagram 1000, the decision unit 1060 may determine the issue order (i.e., data-driven schedule) for the next eight waves (wave0, wave1, wave2, wave3, wave4, wave5, wave6, and wave7) based on the reported correlation values ​​c01, c02, c03, c04, c05, c06, c07, c12, c13, c14, c15, c16, c17, c23, c24, c25, c26, c27, c34, c35, c36, c37, c45, c46, c47, c56, c57, c67. Table 4 shows an example of a partial algorithm for the decision unit 1060 to make this decision. The wave dispatcher 1040 receives the data-driven schedule from the decision unit 1060 and dispatches threads to CU0, CU1, CU2, and CU3 according to the data-driven schedule. In some implementations, wave dispatcher 1040 may only update its schedule based on a determination that the schedule has changed. In some implementations, provided that the schedule has changed, thread groups currently executing on CU0, CU1, CU2, and CU3 may be suspended, context may be saved, an updated schedule may be applied to the wave (i.e., the wave may be reassigned to a different compute unit and / or execution time), context may be restored, and execution may resume with the updated schedule. [Table 4]

[0088] It should be noted that in any of these or other implementations, the data-driven scheduler may be subject to clock gating, power gating, or a different suitable power saving mechanism, for example, when it is idle. The data-driven scheduler may, for example, remain idle until a new shader is to be executed.

[0089] It should further be noted that in any of these or other implementations, the tag list may be sorted, e.g., in ascending or descending order to facilitate searching, and may be compressed or uncompressed.

[0090] It should be understood that many variations are possible based on the disclosure herein, and although features and elements have been described above in particular combinations, each feature or element may be used alone without the other features and elements, or in various combinations with or without the other features and elements.

[0091] The provided methods may be implemented with a general purpose computer, processor, or processor core. Suitable processors include, by way of example, general purpose processors, special purpose processors, conventional processors, digital signal processors (DSPs), multiple microprocessors, one or more microprocessors associated with a DSP core, controllers, microcontrollers, application specific integrated circuits (ASICs), field programmable gate array (FPGA) circuits, other types of integrated circuits (ICs), and / or state machines. Such processors may be manufactured by configuring a manufacturing process using the results of processed hardware description language (HDL) instructions and other intermediate data including netlists (e.g., instructions that may be stored on a computer readable medium). The results of such processing may be a maskwork used in a semiconductor manufacturing process to manufacture a processor embodying aspects of the embodiments.

[0092] The methods or flow charts provided herein may be implemented in a computer program, software, or firmware embodied in a non-transitory computer-readable storage medium for execution by a general purpose computer or processor. Examples of non-transitory computer-readable storage media include read-only memory (ROM), random access memory (RAM), registers, cache memory, semiconductor memory devices, magnetic media such as internal hard disks and removable disks, magneto-optical media, and optical media such as CD-ROM disks and digital versatile disks (DVDs).

Claims

1. 1. A method for data-driven scheduling of multiple computational cores of a processor, comprising: executing a plurality of threads on the plurality of computing cores according to a default schedule; analyzing the plurality of threads based on execution according to the default schedule to determine correlation values ​​for subsets of the plurality of threads, the correlation values ​​representing memory reuse among threads of each subset; generating a data-driven schedule based on the correlation value, wherein threads of each subset are scheduled to run in parallel on the multiple compute cores such that the correlation value is maximized; executing the plurality of threads on the plurality of computing cores according to the data driven schedule. method.

2. The method of claim 1 , wherein the default schedule comprises a round robin schedule.

3. Analyzing the plurality of threads to determine the correlation value includes: a data driven scheduling circuit receiving information regarding memory accesses by the compute core resulting from execution of at least some of the plurality of threads on the compute core; obtaining the correlation value based on the information.

2. The method of claim 1.

4. The method of claim 3 , wherein memory is shared among the multiple computing cores.

5. The method of claim 3 , wherein the memory comprises a cache memory.

6. The method of claim 1 , wherein the data-driven schedule is generated after each of the plurality of threads completes execution on the compute core.

7. The method of claim 1 , wherein the data-driven schedule is generated after execution of the plurality of threads on the computing cores has progressed for a period of time.

8. The method of claim 1 , wherein the data-driven schedule is generated before all of the plurality of threads have completed execution on the compute cores.

9. 1. A processor configured for a data driven schedule, comprising: A plurality of computing cores; a memory shared by each of the plurality of computing cores; a dispatch circuit configured to dispatch a plurality of threads for execution on the plurality of computational cores according to a default schedule; a correlation circuit configured to analyze the plurality of threads based on the execution to determine a correlation value for a subset of the plurality of threads, the correlation value being indicative of memory reuse among threads of each subset; a scheduling circuit configured to determine a data-driven schedule based on the correlation value, wherein threads of each subset are scheduled to run in parallel on the multiple computational cores such that the correlation value is maximized; the dispatch circuitry is configured to dispatch the plurality of threads for execution on the plurality of compute cores according to the data driven schedule. Processor.

10. The processor of claim 9 , wherein the default schedule comprises a round robin schedule.

11. The correlation circuit includes: receiving information regarding memory accesses by the compute core resulting from execution of at least some of the plurality of threads on the compute core; and obtaining the correlation value based on the information. The processor of claim 9.

12. The processor of claim 11 , wherein memory is shared among the multiple computational cores.

13. 12. The processor of claim 11, wherein the memory comprises a cache memory.

14. the processor comprises a circuit; The circuit comprises: determining whether the data-driven schedule differs from the default schedule; configured to suspend execution of the computational cores, save a current context, and dispatch the plurality of threads according to the data-driven schedule if the data-driven schedule differs from the default schedule; The processor of claim 9.

15. The processor of claim 9 , wherein the data-driven schedule is generated after each of the plurality of threads completes execution on the compute core.

16. The processor of claim 9 , wherein the data-driven schedule is generated after execution of the plurality of threads on the computing cores has progressed for a period of time.

Citation Information

Patent Citations

  • Multiprocessor system, processor module used for multiprocessor system, and method for allocating task in multiprocessing

    JP2002055966A

  • Apparatus and method for processing information

    JP2010165259A

  • Task scheduling device, task scheduling method, and task scheduling program

    JP2013150094A

  • Configuring thread scheduling on a multi-threaded data processing apparatus

    US20150160970A1

  • Scheduler, multi-core processor system, and scheduling method

    WO2012026034A1