The present disclosure generally relates to the field of electronics. More particularly, an embodiment of the invention relates to dynamic management of cache sizes during run-time.
To improve performance, some processors may include a cache. Generally, a cache may store copies of data from most frequently used main memory locations. Since a cache has lower average access time than main memory, data stored in a cache may be fetched more quickly, resulting in improved performance. Therefore, increasing cache size may further enhance performance by improving the cache hit rate (or reducing potential cache misses). However, as the size of a cache is increased, the additional cache cells may consume more power. The additional power consumption may increase overall system average power which may, in turn, decrease the battery life of mobile computers. The additional power consumption may also increase heat generation which may, in turn, cause damage to the cache or other components of a computer that are thermally coupled to the cache. The additional heat may further limit the locations where a computer with a large cache may be used, for example, due to heat dissipation requirements.
The detailed description is provided with reference to the accompanying figures. In the figures, the left-most digit(s) of a reference number identifies the figure in which the reference number first appears. The use of the same reference numbers in different figures indicates similar or identical items.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of various embodiments. However, various embodiments of the invention may be practiced without the specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail so as not to obscure the particular embodiments of the invention. Further, various aspects of embodiments of the invention may be performed using various means, such as integrated semiconductor circuits (“hardware”), computer-readable instructions organized into one or more programs (“software”), or some combination of hardware and software. For the purposes of this disclosure reference to “logic” shall mean either hardware, software, or some combination thereof.
Some of the embodiments discussed herein may provide efficient mechanisms for managing the size of a cache, e.g., during run-time. In one embodiment, the size of a cache (such as the caches discussed with reference to
More particularly,
In an embodiment, the processor 102-1 may include one or more processor cores 106-1 through 106-M (referred to herein as “cores 106,” or “core 106”), a cache 108, and/or a router 110. The processor cores 106 may be implemented on a single integrated circuit (IC) chip. Moreover, the chip may include one or more shared and/or private caches (such as cache 108), buses or interconnections (such as a bus or interconnection 112), memory controllers (such as those discussed with reference to
In one embodiment, the router 110 may be used to communicate between various components of the processor 102-1 and/or system 100. Moreover, the processor 102-1 may include more than one router 110. Furthermore, the multitude of routers 110 may be in communication to enable data routing between various components inside or outside of the processor 102-1.
The cache 108 may store data (e.g., including instructions) that are utilized by one or more components of the processor 102-1, such as the cores 106. For example, the cache 108 may locally cache data stored in a memory 114 for faster access by the components of the processor 102 (e.g., faster access by cores 106). As shown in
As illustrated in
In an embodiment, the management logic 208 may be capable of flushing individual cache portions and/or disabling access to the cache portions. For example, a power transistor may be coupled to each portion of the cache 200 to control the supply of power to individual cache portions. In some embodiments, one or more of the storage units 209 may be designated as one or more configuration registers that are capable of accepting input that modifies the configuration details, e.g., such as: shrink and/or expand thresholds, shrink step size, history queue depth, sampling interval, etc., as will be further discussed herein, for example, with reference to
Referring to
In an embodiment, at operation 304, the CBM may be determined based on the following:
CBM Value=[(CyclesProcessor
In the above formula, CyclesProcessor
In an embodiment, the calculated CBM at operation 304 may be an indicator of cache utilization, e.g., based upon cache accesses over a select time period (as tracked by the management logic 208 that causes corresponding data to be stored in the units 209, for example). At an operation 305, the calculated CBM value of operation 304 may be stored in a history queue, e.g., displacing the oldest value. At operation 306, the CBM may be mapped against an expand threshold and if greater, the active portion of the cache may be expanded (e.g., fully) at an operation 308, e.g., by accessing the storage units 209 and having the management logic 208 cause an increase in the size of the active portion of the cache 200 (for example, by opening additional cache ways 204). An embodiment may partially expand or use multiple expand thresholds to determine the new target cache size at operations 308 and 306, respectively.
At operation 306, if the CBM does not exceed the expand threshold, values within a history queue (which may be stored in the storage units 209) may be averaged and the subsequent result may be compared to a shrink threshold at operation 310. If the result falls below the shrink threshold and the active portion of the cache is greater than a minimum cache size threshold value at operation 312, the size of the active portion of the cache may be decreased (e.g., a pre-configured portion of the cache may be flushed (for example, by logic 208 or other logic within the controller 206) and access may be disabled at operation 314 (such as discussed with reference to
In an embodiment, the configuration values may be about: 11.11 for expand threshold of operation 306, 5.60 for shrink threshold of operation 310, 8 for the history queue depth of operation 310, 250 ms for the evaluation period (Time_1) discussed above, a step size of 2 for size increases or decreases of operation 308 and/or 314, etc. Step size may refer to the granularity of cache shrinking. For example, if the step size is 1, the cache may be shrunk one way (provided the cache is not already in its minimum size as determined at operation 312, for example). Likewise if the step size value is 2, the cache may be shrunk by 2 ways and so on. So if the cache has 8 ways and the step size is 1, the shrink sequence may be 8, 7, 6, 5, 4, 3, 2 and if step size is 2, the sequence is 8, 6, 4, 2.
Moreover, some of these values may be somewhat conservative. Changing these values may make the cache shrinking behavior more aggressive, but perhaps at the cost of performance. In an embodiment, the recommendation for the setting may be based on the power/performance objectives of a user. Further, configuration options at initialization time may include providing one or more the above values in accordance with an embodiment. Additionally, in one embodiment, run-time re-configuration may be performed based on external policy (AC/DC, user preference, etc.).
As shown in
Accordingly, some embodiments of the invention relate to techniques for dynamically determining the correct cache size (e.g., cache ways) based upon cache utilization, thus allowing cache size (e.g., cache ways) to be shrunk and expanded to meet system demand. Given the direction of larger processor LLC sizes and more efficient power transistors, such embodiments may provide opportunities to run systems with less cache, thus allowing greater opportunities for power-savings techniques to be applied. In addition to possible (e.g., run-time) power management savings, some of the embodiments are capable of pre-shrinking caches to allow cooperative cache-shrinking technologies (such as deep C4 in accordance with at least one instruction set architecture) to invoke more often. An additional embodiment may involve the use of the calculated CBM data to augment the expand/shrink decisions of existing technologies (such as deep C4).
A chipset 406 may also communicate with the interconnection network 404. The chipset 406 may include a memory control hub (MCH) 408. The MCH 408 may include a memory controller 410 that communicates with a memory 412 (which may be the same or similar to the memory 114 of
The MCH 408 may also include a graphics interface 414 that communicates with a graphics accelerator 416. In one embodiment of the invention, the graphics interface 414 may communicate with the graphics accelerator 416 via an accelerated graphics port (AGP). In an embodiment of the invention, a display (such as a flat panel display, a cathode ray tube (CRT), a projection screen, etc.) may communicate with the graphics interface 414 through, for example, a signal converter that translates a digital representation of an image stored in a storage device such as video memory or system memory into display signals that are interpreted and displayed by the display. The display signals produced by the display device may pass through various control devices before being interpreted by and subsequently displayed on the display.
A hub interface 418 may allow the MCH 408 and an input/output control hub (ICH) 420 to communicate. The ICH 420 may provide an interface to I/O devices that communicate with the computing system 400. The ICH 420 may communicate with a bus 422 through a peripheral bridge (or controller) 424, such as a peripheral component interconnect (PCI) bridge, a universal serial bus (USB) controller, or other types of peripheral bridges or controllers. The bridge 424 may provide a data path between the processor 402 and peripheral devices. Other types of topologies may be utilized. Also, multiple buses may communicate with the ICH 420, e.g., through multiple bridges or controllers. Moreover, other peripherals in communication with the ICH 420 may include, in various embodiments of the invention, integrated drive electronics (IDE) or small computer system interface (SCSI) hard drive(s), USB port(s), a keyboard, a mouse, parallel port(s), serial port(s), floppy disk drive(s), digital output support (e.g., digital video interface (DVI)), or other devices.
The bus 422 may communicate with an audio device 426, one or more disk drive(s) 428, and one or more network interface device(s) 430 (which is in communication with the computer network 403). Other devices may communicate via the bus 422. Also, various components (such as the network interface device 430) may communicate with the MCH 408 in some embodiments of the invention. In addition, the processor 402 and the MCH 408 may be combined to form a single chip. Furthermore, the graphics accelerator 416 may be included within the MCH 408 in other embodiments of the invention.
Furthermore, the computing system 400 may include volatile and/or nonvolatile memory (or storage). For example, nonvolatile memory may include one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), a disk drive (e.g., 428), a floppy disk, a compact disk ROM (CD-ROM), a digital versatile disk (DVD), flash memory, a magneto-optical disk, or other types of nonvolatile machine-readable media that are capable of storing electronic data (e.g., including instructions). In an embodiment, components of the system 400 may be arranged in a point-to-point (PtP) configuration. For example, processors, memory, and/or input/output devices may be interconnected by a number of point-to-point interfaces.
In various embodiments of the invention, the operations discussed herein, e.g., with reference to
Additionally, such computer-readable media may be downloaded as a computer program product, wherein the program may be transferred from a remote computer (e.g., a server) to a requesting computer (e.g., a client) by way of data signals embodied in a carrier wave or other propagation medium via a communication link (e.g., a bus, a modem, or a network connection). Accordingly, herein, a carrier wave shall be regarded as comprising a machine-readable medium.
For example, a computer-readable medium may comprise one or more instructions that when executed on a processor configure the processor to: determine a cache busyness metric of a cache based on stored data; and adjust a size of an active portion of the cache based on a value of the cache busyness metric. The one or more instructions may further configure the processor to add the value of the cache busyness metric to a history queue. Also, the one or more instructions may adjust the size of the active portion of the cache is performed in response to a comparison of an average of values stored in a history queue and a shrink threshold. In an embodiment, the one or more instructions may adjust the size of the active portion of the cache is performed in response to a comparison of: an average of values stored in a history queue and a shrink threshold; and the size of the active portion of the cache and a minimum cache size threshold value.
Reference in the specification to “one embodiment” or “an embodiment” means that a particular feature, structure, and/or characteristic described in connection with the embodiment may be included in at least an implementation. The appearances of the phrase “in one embodiment” in various places in the specification may or may not be all referring to the same embodiment.
Also, in the description and claims, the terms “coupled” and “connected,” along with their derivatives, may be used. In some embodiments of the invention, “connected” may be used to indicate that two or more elements are in direct physical or electrical contact with each other. “Coupled” may mean that two or more elements are in direct physical or electrical contact. However, “coupled” may also mean that two or more elements may not be in direct contact with each other, but may still cooperate or interact with each other.
Thus, although embodiments of the invention have been described in language specific to structural features and/or methodological acts, it is to be understood that claimed subject matter may not be limited to the specific features or acts described. Rather, the specific features and acts are disclosed as sample forms of implementing the claimed subject matter.