Soft watermarking of thread-shared resources implemented through thread arbitration

Soft watermarking in thread arbitration for multi-threaded microprocessors addresses resource imbalances by estimating and controlling thread allocations, improving resource utilization and throughput.

JP7553551B2Active Publication Date: 2024-09-18ADVANCED MICRO DEVICES INC
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2022519137
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2019-09-27
Filing Date
2020-09-03
Publication Date
2024-09-18
Estimated Expiration
2040-09-03

AI Technical Summary

Technical Problem

Existing thread arbitration schemes in multi-threaded microprocessors, such as round robin and LRU, fail to adequately address resource imbalances caused by long-latency operations and instruction dependencies, leading to underutilized threads and reduced throughput.

Method used

Implement soft watermarking through thread arbitration logic that estimates resource allocations and sets dynamic or static allocation goals to prevent threads from exceeding their resource usage, thereby improving resource utilization and throughput.

Benefits of technology

The soft watermarking technique effectively prevents underutilization of shared resources by excluding threads from allocation when their estimated resource usage meets or exceeds the set goal, enhancing overall microprocessor throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007553551000005
    Figure 0007553551000005
  • Figure 0007553551000001
    Figure 0007553551000001
  • Figure 0007553551000004
    Figure 0007553551000004
Patent Text Reader

Abstract

A technique for use in a microprocessor core is disclosed for soft watermarking of thread shared resources implemented through thread arbitration. A thread is excluded from a thread arbitration decision involving multiple threads competing for or requesting use of the shared resource in a current clock cycle based on the number of entries in the shared resource estimated to be allocated to the thread in the current clock cycle. By excluding a thread from a thread arbitration decision, the thread is prevented from being allocated additional entries in the shared resource.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to multi-threaded microprocessors, and more particularly, to soft watermarking of thread-shared resources implemented through thread mediation in multi-threaded microprocessors. [Background technology]

[0002] At the hardware level, a multithreaded microprocessor core can execute different threads of hardware instructions simultaneously. Often, the different threads share resources. Various components of the microprocessor pipeline can contain shared resources that are competitively shared by multiple threads. Some examples of such shared resources include compute units, load queues, reservation stations, L1 and L2 caches, translation lookaside buffers, etc.

[0003] Depending on the level of parallelism present in a microprocessor, shared resources within the microprocessor core may become strained. For example, 2-8 or more threads may compete for a load queue, reservation stations, register file, or arithmetic logic unit (ALU). As another example, multiple threads may reserve allocation of entries in a load queue before being issued to an execution unit. The strain on shared resources caused by the level of parallelism may lead to hazards. To mitigate this, thread arbitration schemes for sharing resources may be utilized, such as round robin and least-recently-used (LRU), etc.

[0004] However, simple thread arbitration schemes such as round robin and LRU may not be sufficient. For example, a thread's long latency operations, such as loads that miss in the L1 and L2 caches, may cause the thread to accumulate an unfair share of a shared resource and be slow to deallocate that share. Similarly, instruction dependencies and register dependencies may cause a thread to accumulate an unfair share of a shared resource while waiting for the dependency to be satisfied. Such threads are sometimes referred to as "poor use" threads. An underutilized thread may occur when a thread is assigned a disproportionately larger share of a shared resource than it is actively using. Under certain processor workloads, allocating a shared resource to an underutilized thread may significantly reduce the throughput of other threads.

[0005] The embodiments described herein address these and other issues.

[0006] The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued, and thus, unless expressly indicated, it should not be assumed that any of the approaches described in this section qualify as prior art or are well-understood routines or conventional practices merely by virtue of their inclusion in this section. [Brief description of the drawings]

[0007] [Figure 1] FIG. 1 illustrates a schematic diagram of an example of a microprocessor core that may use techniques for soft watermarking of thread-shared resources implemented through thread arbitration, according to some possible embodiments. [Diagram 2] FIG. 1 is a block diagram of an example of a multi-threaded microprocessor core that may use techniques for soft watermarking of thread-shared resources implemented through thread arbitration, according to some possible embodiments. [Diagram 3] FIG. 2 illustrates an example of a thread arbitration decision in table form, according to some possible embodiments. [Figure 4] FIG. 1 illustrates an example of soft watermarking in table form, according to some possible embodiments. [Diagram 5] 1 is a flowchart of a software watermarking process, according to some possible embodiments. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0008] In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, it will be apparent that the embodiments described herein may be practiced without these specific details. In other instances, some structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring certain features.

[0009] (Overview) A technique is disclosed for use in a microprocessor for soft watermarking of thread shared resources implemented through thread arbitration. The technique, in some embodiments, allows for control of thread selection based on the number of entries allocated to the thread in the shared resource and the thread's static or dynamically adjusted allocation target. The technique also, in some embodiments, allows for bridging the clock cycles between when a thread is selected to use a shared resource and when the thread's actual allocation count is updated by considering the expected resource allocation count by a thread when the thread selection occurs before the thread's actual allocation count is updated. By considering the expected resource allocation count when a thread is selected, large fluctuations in the resource allocation count are prevented when there are a significant number of clock cycles between thread selection and when the thread's actual allocation count is updated.

[0010] In some possible embodiments, for example, a microprocessor has a shared resource. The shared resource has a number of entries for use by a number of threads. The microprocessor also includes thread arbitration logic. The thread arbitration logic determines an allocation estimate for each of the number of threads. The allocation estimate may be an estimate of the cardinality of a set of entries of the number of entries that the thread is consuming in a current clock cycle in which a thread arbitration decision is made. This estimate may be a sufficiently good estimate of the number of entries of the shared resource that the thread will consume in future clock cycles without incurring the additional complexity and cost associated with hardware circuitry to generate a more accurate estimate.

[0011] The thread arbitration logic also determines whether the allocation number estimate meets (e.g., is greater than or equal to) an allocation target, which may be a cardinality of a number of entries of a shared resource that should not be exceeded when allocated to a thread in the current clock cycle.

[0012] The thread arbitration logic excludes a thread from thread arbitration decisions based on a determination that the thread's allocation estimate meets (e.g., is greater than or equal to) the allocation goal. By excluding a thread from thread arbitration decisions, the thread is stalled from allocating additional entries in the shared resource, potentially preventing the thread from becoming an underutilized thread. If the thread's current allocation estimate does not meet its current allocation goal after the current clock cycle, the thread is included in thread arbitration decisions and is not stalled from allocating entries in the shared resource.

[0013] These and other possible embodiments will become more apparent with reference to the following description and accompanying drawings.

[0014] (Example of a microprocessor core) 1 illustrates generally an example microprocessor core 100 that employs techniques for soft watermarking of thread-shared resources implemented through thread arbitration, according to some possible embodiments. Core 100 is either a multithreaded central processing unit (CPU), a core of a single-core multithreaded microprocessor, or a core of a multi-core multithreaded microprocessor. Core 100 utilizes known processor design techniques, including, but not limited to, a superscalar architecture, simultaneous multithreading, fine-grained multithreading, speculative execution, branch prediction, out-of-order execution, and / or register renaming.

[0015] Core 100 includes circuitry for executing instructions according to a given instruction set architecture, which may be, for example, x86, ARM, PowerPC, MIPS, Sparc, RISC-V, or any other complex or reduced instruction set architecture.

[0016] Core 100 supports the execution of multiple threads. A given thread may include a set of instructions that may be executed independently of instructions in other threads. Core 100 may execute instructions in several threads simultaneously, such as, for example, 2-8 simultaneously executing threads.

[0017] Core 100 is capable of efficiently processing various types of computational workloads across a range of workload types, from more I / O-bound workloads (e.g., network- and / or file system-bound workloads) to more processor-bound workloads (e.g., workloads involving cryptography, computer graphics, or intensive mathematical analysis).

[0018] Core 100 dynamically allocates shared resources among multiple threads. Such shared resources may include, but are not limited to, branch resources (e.g., branch predictor structures), load / store resources (e.g., load / store buffers and queues), instruction completion resources (e.g., reorder buffers and commit logic), instruction issue resources (e.g., instruction selection and scheduling structures, reservation stations), register renaming resources (e.g., register mapping tables), and / or memory management unit resources (e.g., translation lookaside buffers, page walk resources).

[0019] A non-exclusive set of hardware components that may be included in core 100 include instruction fetch unit 110, instruction cache 115, decode unit 120, register renaming unit 125, instruction queue 130, execution unit 135, load / store unit 140, and data cache 145. Other components that may be included in core 100 but are not shown in FIGURE 1 may include, but are not limited to, a prefetch buffer, branch prediction logic, global / bimodal logic, loop logic, indirect jump logic, a loop stream decoder, a microinstruction sequencer, a retirement register file, a register allocation table, a reorder buffer, a reservation station, an arithmetic logic unit, and / or a memory order buffer.

[0020] (Example of a multi-threaded microprocessor core) 2 is a block diagram illustrating the exemplary multithreaded microprocessor core 100 of FIG. 1 including shared resources 210, thread arbitration logic 220, thread registers 230, control unit 240, and arithmetic logic unit (ALU) 250. Thread registers 230 are registers dedicated to a particular thread. Core 100 can support any number of threads, and embodiments are not limited to a particular number of threads. Shared resources 210 can be any type of resource used by multiple threads in multithreaded microprocessor core 100. Examples of shared resources 210 include, but are not limited to, load queues, register files, reservation stations, etc.

[0021] Thread arbitration logic 220 arbitrates requests from threads to allocate entries in shared resource 210 according to soft watermarking, as described in more detail below. Thread arbitration logic 220 may be implemented by computer hardware, computer software, or any combination of computer hardware and software. Thread arbitration logic 220 is shown in FIG. 2 as a separate element for illustrative purposes only, and thread arbitration logic 220 may be incorporated into other elements (e.g., resource allocation logic, thread switching logic, dispatch limit logic) in multithreaded microprocessor core 100. Multithreaded microprocessor core 100 may include additional elements not shown in FIG. 2 that may vary depending on the embodiment.

[0022] In some possible embodiments, the thread arbitration logic 220 for the shared resource 210 includes one or more allocation target(s) 221, a per-thread allocation count 222, a per-thread selection count 223, an expected number of allocations per selection 224, a soft watermarking active signal 225, and soft watermarking logic 226. The allocation target(s) 221, the per-thread allocation count 222, the per-thread selection count 223, the expected number of allocations per selection, the soft watermarking active signal 225, and / or the soft watermarking logic 226 may be dedicated to the shared resource 210, or one or more or all of them may be shared among multiple shared resources. The allocation target(s) 221, the per-thread allocation count 222, and the per-thread selection count 223 may be stored and maintained in one or more registers of the core 100.

[0023] The soft watermarking signal 225 may be set to active or inactive in the current clock cycle. For example, the soft watermarking signal 225 may be set to active or inactive when programmed instructions are executed by the core 100. This setting may apply to only the current clock cycle or to multiple clock cycles including the current clock cycle.

[0024] According to some embodiments, if the signal 225 is active in the current clock cycle, the soft watermarking logic 226 calculates an allocation number estimate for each of a plurality of threads requesting use of the shared resource 210 in the current clock cycle. The thread's allocation number estimate may be calculated based on the allocation target(s) 221, the per-thread allocation count 222, the per-thread selection count 223, and the expected allocations per selection 224. In general, however, the allocation target(s) 221 may be per-thread or global for all threads that use the shared resource 210. The allocation target(s) 221 may be set statically or dynamically. For example, the allocation target(s) 221 may be dynamically and automatically adjusted based on detecting how the threads are using the shared resource 210. In general, however, the allocation target may reflect a number of entries in the shared resource 210 that should not be exceeded that are allocated to the threads in the current clock cycle. Per-thread allocation counts 222 reflect the number of entries in shared resource 210 that each thread has allocated in a clock cycle that may be several clock cycles behind the current clock cycle. Per-thread selection counts 223 may reflect the number of times each thread has been selected to use shared resource 210 during a window of past clock cycles. The expected number of allocations per selection may be determined empirically or heuristically as the number of entries that a thread is expected to allocate in shared resource 210 each time the thread is selected to use shared resource 210 as a result of a thread arbitration decision.

[0025] In some embodiments, the soft watermarking logic 226 calculates an allocation number estimate for a thread in the current clock cycle as (1) a per-thread allocation count of the count of threads in the current clock cycle 222 (which may lag several cycles behind the actual number of entries allocated to the thread in the shared resource 210 in the current clock cycle) plus (2) a per-thread selection count of the count of threads in the current clock cycle 223 multiplied by (3) an expected allocation number per selection 224. If the calculated allocation number estimate for a thread meets an allocation target (e.g., a global allocation target for the shared resource 210 or a thread-specific allocation target for that thread and the shared resource 210), the soft watermarking logic 226 excludes the thread from thread arbitration decisions in the current clock cycle. Otherwise, the thread remains subject to thread arbitration in the current clock cycle.

[0026] On the other hand, if signal 225 is not active in the current clock cycle, soft watermarking logic 226 excludes the thread from thread arbitration decisions in the current clock cycle based on the allocation count of thread count 222. For example, if the allocation count of the thread in the current clock cycle meets an allocation goal (e.g., a global allocation goal for shared resource 210 or a thread-specific allocation goal for that thread and shared resource 210), soft watermarking logic 226 excludes the thread from thread arbitration decisions in the current clock cycle. Otherwise, the thread remains eligible for thread arbitration in the current clock cycle.

[0027] In some embodiments, the soft watermarking logic 226 allows for control of thread selection based on the number of entries allocated to a thread in the shared resource 210 and the thread's static or dynamically adjusted allocation target 221. The soft watermarking logic 226 also allows for compensating for clock cycles between when a thread is selected to use the shared resource 210 and when the thread's actual allocation count 222 is updated by considering the expected resource allocation by a thread when the thread selection occurs before the thread's actual allocation count 222 is updated. For example, the expected resource allocation may be based on the thread's selection count 223 and the expected number of allocations per selection 224. Considering the expected resource allocation when a thread is selected prevents large fluctuations in the number of resource allocations in the shared resource 210 when there are a significant number of clock cycles (e.g., 3 or more) between the thread selection and when the thread's actual allocation count 222 is updated.

[0028] (Soft Watermarking) In a multithreaded processor core, multiple threads may compete with each other for use of a shared resource, such as, for example, a load queue, a reservation station, or a register file. Use of a shared resource by a thread may include allocating one or more entries in the shared resource into which instructions for the thread may be written. For example, in the case of a load queue, those instructions may include load instructions to load data from memory into a register. An entry in a shared resource may be allocated to a thread for only a few clock cycles or for an extended number of clock cycles. After an entry in a shared resource is no longer allocated to a thread, it becomes available for reallocation to a thread, possibly including the thread that just deallocated the entry.

[0029] There are various reasons why an entry may be allocated to a particular thread for an extended number of clock cycles. Some of the reasons include, for example, a cache miss or an instruction having a dependency on another instruction or register. If a thread has too many entries allocated in a shared resource for an extended number of clock cycles, the thread may not be able to fully utilize the shared resource. For example, a thread may allocate additional entries in a shared resource because of a cache miss or an instruction or register dependency, or because an instruction in an entry previously allocated by the thread is still pending commit, retirement, processing, or dispatch. Meanwhile, other threads may have been able to use those additional entries for instructions that are ready to be processed or dispatched sooner.

[0030] The soft watermarking techniques disclosed herein prevent a thread from allocating additional entries in a shared resource when it is estimated that the thread would meet (e.g., exceed) its allocation goal if the thread were permitted to allocate additional entries. A thread may be prevented from doing this by excluding the thread from a thread arbitration decision in the current clock cycle in which the thread arbitration decision is made. Because the thread is excluded from the thread arbitration decision, it is not selected to use the shared resource in the current clock cycle. As a result, the thread is prevented from allocating additional entries in the shared resource beyond those already allocated to that thread in the current clock cycle.

[0031] In the next or subsequent clock cycles, an allocation estimate is again generated for the thread. Then, if the allocation estimate does not meet (e.g., is less than) its current allocation target, the thread is included in the thread arbitration decision in the subsequent clock cycle. By excluding a thread from the thread arbitration decision if its allocation estimate meets (e.g., is greater than or equal to) its allocation target, the number of entries in the shared resource that the thread can allocate is limited. This may be done temporarily when it is detected that the thread is underutilizing the shared resource, or to prevent the thread from underutilizing the shared resource. As a result, the overall throughput of the shared resource is improved for a particular workload.

[0032] Due to delays within the microprocessor, there may be several clock cycles (e.g., 3) between (a) a thread arbitration decision in the current clock cycle and (b) when the allocation counts maintained by the microprocessor for the thread and the shared resource are updated to reflect the number of entries in the shared resource that are allocated to the thread in the current clock cycle. This delay may be due to the way the microprocessor processes instructions in the pipeline stages. Specifically, the microprocessor's pipeline stage where the thread arbitration decision is made with respect to the shared resource may be several clock cycles ahead of the pipeline stage where the allocation counts are updated. Thus, in the current clock cycle when the thread arbitration decision is made, the number of entries that the thread has actually allocated in the shared resource may be unknown in the current clock cycle. Therefore, an allocation count estimate for a thread is generated to roughly estimate the number of entries that the thread has allocated in the current clock cycle. The allocation count estimate is then used in the current clock cycle to determine whether the thread should be excluded from a thread arbitration decision in the current clock cycle.

[0033] (Clock cycles) As used herein, the term "clock cycle" refers to a period associated with two successive pulses of an oscillator (e.g., a crystal oscillator) of a multithreaded microprocessor, unless the context clearly indicates otherwise. The start of the period associated with a clock cycle may be triggered or caused by the first pulse of the oscillator, and the end of the period associated with a clock cycle may be triggered or caused by the next pulse of the oscillator.

[0034] As used herein, reference may be made to various events occurring "at" a clock cycle. As used herein, a reference to an event occurring "at" a clock cycle refers to an event occurring at least during a period associated with the clock cycle, unless the context clearly indicates otherwise.

[0035] Also, references are made herein to various states that exist "in" a clock cycle. As used herein, references to states that exist "in" a clock cycle refer to states that exist for at least the time period associated with the clock cycle, unless the context clearly indicates otherwise.

[0036] Similarly, a reference to an event occurring "before" or "after" a clock cycle refers, respectively, to an event occurring at least before the period associated with the clock cycle, or at least after the period associated with the clock cycle, unless the context clearly indicates otherwise.

[0037] Similarly, references to a state existing "before" or "after" a clock cycle refer, respectively, to a state existing at least before the period associated with the clock cycle or a state existing at least after the period associated with the clock cycle, unless the context clearly indicates otherwise.

[0038] (a window of past clock cycles) In some possible embodiments, the allocation count estimate for a thread is based on recent usage of the shared resource by the thread. The recent usage may span a window of two or more recent consecutive clock cycles. For example, in a current clock cycle in which an allocation count estimate is being generated for a thread, the estimate may be based on usage of the shared resource by the thread over several previous consecutive clock cycles. The number of previous consecutive clock cycles on which the estimate is based may be, but need not be, the same as the number of clock cycles by which the allocation count of the thread and the shared resource lags behind the current clock cycle. For example, the allocation count estimate may be based on three previous consecutive clock cycles. Thus, the term "past window" refers to two or more previous consecutive clock cycles relative to the current clock cycle, unless the context clearly indicates otherwise.

[0039] (Allocation Goal) As used herein, the term "allocation target" refers to a number of entries of a shared resource that should not be exceeded, less than or equal to the number of entries allocated to a single thread in the current clock cycle, which may include all entries that were allocated to a thread during a previous clock cycle and are still allocated to that thread in the current clock cycle.

[0040] The allocation target may be based on the total number of entries in the shared resource. For example, if the total number of entries in the load queue is 50, then the allocation target may also be 50.

[0041] However, the allocation target may be less than the total number of entries in the shared resource. For example, the allocation target may be statically predefined as a number of entries that is less than the total number of entries of the shared resource. For example, the allocation target may be one-half, one-third, or some other percentage of the total number of entries of the shared resource.

[0042] The allocation goal may be a per-thread goal for a shared resource, or it may be a "global" allocation goal for all threads that use the shared resource. In other words, the allocation goal may be the same value for all threads that use the shared resource, or it may be different individual values ​​for different individual threads that use the shared resource. In the per-thread case, the allocation goal may vary from thread to thread.

[0043] Per-thread or global allocation goals may also be dynamically adjusted based on the usage of the shared resource. For example, based on detecting that a particular thread is not fully utilizing the shared resource (i.e., is an underutilized thread), the per-thread allocation goal of the particular thread may be dynamically lowered from the current allocation goal. Similarly, based on detecting that a particular thread is no longer an underutilized thread with respect to the shared resource, the allocation goal may be increased. Some possible techniques for dynamically adjusting allocation goals based on the usefulness of the shared resource to a thread are described in related U.S. patent application Ser. No. 16 / 585,424, filed Sep. 27, 2019.

[0044] (Meeting Allocation Goals) Reference is made herein to quota estimates that "meet" or "do not meet" quota targets. As used herein, reference to a quota estimate that meets a quota target means that the quota estimate is equal to or greater than the quota target, unless the context clearly indicates otherwise. Whether the quota estimate needs to exceed the quota target in order to meet it, rather than simply being equal to it, can be a matter of implementation choice made depending on the needs of a particular embodiment.

[0045] In some possible embodiments, to be considered as meeting the allocation target, the allocation number estimate is equal to or greater than the allocation target.

[0046] In other possible embodiments, the allocation number estimate must exceed the allocation target to be considered met; simply being equal to the allocation target is not sufficient to meet the allocation target.

[0047] In some possible embodiments, whether an allocation number estimate that is equal to an allocation target meets the allocation target depends on whether the previous allocation number estimate exceeded the allocation target. For example, if the previous allocation number estimate exceeded the allocation target, then a current allocation number estimate that is equal to the allocation target meets the allocation target. Alternatively, the current allocation number estimate may be considered not to meet the allocation target in that situation.

[0048] (Thread arbitration decision) A thread arbitration decision may be made to determine which of multiple threads competing or requesting use of the shared resource in the current clock cycle is selected to use the shared resource. The thread arbitration decision may be made according to a variety of different approaches, and the present application is not limited to any particular thread arbitration approach. For example, a round robin or least recently used approach may be used.

[0049] A thread may be removed from the thread arbitration decision based on the thread's allocation count estimate meeting the allocation goal. A thread arbitration decision is then made among the remaining threads that were not removed from the thread arbitration decision. For example, a round robin or least recently used approach may be used to select any of the remaining threads. As another alternative, the thread arbitration decision may select the remaining thread with the lowest allocation count in the current clock cycle to use the shared resource. As mentioned above, this allocation count may lag several clock cycles behind the current clock cycle. Thus, the allocation count of the selected thread reflects the actual number of entries that were allocated to the thread several cycles ago, which may not be the actual number of entries that are allocated to the thread in the current clock cycle. For example, the selected thread may have fewer or more entries allocated in the current clock cycle. As yet another alternative, the thread arbitration decision may select the remaining thread with the lowest allocation count estimate in the current clock cycle.

[0050] Multiple threads may be excluded from thread arbitration decisions in the current clock cycle by their respective allocation estimates satisfying the allocation target. In this case, if there are multiple remaining threads, thread arbitration decisions may be made among the remaining threads (e.g., according to a round robin, LRU, lowest allocation count, or lowest allocation estimate approach). If only one thread remains, that thread may be selected to use the shared resource in the current clock cycle.

[0051] It should be noted that not all threads may be requesting or competing for use of the shared resource in the current clock cycle. For example, some of the threads may not be requesting use of the shared resource in the current clock cycle. Thus, another reason that a thread arbitration decision in the current clock cycle may not include all threads is that some of the threads do not request use of the shared resource in the current clock cycle.

[0052] It is also possible that all threads are excluded from thread arbitration decisions in the current clock cycle due to their respective allocation number estimates meeting their allocation goals. In this case, a fallback arbitration approach may be used. The fallback approach may be round robin, least recently used, lowest allocation count, or lowest allocation number estimate.

[0053] A thread may also be excluded from thread arbitration decisions in the current clock cycle for reasons other than the thread's allocation count estimate meeting its allocation goal: for example, a thread may be excluded from thread arbitration decisions because the thread is not ready to allocate an entry in a shared resource or because the thread is in a stalled state.

[0054] It is also possible that no threads are excluded from thread arbitration decisions in the current clock cycle. For example, each thread's allocation estimate may not meet its allocation target in the current clock cycle. In that case, all threads participate in thread arbitration decisions in the current clock cycle, assuming they are otherwise eligible to participate.

[0055] (Allocation Count) In some possible embodiments, the number of entries that a thread has been allocated in the shared resource in the current clock cycle in which a thread arbitration decision is made is tracked, and may be referred to herein as the thread's "allocation count."

[0056] In some possible embodiments, if a thread's allocation count meets its allocation goal, the thread is excluded from thread arbitration decisions in the current clock cycle. A thread's allocation count may be updated in each clock cycle and evaluated in each clock cycle in which a thread arbitration decision is made. In some possible embodiments, a thread's allocation count lags the number of entries allocated to the thread in the current clock cycle by a number of clock cycles. This lag may be due to the nature of pipeline stage processing in a microprocessor. For example, the number of clock cycles delayed may be one, two, or three clock cycles. As a result, the number of entries allocated to a thread in the current clock cycle is not reflected in the thread's allocation count until a number of clock cycles after the current clock cycle. The techniques disclosed herein take this lag into account by determining an allocation number estimate as described in more detail elsewhere herein.

[0057] (Selection count) In some possible embodiments, the number of times a thread was selected to use a shared resource during the past window is tracked in the current clock cycle in which a thread arbitration decision is made. This number may be referred to herein as the "selection count" of the thread. For example, if the past window includes three clock cycles and the thread was selected to use the shared resource for two of the three clock cycles in the past window, the selection count of the thread in the current clock cycle may be two.

[0058] In some possible embodiments, if the sum of a thread's allocation count and selection count meets the allocation goal, the thread is excluded from thread arbitration decisions in the current clock cycle. A thread's selection count may be updated each clock cycle based on a sliding past window. For example, a thread's selection count may reflect the number of times the thread has been selected to use a shared resource in the past three clock cycles.

[0059] (Expected allocation per selection) In some possible embodiments, as part of a thread arbitration decision in the current clock cycle, an "expected allocations per selection" is considered, which is the number of entries that are expected to be allocated to a thread each time the thread is selected to use a shared resource during a sliding past window in the current clock cycle.

[0060] The expected number of allocations per selection can be statically defined. For example, the expected number of allocations per selection can be 1-4 entries. In some possible embodiments, the expected number of allocations per selection is determined heuristically or empirically. For example, the expected number of allocations per selection can be statically defined as 2.

[0061] The expected allocations per selection can also be tracked on a per-thread basis, for example, the expected allocations per selection for a thread can be the average of the allocations per cycle for each clock cycle during the past window in which the thread was selected to use the shared resource.

[0062] In some possible embodiments, a thread is excluded from thread arbitration decisions in the current clock cycle if the sum of (a) the thread's allocation count in the current clock cycle (which may lag behind the actual number of entries allocated to the thread in the current clock cycle) and (b) the product of the thread's selection count and the expected number of allocations per selection meets the allocation target.

[0063] (Example of soft watermarking) An estimate of the number of threads allocated to a thread in the current clock cycle can be generated. There are several different ways that the estimate can be generated.

[0064] In one possible approach, the allocation number estimate is generated based on the allocation count of the thread, for example, the allocation number estimate can be the allocation count in the current clock cycle.

[0065] In another possible method, the allocation number estimate is generated based on the allocation count and the selection count of a thread. For example, the allocation number estimate can be the sum of the allocation count of a thread and the selection count of the thread in the current clock cycle.

[0066] In yet another possible method, an allocation estimate is generated based on the allocation count of the thread, the select count of the thread, and the expected allocations per cycle. For example, the allocation estimate may be the allocation count of the thread in the current clock cycle plus the select count of the thread in the current clock cycle multiplied by the expected allocations per cycle. The expected allocations per cycle may be statically defined as the expected allocations per cycle tracked for the thread in the current clock cycle.

[0067] FIG. 3 illustrates an example of thread arbitration decisions over seven consecutive clock cycles in table form, according to some possible embodiments. In this example, three threads are included. However, thread arbitration decisions for a shared resource in a multi-threaded microprocessor may include slightly more than two or three threads (e.g., four or eight). Note that not all threads may request use of the resource in each clock cycle. If a thread is not requesting use of the shared resource in the current clock cycle, it is not included in the thread arbitration decision in the current clock cycle, and therefore is not excluded from the thread arbitration decision in the current clock cycle according to the soft watermarking techniques disclosed herein. In FIG. 3, "S" is used to indicate that the corresponding thread is selected to use the shared resource in the corresponding clock cycle. "R" is used to indicate that the corresponding thread is excluded from the thread arbitration decision in the corresponding clock cycle. In either case, the corresponding thread may be requesting use of the shared resource in the corresponding clock cycle. If a table cell for a corresponding thread and a corresponding clock cycle in the table is blank, the corresponding thread may have requested use of the shared resource in the corresponding clock cycle, but was not selected to use the shared resource in the corresponding clock cycle and was not excluded from the thread arbitration decision in the corresponding clock cycle, or the corresponding thread may not have requested use of the shared resource in the corresponding clock cycle.

[0068] In clock cycle 0, thread 2 is selected to use the shared resource. In clock cycle 1, thread 2 is again selected to use the shared resource. In clock cycle 2, thread 2 is excluded from the thread arbitration decision in clock cycle 2 because the allocation number estimate of thread 2 in clock cycle 2 meets the allocation goal. Also, in clock cycle 2, thread 1 is selected to use the shared resource. In clock cycle 3, thread 2 is excluded from the thread arbitration decision in clock cycle 3 because the allocation number estimate of thread 2 in clock cycle 3 meets the allocation goal. Also, in clock cycle 3, thread 3 is selected to use the shared resource. In clock cycle 4, thread 1 is selected to use the shared resource. In clock cycle 5, thread 2 is selected to use the shared resource. In clock cycle 6, thread 2 is excluded from the thread arbitration decision because the allocation number estimate of thread 2 in clock cycle 6 meets the allocation goal. Also, in clock cycle 6, thread 3 is selected to use the shared resource.

[0069] Each time a thread is selected to use the shared resource, one or more additional entries in the shared resource may be allocated to the selected thread. These additional allocations may be reflected in the thread's allocation count a number of clock cycles (e.g., three) after the thread is selected to use the shared resource in the current clock cycle. Also, entries in the shared resource that are allocated to a thread may become unallocated (deallocated) from that thread when the instructions in those entries are processed, dispatched, committed, or retired.

[0070] 4 shows an example of soft watermarking in table form using the example thread arbitration decision of FIG. 3, according to some possible embodiments. In this example, the size of the past window is 3 clock cycles, i.e., with respect to a current clock cycle, the past window of the current clock cycle includes the past 3 clock cycles relative to the current clock cycle.

[0071] The example of Figure 4 shows tracked information and soft watermarking calculations for only Thread 2. In the example of Figure 3, similar information and similar soft watermarking calculations are tracked and performed for Thread 1 and Thread 3.

[0072] At clock cycle 0, thread 2 has an allocation goal of 40, an allocation count of 35, a selection count of 0, and an expected number of allocations per selection of 2. The estimated number of allocations for thread 2 at future clock cycle 3 is calculated to be 35. Because the estimated number of allocations of 35 does not meet the allocation goal of 40, thread 2 is included in the thread arbitration decision at clock cycle 0.

[0073] In clock cycle 1, thread 2 has an allocation goal of 40, an allocation count of 35, a selection count of 1, and an expected number of allocations per selection of 2. The estimated allocation count for thread 2 in the future clock cycle 4 is calculated to be 37. Because the estimated allocation count of 37 does not meet the allocation goal of 40, thread 2 is not excluded from the thread arbitration decision in clock cycle 1.

[0074] In clock cycle 2, thread 2 has an allocation goal of 40, an allocation count of 37, a selection count of 2, and an expected number of allocations per selection of 2. The estimated allocation count for thread 2 in the future clock cycle 5 is calculated to be 41. Because the estimated allocation count of 41 meets the allocation goal of 40, thread 2 is excluded from the thread arbitration decision in clock cycle 2.

[0075] In clock cycle 3, thread 2 has an allocation goal of 40, an allocation count of 37, a selection count of 2, and an expected number of allocations per selection of 2. The estimated allocation count for thread 2 in the future clock cycle 6 is calculated to be 41. Because the estimated allocation count of 41 meets the allocation goal of 40, thread 2 is not included in the thread arbitration decision in clock cycle 3.

[0076] In clock cycle 4, thread 2 has an allocation goal of 40, an allocation count of 35, a selection count of 1, and an expected number of allocations per selection of 2. The allocation count estimate for thread 2 in the future clock cycle 7 (not shown) is calculated to be 37. Because the allocation count estimate of 37 does not meet the allocation goal of 40, thread 2 is included in the thread arbitration decision in clock cycle 4.

[0077] At clock cycle 5, thread 2 has an allocation goal of 40, an allocation count of 37, a selection count of 1, and an expected number of allocations per selection of 2. The allocation count estimate for thread 2 at future clock cycle 8 (not shown) is calculated to be 37. Because the allocation count estimate of 37 does not meet the allocation goal of 40, thread 2 is not excluded from the thread arbitration decision at clock cycle 5.

[0078] At clock cycle 6, thread 2 has an allocation goal of 40, an allocation count of 39, a selection count of 1, and an expected number of allocations per selection of 2. The estimated allocation count for thread 2 at future clock cycle 9 (not shown) is calculated to be 41. Because the estimated allocation count of 41 meets the allocation goal of 40, thread 2 is excluded from the thread arbitration decision at clock cycle 6.

[0079] In this example, the allocation target remained constant, however, as noted above, the allocation target may in some possible embodiments be dynamically adjusted up or down over clock cycles based on the availability of the shared resource to the threads.

[0080] (Example of soft watermarking processing) Figure 5 illustrates a flow chart of an example process for soft watermarking, according to some possible embodiments. Most of the process 500 illustrated in Figure 5 has been described elsewhere herein, for example, in connection with the examples of Figures 3 and 4. As such, for clarity, the process 500 will be described primarily in terms where the information illustrated differs from the information described elsewhere herein.

[0081] Generally, FIG. 5 illustrates a soft watermarking process for a set of threads competing or requesting use of a shared resource in a multi-threaded microprocessor.

[0082] At operation 510, a per-thread allocation count is maintained for each thread in the set of threads for the shared resource. A thread's per-thread allocation count is updated at each clock cycle. A thread's per-thread allocation count at a current clock cycle reflects the number of entries in the shared resource that were allocated to that thread several clock cycles prior to the current clock cycle at which a thread arbitration decision is made. When an entry in the shared resource is allocated to a thread, the updated allocation count for that thread includes the allocated entry. And when an entry is no longer allocated to a thread, the updated allocation count for that thread no longer includes the previously allocated entry.

[0083] It is possible that the per-thread allocation count of each thread in the set of threads lags behind the thread arbitration decision in the current clock cycle by several clock cycles. In this case, the per-thread allocation count of a thread in the current clock cycle may actually reflect the number of entries in the shared resource that were allocated to that thread several clock cycles prior to the current clock cycle. Similarly, the number of entries that are allocated to a thread in the current clock cycle may be reflected in the per-thread allocation count of that thread several clock cycles after the current clock cycle in which the thread arbitration decision is made. To account for this lag, in operation 520, a per-thread selection count is maintained for each thread in the set of threads for the shared resource over a sliding past window. The per-thread selection count of a thread in the current clock cycle reflects the number of times the thread was selected to use the shared resource during the current sliding past window in the current clock cycle. The per-thread selection count is updated at each clock cycle and may include several clock cycles in the past (past window). For example, the number of clock cycles in the past of the sliding window may be the same as the number of clock cycles that the per-thread allocation count lags behind the current clock cycle. For example, for a current clock cycle, the per-thread selection count may include the past three clock cycles, not including the current clock cycle. As noted above, a thread's selection count for a shared resource indicates the number of times that the thread has been selected to use the shared resource as a result of a thread arbitration decision within the current sliding window in the current clock cycle.

[0084] In operation 530, a per-thread allocation estimate is calculated for each thread in the set of threads in the current clock cycle. Operation 530 is performed for each thread that is the next to be selected and that has requested use of the shared resource in each clock cycle. The allocation estimate for a thread is calculated based on the allocation count of the thread in the current clock cycle and the selection count of the thread. For example, the allocation estimate for a thread may be calculated as the sum (sum) of (A) the allocation count of the thread in the current clock cycle and (B) the product of the selection count of the thread and the expected allocation number per selection (e.g., 2) in the current clock cycle.

[0085] In operation 540, the allocation number estimates calculated for each thread in operation 530 are compared to an allocation target. The allocation target may be a global allocation target or a per-thread allocation target. The allocation target may be statically defined or dynamically adjusted. If the allocation number estimates calculated for a thread meet the allocation target, the thread is excluded from thread arbitration decisions in the current clock cycle, so that the thread is not eligible to be selected to use the shared resource in the current clock cycle. On the other hand, if the allocation number estimates calculated for a thread do not meet the allocation target, the thread remains eligible for thread arbitration decisions in the current clock cycle, so that the thread may be selected to use the shared resource in the current clock cycle. However, in this case, the thread may still be excluded from thread arbitration decisions in the current clock cycle for other reasons.

[0086] (Conclusion) The foregoing detailed description has described possible embodiments with reference to numerous specific details that may vary from embodiment to embodiment. Accordingly, the detailed description and drawings should be regarded in an illustrative sense and not in a limiting sense.

[0087] Reference to a possible embodiment or to several possible embodiments in the detailed description is not intended to imply that the embodiment(s) does not include other embodiments or other embodiments, unless the context clearly indicates otherwise. Thus, the described embodiments may be combined in specific combinations with one or more other embodiments, unless the context clearly indicates that the embodiments are incompatible. Moreover, the described embodiments are intended to be described by way of example, not by way of limitation.

[0088] In the above detailed description and the appended claims, terms such as first, second, etc. are sometimes used herein to describe various elements, but these elements should not be limited by these terms. These terms are used only to distinguish one element from another. For example, a first user interface may be referred to as a second user interface, and similarly, a second user interface may be referred to as a first user interface, without departing from the scope of the present disclosure. The first user interface and the second user interface are both user interfaces, but are not the same user interface.

[0089] As used in the foregoing detailed description and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise. As used in the foregoing detailed description and the appended claims, the term "and / or" refers to and includes any and all possible combinations of one or more of the associated listed items.

[0090] As used in the foregoing detailed description and the appended claims, the terms "based on", "according to", "includes", "including", "comprises" and / or "comprising" indicate the presence of stated features, integers, steps, operations, elements and / or components but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

Claims

1. A shared resource (210) having multiple entries for use by multiple threads; a thread arbitration logic (220); The thread arbitration logic (220): Calculating (530) an allocation estimate for a thread of the plurality of threads and the shared resource, the allocation estimate being an estimate of a cardinality of a set of entries of the plurality of entries that are assigned to the thread in a current clock cycle; determining (540) whether the allocation estimate satisfies an allocation goal (221), the allocation goal being a cardinality of a not-to-exceed number of entries that may be allocated to the thread; excluding the thread from thread arbitration decisions based on a determination that the allocation number estimate for the thread satisfies the allocation goal (550); [0023] A multi-threaded microprocessor core (100).

2. The thread arbitration logic includes: and calculating (530) the number of assignments estimate based on the cardinality of a set of entries of the plurality of entries that were assigned to the thread in a clock cycle past the current clock cycle.

2. The multithreaded microprocessor core of claim 1.

3. The thread arbitration logic (220): and calculating (530) the number of allocation estimates based on a number of times the thread was selected to use the shared resource prior to the current clock cycle.

2. The multithreaded microprocessor core of claim 1.

4. The thread arbitration logic includes: (a) a cardinality of a set of entries among the plurality of entries that were assigned to the thread in a clock cycle past the current clock cycle; and (b) the product of (b1) the number of times that the thread was selected to use the shared resource prior to the current clock cycle and (b2) a predetermined number of entries; and further configured to calculate (530) the number of allocations estimate based on the sum of 2. The multithreaded microprocessor core of claim 1.

5. The thread arbitration logic includes: maintaining (510) an allocation count (222) for each of a number of clock cycles, the allocation count for each of the number of clock cycles being the cardinality of a set of entries of the number of entries that were assigned to the thread in a previous clock cycle; calculating (530) the estimate of the cardinality of the set of entries assigned to the thread in the current clock cycle based on the assignment count in the current clock cycle; and further configured to:

2. The multithreaded microprocessor core of claim 1.

6. The thread arbitration logic includes: maintaining (520) a selection count (223) over a sliding window of multiple clock cycles, the selection count in the current clock cycle being the number of times the thread was selected to use the shared resource by a thread arbitration decision during a window of multiple clock cycles preceding the current clock cycle; calculating (530) the estimate of the cardinality of the set of entries assigned to the thread in the current clock cycle based on the selection count in the current clock cycle; and further configured to:

2. The multithreaded microprocessor core of claim 1.

7. The thread arbitration logic includes: and calculating (530) the allocation estimate based on an assumption of a number of entries of the plurality of entries that the thread is expected to allocate if the thread is selected to use the shared resource.

2. The multithreaded microprocessor core of claim 1.

8. for each thread of the plurality of threads, a corresponding register for holding an allocation count (222) for the each thread and the shared resource; and for each thread of the plurality of threads, a corresponding register for holding a selection count (223) for the each thread and the shared resource; the thread arbitration logic is further configured to determine the allocation number estimate based on the corresponding register holding the allocation count of the thread and the corresponding register holding the selection count of the thread.

2. The multithreaded microprocessor core of claim 1.

9. The thread arbitration logic includes: and further configured to select, as a result of the thread arbitration decision, a thread other than the thread from among the plurality of threads to use the shared resource. A multi-threaded microprocessor core according to any one of claims 1 to 8.

10. the shared resource is a load queue, a reservation station, or a register file of the multi-threaded microprocessor core; A multi-threaded microprocessor core according to any one of claims 1 to 8.

11. the shared resource has a predetermined total number of entries, and the not-to-exceed number of entries is the total number of entries. A multi-threaded microprocessor core according to any one of claims 1 to 8.

12. the shared resource has a predetermined total number of entries, the not-exceeding number of entries being less than the total number of entries. A multi-threaded microprocessor core according to any one of claims 1 to 8.

13. The thread arbitration logic (220): and excluding (550) the thread from thread arbitration decisions based on a determination that the allocation number estimate for the thread is equal to or exceeds the allocation target. A multi-threaded microprocessor core according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Thread arbitration system, processor, video recording and reproducing device, and thread arbitration method

    JP2012048399A

  • Dynamic allocation of resources in a threaded, heterogeneous processor

    US20100299499A1

  • Opportunistic multi-thread method and processor

    US20140351568A1

  • Thread interleaving in a multithreaded embedded processor

    US7360064B1

  • Dynamic mitigation of thread hogs on a threaded processor

    US8347309B2