Hardware prefetch improvements for large language model inference accuracy
Patent Information
- Application Number
- PCT/CN2024/080735
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-03-08
- Publication Date
- 2025-10-02
AI Technical Summary
Generative large language models (LLMs) face significant challenges with high cache miss rates and increased latency due to their large memory footprint, which traditional hardware prefetching techniques struggle to address effectively, particularly in terms of coverage and timeliness.
A data-aware prefetching technology with a hybrid read/write pending queue design and a dedicated buffer to track memory access patterns, combined with a new LOAD instruction for key-value cache entries, enhances prefetching effectiveness by filtering out noise and optimizing prefetching for LLMs.
The solution improves prefetching coverage and timeliness, reducing cache misses and latency, and adapts to various memory access characteristics, enhancing performance for LLMs and other applications with different memory access patterns.
Smart Images

Figure CN2024080735_02102025_PF_FP_ABST
Abstract
Description
HARDWARE PREFETCH IMPROVEMENTS FOR LARGE LANGUAGE MODEL INFERENCE ACCURACYBACKGROUND
[0001] Generative large language models (LLMs, e.g., CHATGPT) typically deal with billions of parameters, which leads to a large memory footprint and high message passing rates. As a result, increased latency may be encountered during inference operations in generative LLMs.BRIEF DESCRIPTION OF THE DRAWINGS
[0002] The various advantages of the embodiments will become apparent to one skilled in the art by reading the following specification and appended claims, and by referencing the following drawings, in which:
[0003] FIG. 1 is an illustration of an example of a key / value (KV) cache optimization according to an embodiment;
[0004] FIG. 2 is a block diagram of an example of a computation flow for a single token traversing multiple network layers according to an embodiment;
[0005] FIG. 3 is a flowchart of an example of a method of operating a hint generator and a prefetcher according to an embodiment;
[0006] FIG. 4 is a flowchart of an example of a more detailed method of operating a prefetcher according to an embodiment;
[0007] FIG. 5 is a schematic diagram of an example of a memory hierarchy and a hardware-based prefetcher according to an embodiment;
[0008] FIG. 6 is a comparative block diagram of an example of a conventional pending queue architecture and enhanced pending queue architectures according to embodiments;
[0009] FIG. 7 is a block diagram of an example of a performance-enhanced computing system according to an embodiment;
[0010] FIG. 8 is an illustration of an example of a semiconductor package apparatus according to an embodiment;
[0011] FIG. 9 is a block diagram of an example of a processor according to an embodiment; and
[0012] FIG. 10 is a block diagram of an example of a multi-processor based computing system according to an embodiment.DETAILED DESCRIPTION
[0013] Typically, humans can read 250 words / minute (min) to 1000 words / min. Generative artificial intelligence (AI) models such as large language models (LLMs) split text into smaller units called tokens (e.g., tokenization) that can be fed into the language model. The tokenization process can result in around 1.5-2 tokens per word on average for English language text, and this ratio can be higher for other languages. Assuming two tokens per word, a generative LLM would therefore need to conduct inference operations at a rate of approximately 30~120ms per token to match human performance. Accordingly, delivering low inference latency is important to generative LLMs.
[0014] Prefetching may involve transferring data from system memory (e.g., dynamic random access memory / DRAM) to caches residing on processing hardware prior to the data being requested by the underlying AI model (e.g., reducing the likelihood of a cache miss, which can increase latency) . Traditionally, hardware prefetching for high performance computing (HPC) and analytics applications may be a common technique to hide memory latency due to cache miss penalty, and therefore improve the response time and latency.
[0015] Generative LLMs, however, have unique / different behavior from traditional enterprise and cloud applications. For example, CHATGPT processes hundreds of billions of trainable parameters and the associated large memory footprint results in much higher cache miss per instruction (MPI) (e.g., ~10x higher) in comparison with other workloads such as convolutional neural network (CNN) -based deep-learning models (e.g., You Only Look Once / YOLO object detection, e.g., YOLO version 5 / YOLOv5) and analytics applications (e.g., Transaction Processing Performance Council –Decision Support / TPC-DS performance evaluation, purchase decision and benchmark publication) .
[0016] Coverage, timeliness, and accuracy are three metrics in evaluating hardware prefetcher design. Coverage is the fraction of total misses that are eliminated by prefetching (e.g., the number of useful prefetches divided by the total number of demand misses) . Timeliness indicates how soon a prefetched cache line is consumed by a demand access. Being “late” means that a load executes on the targeted data before the prefetch completes. Being “early” means that the data is prefetched, but some time passes and the prefetched data is evicted before the application accesses the data (e.g., causing the application to re-fetch the data) . Accuracy is the number of useful prefetches divided by the number of total issued prefetches, which is relatively straightforward in HPC-like applications. The technology described herein provides substantial improvements with respect to coverage and timeliness.
[0017] Coverage for generative LLM workloads is substantially less than (e.g., approximately half) the coverage of other workloads such as YOLOv5 and TPC-DS. Moreover, a read pending queue, which tracks outstanding read requests to DRAM, is much more likely to be blocked when executing a generative LLM workload than when executing YOLOv5 and TPC-DS (e.g., 2.5x and 11x, respectively) . The much higher pressure increases the difficulty in timely delivering the data as well as uncertainty.
[0018] To address the challenge of coverage and timeliness, embodiments include data-aware prefetching technology with a hybrid read / write (RD / WR) pending queue design. For example, the technology described herein (1) filters out “noise” due to a large memory footprint with software assistance; and (2) optimizes the RD / WR pending queue usage for applications with different RD / WR characteristics.
[0019] To improve the hardware prefetching effectiveness, both coverage and timeliness are handled simultaneously. As already noted, the technology described herein includes (1) a data-aware prefetcher with hinted instruction and a dedicated buffer to help the prefetcher effectively track and recognize memory access patterns; and (2) a hybrid read pending queue (RPQ) / write pending queue (WPQ) design to reduce the queuing pressure under the same hardware investment.
[0020] As will be discussed in greater detail, the key data structure of a key-value (KV) cache can be used as an example. One common software optimization and implementation is to reuse previously calculated self attention key-value pairs instead of recalculating the key-value pairs for each generated token. Unfortunately, due to the large memory footprint and relatively long reuse distance (e.g., KV cache accesses are not purely sequential) , such reuse patterns are usually difficult to detect effectively via traditional hardware prefetchers.
[0021] The technology described herein introduces a new instruction to convey prefetch hints to the caches. With software assistance (e.g., enhanced deep learning (DL) compiler “codegen” to use a new LOAD instruction to load KV entries) , a special hardware buffer is dedicated to track the hinted LOAD instructions. By filtering out the “noise” of data requests that are not likely to be reused (e.g., which can be substantial in number due to the large memory footprint) , the hint helps recognize the memory access pattern more quickly and accurately. As a result, the solution improves the prefetching coverage.
[0022] The technology described herein also provides a hybrid RPQ / WPQ design. Instead of using dedicated queues for outstanding RD and WR requests respectively, embodiments use a shared queue or a combination of shared queue with two much shorter RD / WR queues. At the same die area, this hybrid design provides the capability to sustain higher queuing pressure for generative LLM applications without sacrificing performance for other applications.
[0023] The technology described herein improves data prefetching effectiveness for LLMs and provides the capability to adapt to other applications of different memory access characteristics. Therefore, the technology enables a broad set of workloads with an improved total cost of ownership (TCO) .
[0024] The data-aware prefetching described herein complements Reused-Data-Cache (RDC) technology from INTEL. RDC identifies and holds likely-to-be-reused data with software assistance, and then isolates that data in a separate structure. This structure can be a separate physical cache or some capacity reserved from the existing cache. Unlike the RDC technology, which saves cache space for data with reuse, the technology described herein saves space in the hardware prefetch tracking structures. This data-aware prefetching solution can be particularly advantageous to LLMs, due to the relatively large memory footprint of LLMs. Thus, the data-aware prefetching solution described herein enhances RDC and addresses the gap when the memory footprint is large.
[0025] Embodiments can be explained in the context of KV caches (e.g., past caches) , which are a software data structure. The instruction set architecture (ISA) and hardware changes described herein, however, can also be used in other reused data structures and / or in other application domains.
[0026] Turning now to FIG. 1, a transformer model may generally use neural networks to generate a query vector 20 (e.g., “q [2] ” ) and a key vector 22 (e.g., “k [2] ” ) for each word 24 (e.g., “Trainium” ) . Both the query vector 20 and the key vector 22 are typically generated from the output of the previous layer in the model. If the query vector 20 from the word 24 matches a key vector (e.g., “k [0] ” or “k [1] ” ) from another word (e.g., “I” or “love” ) , then the other word has a relevant context for the word 24. To provide appropriate context from the other word to the word 24, a value vector 26 (e.g., “v [2] ” ) is calculated and then combined with the word 24 to obtain a more contextualized meaning of the word 24.
[0027] Inference can involve processing a provided prompt / context (e.g., which can occur in parallel) and then sampling subsequent tokens one-by-one until a stop symbol is encountered. During that process, the transformer model performs “self-attention” . In general, self-attention enables a generative LLM to use the context of a sentence to decipher which meaning of the word 24 to use. More particularly, self-attention determines the KV values for each item currently in the sequence (e.g., whether the item was a prompt / context or a generated token) . These vectors 22, 26 are stored in a matrix known as a KV cache 28.
[0028] During the attention calculation for each token, the query vector 20 is compared to all the key vectors to compute attention scores 30 using a similarity measure (e.g., dot product or scaled dot product) . These attention scores 30 are then used as weights to combine the value vectors. The resulting weighted sum represents the attended information and is used as input to the next layer of the model.
[0029] By using the query, key, and value vectors 20, 22, 26 in the attention calculation, the model is able to selectively “attend” to different parts of the input sequence, capturing dependencies and relationships between elements more effectively.
[0030] An optimization of the KV cache 28 saves compute resources by performing only the incremental computation for the current token and reusing previously computed Key / Value vectors from the KV cache 28. The Key / Value vector of the current token is also appended to the KV cache 28 for the next token generation operation.
[0031] FIG. 2 demonstrates that for each token, the computation flow of attention traverses all layers (e.g., N=28) . The entries in the KV cache 28, however, are reused within the same layer between subsequent tokens. Accordingly, the data reuse “distance” (e.g., time between reuse) for entries in the KV cache 28 is relatively long. The actual computation within each layer could be much more complex than shown. For example, the computation flow could depend on whether the query from one word matches the key from another word, which introduces additional complexity on tracking the data access pattern.
[0032] For a given generative LLM and parameter count, a multiplication by two can be performed to obtain bytes and calculate the size of the weights for a model of 6-Billion parameters, whereas each parameter is of BF16 (brain floating point, i.e., 2-byte) . 6e9x2=12e12bytes=12GB (Eq1)
[0033] KV cache memory per token can be calculated as follows, where the first factor of two accounts for the two vectors, K and V. That amount can be stored per each layer, and each of those values is a n_heads × d_head matrix. Then another multiplication by two is conducted for the number of bytes (e.g., assuming 16-bit formats for each variable) . 2xN_layersxN_heads x d_headx2=2x28x16x256x2=458, 752bytes=448KB (Eq2)
[0034] The large footprint results in numerous accesses to various memory addresses throughout the computation flow process. Those accesses introduce a considerable amount of noise to the memory access pattern for prefetching. Together with the relatively long reuse distance and computation complexity, it becomes more difficult to identify the memory access pattern with a limited buffer size.
[0035] Data-Aware Prefetching
[0036] FIG. 3 shows a method 40 of operating a software hint generator and a hardware-based prefetcher. The method 40 may be implemented in one or more modules as a set of logic instructions stored in a machine-or computer-readable storage medium such as random access memory (RAM) , read only memory (ROM) , programmable ROM (PROM) , firmware, flash memory, etc., in hardware, or any combination thereof. For example, hardware implementations may include configurable logic, fixed-functionality logic, or any combination thereof. Examples of configurable logic (e.g., configurable hardware) include suitably configured programmable logic arrays (PLAs) , field programmable gate arrays (FPGAs) , complex programmable logic devices (CPLDs) , and general purpose microprocessors. Examples of fixed-functionality logic (e.g., fixed-functionality hardware) include suitably configured application specific integrated circuits (ASICs) , combinational logic circuits, and sequential logic circuits. The configurable or fixed-functionality logic can be implemented with complementary metal oxide semiconductor (CMOS) logic circuits, transistor-transistor logic (TTL) logic circuits, or other circuits.
[0037] For example, computer program code to carry out operations shown in the method 40 can be written in any combination of one or more programming languages, including an object oriented programming language such as JAVA, SMALLTALK, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. Additionally, logic instructions might include assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, state-setting data, configuration data for integrated circuitry, state information that personalizes electronic circuitry and / or other structural components that are native to hardware (e.g., host processor, central processing unit / CPU, microcontroller, etc. ) .
[0038] Illustrated hint generator block 42 provides for determining a reuse likelihood of data targeted by a request associated with a hardware cache (e.g., level two / L2 cache) . In one example, the request is a key-value cache request. The request may also correspond to one or more of an access of the hardware cache or a miss in the hardware cache. In an embodiment, the data is associated with a generative AI model (e.g., LLM) having a relatively large memory footprint. A determination may be made at hint generator block 44 as to whether the reuse likelihood is greater than a threshold (e.g., configurable percentage) . If so, hint generator block 46 incorporates a reuse hint into an instruction (e.g., LOAD instruction) . The pseudo below shows one approach to implementing the hint generator block 44 in software.
[0039] Hint generator block 48 issues the instruction to a hardware-based prefetcher. If it is determined at hint generator block 44 that the reuse likelihood is less than the threshold, hint generator block 50 excludes the hint from the instruction and the method 40 proceeds to the hint generator block 48 without executing the hint generator block 46.
[0040] Prefetcher block 52 detects the instruction associated with the hardware cache, wherein a determination may be made at prefetcher block 54 as to whether the reuse hint is included in the instruction. If so, prefetcher block 56 conducts an access pattern analysis on the instruction. In one example, the access pattern analysis involves recording an address associated with the instruction and / or tracking a cache line associated with the instruction. Prefetcher block 58 issues one or more prefetch requests based on the access pattern analysis. If it is determined at prefetcher block 54 that the reuse hint is not included in the instruction, then prefetcher block 60 bypasses the access pattern analysis and the method 40 terminates without executing the prefetcher block 56 or the prefetcher block 58.
[0041] The method 40 therefore enhances performance at least to the extent that the reuse hint increases the fraction of total cache misses that are eliminated through prefetching (e.g., coverage) . The reuse hint also enables the prefetcher to filter out noise associated with a large memory footprint, even when the reuse distance is relatively long (e.g., KV cache entries are reused within the same layer between subsequent tokens) and there is limited capacity of hardware buffers.
[0042] FIG. 4 shows a more detailed method 70 of operating a prefetcher (e.g., as applied to a KV cache codebase) . The method 70 may be implemented in one or more modules as a set of logic instructions stored in a machine-or computer-readable storage medium such as RAM, ROM, PROM, firmware, flash memory, etc., in hardware, or any combination thereof. For example, hardware implementations may include configurable logic, fixed-functionality logic, or any combination thereof.
[0043] The LLM begins in processing block 72, wherein code is generated for creating KV cache entries with a special hint (e.g., reuse hint) in block 74. The application continues running on hardware at block 76, which involves accessing the KV cache and loading entries into the hardware cache (e.g., L2 cache) . Block 78 determines whether a regular LOAD instruction has been encountered. If not, block 80 records the address of the instruction, tracks one or more cache lines associated with the instruction, analyzes memory accesses and identifies the access pattern of the instruction. Otherwise, block 82 bypasses block 80. Additionally, access addresses are monitored and block 84 predicts future accesses and prefetches the data.
[0044] FIG. 5 shows a memory hierarchy 90 having an integrated reused data prefetcher 92. In the illustrated example, accesses to an L2 cache 94 (e.g., hardware cache) are sent from an L2 request queue 94. Special hints are incorporated into L2 demand accesses 98 that are sent to the reused data prefetcher 92. Additionally, when cache miss and / or write back notifications are issued by the L2 cache 94, special hints may be incorporated into L2 demand misses 100 that are sent to the reused data prefetcher 92. The reused data prefetcher 92 issues prefetch requests 102 (e.g., based on reused data pattern analysis) through a prefetch request queue 104 to the L2 request queue 96.
[0045] The cache miss and / or write back notifications are sent through a bus request queue 106 and a bus 108 to a memory controller 110. As will be discussed in greater detail, the memory controller 110 may include a pending queue 112 that is shared by read request and write requests. In such a case, the read requests and the write requests can be associated with the access pattern analysis conducted by the reused data prefetcher 92 (e.g., on instructions including reuse hints) . The memory controller 110 may retrieve data from one or more DRAM memory banks 114 and send the retrieved data to an instruction cache 116 (I-cache) and / or a data cache 118 (D-cache) via the bus 108 and an L2 fill queue 120. In one example, the L2 fill queue 120 conducts cache fills 122 of the L2 cache 94, which returns cache hits 124 for the instruction cache 116 and / or the data cache 118.
[0046] Thus, the KV cache codegen (e.g., via a deep learning / DL compiler) employs a special LOAD instruction to load entries of the KV cache (e.g., software structure) into the hardware cache. This instruction conveys that the data being loaded is more likely to be reused than data being accessed with conventional loads. The reused data prefetcher 92 acts on this hint. In one example, the reused data prefetcher 92 records the address for likely-to-be-reused cache lines accessed by the load instruction. The reused data prefetcher 92 also ignores noise (e.g., numerous “random” memory accesses due to a large memory footprint during that time period) . With a relatively small buffer, the reused data prefetcher 92 focuses on the likely-to-be-reused cache lines, captures more related memory accesses, and identifies the reuse pattern. As a result, hardware prefetching is improved, despite the re-use distance being relatively long.
[0047] In addition to a new instruction prefix, other embodiments include a new instruction (e.g., “MOVREUSE” , move data with reuse) or a new hint type for the memadvise system call (e.g., system call used to give advice or directions to a kernel about an address range) . For example, a new instruction could have a hint be: (a) part of the opcode, (b) an immediate, (c) an instruction prefix (or part of a prefix) , or (d) embedded in the upper address bits. The hint indicates how data will be used in the future, so that a “high reuse” hint is effective.
[0048] Hybrid Read / Write (RD / WR) Pending Queue
[0049] FIG. 6 shows a conventional memory controller 130 that employs a first queue 132 (e.g., read pending queue / RPQ) that is dedicated to tracking outstanding read requests to memory 136 (e.g., DRAM) and second queue 134 (e.g., write pending queue / WPQ) that is dedicated to tracking write requests to memory 136. This dedicated queue design is not optimized for LLMs because LLMs are dominated by read requests. Using generative LLMs as an example, the WPQ is rarely used but the RPQ is much more frequently full than for other CNN-based models and analytics software.
[0050] By contrast, a first enhanced memory controller 140 includes a cache interface 146, a memory interface 146, and a first pending queue 142 (e.g., shared PQ) that is shared by read requests and write requests, wherein the read requests and the write requests are associated with an access pattern analysis on instructions including reuse hints. In one example, each entry in the first pending queue 142 includes a bit indicating whether the entry is a read request or a write request. The first enhanced memory controller 140 also includes a second pending queue 150 (e.g., RPQ) coupled to the cache interface 146 and the first pending queue 142, wherein the second pending queue 150 is dedicated to read requests. Additionally, a third pending queue 152 (e.g., WPQ) is coupled to the cache interface 146 and the first pending queue 142, wherein the third pending queue 152 is dedicated to write requests. In an embodiment, a first size of the first pending queue 142 is greater than a second size of the second pending queue 150 and a third size of the third pending queue 152.
[0051] In addition, a second enhanced memory controller 160 includes a cache interface 166, a memory interface 168, and a first pending queue 162 (e.g., shared PQ) that is shared by read requests and write requests, wherein the read requests and the write requests are associated with an access pattern analysis on instructions including reuse hints. In one example, each entry in the first pending queue 162 includes a bit indicating whether the entry is a read request or a write request.
[0052] The technology described herein therefore provides two hybrid queue designs that address timeliness and can effectively adapt to applications with imbalanced READ and WRITE requests. The overhead is to add one bit in each queue request to indicate whether the request is a READ or WRITE. Under almost the same hardware cost as the conventional memory controller 130, the two enhanced designs can increase the capacity of handling READ requests significantly. Depending on the ratio between READ / WRITE requests, to combine two much shorter dedicated queues with a much longer shared queue is a better option as shown in the first enhanced memory controller 140. Under some special cases (e.g., generative LLMs) of READ-dominant activity with few WRITE requests, a pure shared queue as shown in the second enhanced memory controller 160 could boost the capacity by 2x under the same hardware cost.
[0053] Turning now to FIG. 7, a performance-enhanced computing system 280 is shown. The system 280 may generally be part of an electronic device / platform having computing functionality (e.g., personal digital assistant / PDA, notebook computer, tablet computer, convertible tablet, server) , communications functionality (e.g., smart phone) , imaging functionality (e.g., camera, camcorder) , media playing functionality (e.g., smart television / TV) , wearable functionality (e.g., watch, eyewear, headwear, footwear, jewelry) , vehicular functionality (e.g., car, truck, motorcycle) , robotic functionality (e.g., autonomous robot) , Internet of Things (IoT) functionality, drone functionality, etc., or any combination thereof.
[0054] In the illustrated example, the system 280 includes a host processor 282 (e.g., CPU) having a hardware-based prefetcher 304, a hardware cache 306, and an integrated memory controller (IMC) 284 that is coupled to a system memory 286 (e.g., dual inline memory module / DIMM) . In an embodiment, an IO module 288 is coupled to the host processor 282. The illustrated IO module 288 communicates with, for example, a display 290 (e.g., touch screen, liquid crystal display / LCD, light emitting diode / LED display) , and a network controller 292 (e.g., wired and / or wireless) . The host processor 282 may be combined with the IO module 288, a graphics processor 294, and an AI accelerator 296 into a system on chip (SoC) 298.
[0055] In an embodiment, the AI accelerator 296, the host processor 282 and / or the SoC 298 executes a plurality of executable program instructions 300 retrieved from mass storage 302 and / or the system memory 286 to perform one or more aspects of the method 40 (FIG. 3) and / or the method 70 (FIG. 4) , already discussed. Thus, execution of the instructions 300 causes the AI accelerator 296, the host processor 282 and / or the SoC 298 to determine a reuse likelihood of data targeted by a request (e.g., KV cache request) associated with the hardware cache 306, incorporate a reuse hint into an instruction if the reuse likelihood is greater than a threshold, and issue the instruction to the hardware-based prefetcher 304. In an embodiment, the request corresponds to one or more of an access of the hardware cache 306 or a miss in the hardware cache 306, wherein the data is associated with a generative AI model. When the miss corresponds to a miss in the hardware cache 306, execution of the instructions 300 causes the AI accelerator 296, the host processor 282 and / or the SoC 298 to issue one or more of a read request or a write request to a shared pending queue 308 in the IMC 284.
[0056] The computing system 280 is therefore considered performance-enhanced at least to the extent that the reuse hint increases the fraction of total cache misses that are eliminated through prefetching (e.g., coverage) . The reuse hint also enables the prefetcher to filter out noise associated with a large memory footprint, even when the reuse distance is relatively long (e.g., KV cache entries are reused within the same layer between subsequent tokens) and there is limited capacity of hardware buffers. Additionally, the shared pending queue 308 addresses timeliness and can effectively adapt to applications with imbalanced read and write requests.
[0057] FIG. 8 shows a semiconductor apparatus 350 (e.g., chip, die, package) . The illustrated apparatus 350 includes one or more substrates 352 (e.g., silicon, sapphire, gallium arsenide) and logic 354 (e.g., transistor array and other integrated circuit / IC components) coupled to the substrate (s) 352. In an embodiment, the logic 354 implements one or more aspects of the method 40 (FIG. 3) and / or the method 70 (FIG. 4) , already discussed. Additionally, the logic 354 may be incorporated into the IMC 284 (FIG. 7) , already discussed. Thus, the logic 354 includes a cache interface 356, a memory interface 358 and a memory controller (not shown) coupled to the cache interface 356 and the memory interface 358, wherein the memory controller includes a pending queue 360 that is shared by read requests and write requests. The read requests and the write requests may be associated with an access pattern analysis on an instruction including a reuse hint. In one example, the pending queue 360 stores requests targeting data associated with a generative AI model (e.g., LLM) .
[0058] The logic 354 may be implemented at least partly in configurable or fixed-functionality hardware. In one example, the logic 354 includes transistor channel regions that are positioned (e.g., embedded) within the substrate (s) 352. Thus, the interface between the logic 354 and the substrate (s) 352 may not be an abrupt junction. The logic 354 may also be considered to include an epitaxial layer that is grown on an initial wafer of the substrate (s) 352.
[0059] FIG. 9 illustrates a processor core 400 according to one embodiment. The processor core 400 may be the core for any type of processor, such as a micro-processor, an embedded processor, a digital signal processor (DSP) , a network processor, or other device to execute code. Although only one processor core 400 is illustrated in FIG. 9, a processing element may alternatively include more than one of the processor core 400 illustrated in FIG. 9. The processor core 400 may be a single-threaded core or, for at least one embodiment, the processor core 400 may be multithreaded in that it may include more than one hardware thread context (or “logical processor” ) per core.
[0060] FIG. 9 also illustrates a memory 470 coupled to the processor core 400. The memory 470 may be any of a wide variety of memories (including various layers of memory hierarchy) as are known or otherwise available to those of skill in the art. The memory 470 may include one or more code 413 instruction (s) to be executed by the processor core 400, wherein the code 413 may implement the method 40 (FIG. 3) and / or the method 70 (FIG. 4) , already discussed. The processor core 400 follows a program sequence of instructions indicated by the code 413. Each instruction may enter a front end portion 410 and be processed by one or more decoders 420. The decoder 420 may generate as its output a micro operation such as a fixed width micro operation in a predefined format, or may generate other instructions, microinstructions, or control signals which reflect the original code instruction. The illustrated front end portion 410 also includes register renaming logic 425 and scheduling logic 430, which generally allocate resources and queue the operation corresponding to the convert instruction for execution.
[0061] The processor core 400 is shown including execution logic 450 having a set of execution units 455-1 through 455-N. Some embodiments may include a number of execution units dedicated to specific functions or sets of functions. Other embodiments may include only one execution unit or one execution unit that can perform a particular function. The illustrated execution logic 450 performs the operations specified by code instructions.
[0062] After completion of execution of the operations specified by the code instructions, back end logic 460 retires the instructions of the code 413. In one embodiment, the processor core 400 allows out of order execution but requires in order retirement of instructions. Retirement logic 465 may take a variety of forms as known to those of skill in the art (e.g., re-order buffers or the like) . In this manner, the processor core 400 is transformed during execution of the code 413, at least in terms of the output generated by the decoder, the hardware registers and tables utilized by the register renaming logic 425, and any registers (not shown) modified by the execution logic 450.
[0063] Although not illustrated in FIG. 9, a processing element may include other elements on chip with the processor core 400. For example, a processing element may include memory control logic along with the processor core 400. The processing element may include I / O control logic and / or may include I / O control logic integrated with memory control logic. The processing element may also include one or more caches.
[0064] Referring now to FIG. 10, shown is a block diagram of a computing system 1000 embodiment in accordance with an embodiment. Shown in FIG. 10 is a multiprocessor system 1000 that includes a first processing element 1070 and a second processing element 1080. While two processing elements 1070 and 1080 are shown, it is to be understood that an embodiment of the system 1000 may also include only one such processing element.
[0065] The system 1000 is illustrated as a point-to-point interconnect system, wherein the first processing element 1070 and the second processing element 1080 are coupled via a point-to-point interconnect 1050. It should be understood that any or all of the interconnects illustrated in FIG. 10 may be implemented as a multi-drop bus rather than point-to-point interconnect.
[0066] As shown in FIG. 10, each of processing elements 1070 and 1080 may be multicore processors, including first and second processor cores (i.e., processor cores 1074a and 1074b and processor cores 1084a and 1084b) . Such cores 1074a, 1074b, 1084a, 1084b may be configured to execute instruction code in a manner similar to that discussed above in connection with FIG. 9.
[0067] Each processing element 1070, 1080 may include at least one shared cache 1896a, 1896b. The shared cache 1896a, 1896b may store data (e.g., instructions) that are utilized by one or more components of the processor, such as the cores 1074a, 1074b and 1084a, 1084b, respectively. For example, the shared cache 1896a, 1896b may locally cache data stored in a memory 1032, 1034 for faster access by components of the processor. In one or more embodiments, the shared cache 1896a, 1896b may include one or more mid-level caches, such as level 2 (L2) , level 3 (L3) , level 4 (L4) , or other levels of cache, a last level cache (LLC) , and / or combinations thereof.
[0068] While shown with only two processing elements 1070, 1080, it is to be understood that the scope of the embodiments are not so limited. In other embodiments, one or more additional processing elements may be present in a given processor. Alternatively, one or more of processing elements 1070, 1080 may be an element other than a processor, such as an accelerator or a field programmable gate array. For example, additional processing element (s) may include additional processors (s) that are the same as a first processor 1070, additional processor (s) that are heterogeneous or asymmetric to processor a first processor 1070, accelerators (such as, e.g., graphics accelerators or digital signal processing (DSP) units) , field programmable gate arrays, or any other processing element. There can be a variety of differences between the processing elements 1070, 1080 in terms of a spectrum of metrics of merit including architectural, micro architectural, thermal, power consumption characteristics, and the like. These differences may effectively manifest themselves as asymmetry and heterogeneity amongst the processing elements 1070, 1080. For at least one embodiment, the various processing elements 1070, 1080 may reside in the same die package.
[0069] The first processing element 1070 may further include memory controller logic (MC) 1072 and point-to-point (P-P) interfaces 1076 and 1078. Similarly, the second processing element 1080 may include a MC 1082 and P-P interfaces 1086 and 1088. As shown in FIG. 10, MC’s 1072 and 1082 couple the processors to respective memories, namely a memory 1032 and a memory 1034, which may be portions of main memory locally attached to the respective processors. While the MC 1072 and 1082 is illustrated as integrated into the processing elements 1070, 1080, for alternative embodiments the MC logic may be discrete logic outside the processing elements 1070, 1080 rather than integrated therein.
[0070] The first processing element 1070 and the second processing element 1080 may be coupled to an I / O subsystem 1090 via P-P interconnects 1076 1086, respectively. As shown in FIG. 10, the I / O subsystem 1090 includes P-P interfaces 1094 and 1098. Furthermore, I / O subsystem 1090 includes an interface 1092 to couple I / O subsystem 1090 with a high performance graphics engine 1038. In one embodiment, bus 1049 may be used to couple the graphics engine 1038 to the I / O subsystem 1090. Alternately, a point-to-point interconnect may couple these components.
[0071] In turn, I / O subsystem 1090 may be coupled to a first bus 1016 via an interface 1096. In one embodiment, the first bus 1016 may be a Peripheral Component Interconnect (PCI) bus, or a bus such as a PCI Express bus or another third generation I / O interconnect bus, although the scope of the embodiments are not so limited.
[0072] As shown in FIG. 10, various I / O devices 1014 (e.g., biometric scanners, speakers, cameras, sensors) may be coupled to the first bus 1016, along with a bus bridge 1018 which may couple the first bus 1016 to a second bus 1020. In one embodiment, the second bus 1020 may be a low pin count (LPC) bus. Various devices may be coupled to the second bus 1020 including, for example, a keyboard / mouse 1012, communication device (s) 1026, and a data storage unit 1019 such as a disk drive or other mass storage device which may include code 1030, in one embodiment. The illustrated code 1030 may implement the method 40 (FIG. 3) and / or the method 70 (FIG. 4) , already discussed. Further, an audio I / O 1024 may be coupled to second bus 1020 and a battery 1010 may supply power to the computing system 1000.
[0073] Note that other embodiments are contemplated. For example, instead of the point-to-point architecture of FIG. 10, a system may implement a multi-drop bus or another such communication topology. Also, the elements of FIG. 10 may alternatively be partitioned using more or fewer integrated chips than shown in FIG. 10.
[0074] Additional Notes and Examples:
[0075] Example 1 includes a performance-enhanced computing system comprising a memory controller, a processor including a hardware-based prefetcher, and a memory coupled to the processor and the memory controller, the memory including a plurality of instructions, which when executed by the processor, cause the processor to determine a reuse likelihood of data targeted by a request associated with a hardware cache, incorporate a reuse hint into an instruction if the reuse likelihood is greater than a threshold, and issue the instruction to the hardware-based prefetcher.
[0076] Example 2 includes the computing system of Example 1, wherein the hardware-based prefetcher includes logic coupled to one or more substrates, and wherein the logic is implemented at least partly in one or more of configurable or fixed-functionality hardware, the logic to detect the instruction associated with the hardware cache, conduct an access pattern analysis on the instruction if the reuse hint is included in the instruction, and issue one or more prefetch requests based on the access pattern analysis.
[0077] Example 3 includes the computing system of Example 2, wherein the logic is further to bypass the access pattern analysis if the reuse hint is excluded from the instruction.
[0078] Example 4 includes the computing system of Example 2, wherein to conduct the access pattern analysis, the logic is further to one or more of record an address associated with the instruction or track a cache line associated with the instruction.
[0079] Example 5 includes the computing system of Example 1, wherein the plurality of instructions, when executed, further cause the processor to exclude the reuse hint from the instruction if the reuse likelihood is less than the threshold.
[0080] Example 6 includes the computing system of Example 1, wherein the request is to be a key-value cache request.
[0081] Example 7 includes the computing system of any one of Examples 1 to 6, wherein the request is to correspond to one or more of an access of the hardware cache or a miss in the hardware cache, and wherein the data is to be associated with a generative artificial intelligence model.
[0082] Example 8 includes the computing system of Example 7, wherein when the request corresponds to the miss in the hardware cache, the plurality of instructions, when executed, cause the processor to issue one or more of a read request or a write request to a shared pending queue in the memory controller.
[0083] Example 9 includes at least one computer readable storage medium comprising a plurality of executable program instructions, which when executed by a computing system, cause the computing system to determine a reuse likelihood of data targeted by a request associated with a hardware cache, incorporate a reuse hint into an instruction if the reuse likelihood is greater than a threshold, and issue the instruction to a hardware-based prefetcher.
[0084] Example 10 includes the at least one computer readable storage medium of Example 9, wherein the instructions, when executed, further cause the computing system to detect the instruction associated with the hardware cache, conduct an access pattern analysis on the instruction if the reuse hint is included in the instruction, and issue one or more prefetch requests based on the access pattern analysis.
[0085] Example 11 includes the at least one computer readable storage medium of Example 10, wherein the instructions, when executed, further cause the computing system to bypass the access pattern analysis if the reuse hint is excluded from the instruction.
[0086] Example 12 includes the at least one computer readable storage medium of Example 10, wherein to conduct the access pattern analysis, the instructions, when executed, further cause the computing system to one or more of record an address associated with the instruction or track a cache line associated with the instruction.
[0087] Example 13 includes the at least one computer readable storage medium of Example 9, wherein the plurality of instructions, when executed, further cause the computing system to exclude the reuse hint from the instruction if the reuse likelihood is less than the threshold.
[0088] Example 14 includes the at least one computer readable storage medium of Example 9, wherein the request is to be a key-value cache request.
[0089] Example 15 includes the at least one computer readable storage medium of any one of Examples 9 to 14, wherein the request is to correspond to one or more of an access of the hardware cache or a miss in the hardware cache, and wherein the data is to be associated with a generative artificial intelligence model.
[0090] Example 16 includes a semiconductor apparatus comprising one or more substrates, and logic coupled to the one or more substrates, wherein the logic is implemented at least partly in one or more of configurable or fixed-functionality hardware, the logic including cache interface, a memory interface, and a memory controller coupled to the cache interface and the memory interface, wherein the memory controller includes a first pending queue that is shared by read requests and write requests, and wherein the read requests and the write requests are to be associated with an access pattern analysis on an instruction including a reuse hint.
[0091] Example 17 includes the semiconductor apparatus of Example 16, wherein each entry in the first pending queue is to include a bit indicating whether the entry is a read request or a write request.
[0092] Example 18 includes the semiconductor apparatus of Example 16, wherein the logic further includes a second pending queue coupled to the cache interface and the first pending queue, wherein the second pending queue is dedicated to the read requests, and a third pending queue coupled to the cache interface and the first pending queue, wherein the third pending queue is dedicated to the write requests, and wherein a first size of the first pending queue is greater than a second size of the second pending queue and a third size of the third pending queue.
[0093] Example 19 includes the semiconductor apparatus of any one of Examples 16 to 18, wherein the first pending queue is to store requests targeting data associated with a generative artificial intelligence model.
[0094] Example 20 includes the semiconductor apparatus of any one of Examples 16 to 18, wherein the logic coupled to the one or more substrates includes transistor channel regions that are positioned within the one or more substrates.
[0095] Example 21 includes a method of operating a performance-enhanced computing system, the method comprising determining a reuse likelihood of data targeted by a request associated with a hardware cache, incorporating a reuse hint into an instruction if the reuse likelihood is greater than a threshold, and issuing the instruction to a hardware-based prefetcher.
[0096] Example 22 includes an apparatus comprising means for performing the method of Example 21.
[0097] The technology described herein therefore reduces reliance on limited capacity hardware buffers (e.g., history buffer, stream buffer, miss address buffer, etc. ) when tracking memory access patterns. Indeed, the technology described herein tracks complex access patterns of long reuse distance in the presence of a large memory footprint (e.g., 12GB in Eq (1) for weight tensors) and more frequent cache misses. Moreover, generative LLMs introduce a considerable amount of noise, which makes it a challenge to recognize the access pattern without the technology described herein.
[0098] In addition, the computation flow of self-attention depends on whether the query from one word matches the key from another word, which increases complexity. Thus, the KV cache access is not purely sequential and it is difficult to predict the pattern without software assistance as described herein. The technology described herein also provides a data-aware prefetching solution with hinted LOAD instruction and a dedicated microarchitectural component. Accordingly, the noise resulting from a large memory footprint is filtered out and the prefetcher only analyzes the hinted LOAD address.
[0099] Moreover, generative LLMs demonstrate read-dominant characteristics. As already discussed, a Read Pending Queue (RPQ) is 2.5x to 11x more likely to be blocked in a generative LLM than in other types of workloads. At the same time, the Write Pending Queue (WPQ) is barely used. This behavior is very different from other types of workloads, which show much more balanced usage between read requests and write requests. The hybrid queue design described herein provides a capability to adapt to various applications with different RD / WR behavior. For generative LLMs, the capacity for outstanding read requests is almost doubled, which likely prevents any read requests from being blocked due to the RPQ being full.
[0100] Embodiments are applicable for use with all types of semiconductor integrated circuit ( “IC” ) chips. Examples of these IC chips include but are not limited to processors, controllers, chipset components, programmable logic arrays (PLAs) , memory chips, network chips, systems on chip (SoCs) , SSD / NAND controller ASICs, and the like. In addition, in some of the drawings, signal conductor lines are represented with lines. Some may be different, to indicate more constituent signal paths, have a number label, to indicate a number of constituent signal paths, and / or have arrows at one or more ends, to indicate primary information flow direction. This, however, should not be construed in a limiting manner. Rather, such added detail may be used in connection with one or more exemplary embodiments to facilitate easier understanding of a circuit. Any represented signal lines, whether or not having additional information, may actually comprise one or more signals that may travel in multiple directions and may be implemented with any suitable type of signal scheme, e.g., digital or analog lines implemented with differential pairs, optical fiber lines, and / or single-ended lines.
[0101] Example sizes / models / values / ranges may have been given, although embodiments are not limited to the same. As manufacturing techniques (e.g., photolithography) mature over time, it is expected that devices of smaller size could be manufactured. In addition, well known power / ground connections to IC chips and other components may or may not be shown within the figures, for simplicity of illustration and discussion, and so as not to obscure certain aspects of the embodiments. Further, arrangements may be shown in block diagram form in order to avoid obscuring embodiments, and also in view of the fact that specifics with respect to implementation of such block diagram arrangements are highly dependent upon the computing system within which the embodiment is to be implemented, i.e., such specifics should be well within purview of one skilled in the art. Where specific details (e.g., circuits) are set forth in order to describe example embodiments, it should be apparent to one skilled in the art that embodiments can be practiced without, or with variation of, these specific details. The description is thus to be regarded as illustrative instead of limiting.
[0102] The term “coupled” may be used herein to refer to any type of relationship, direct or indirect, between the components in question, and may apply to electrical, mechanical, fluid, optical, electromagnetic, electromechanical or other connections. In addition, the terms “first” , “second” , etc. may be used herein only to facilitate discussion, and carry no particular temporal or chronological significance unless otherwise indicated.
[0103] As used in this application and in the claims, a list of items joined by the term “one or more of” may mean any combination of the listed terms. For example, the phrases “one or more of A, B or C” may mean A; B; C; A and B; A and C; B and C; or A, B and C.
[0104] Those skilled in the art will appreciate from the foregoing description that the broad techniques of the embodiments can be implemented in a variety of forms. Therefore, while the embodiments have been described in connection with particular examples thereof, the true scope of the embodiments should not be so limited since other modifications will become apparent to the skilled practitioner upon a study of the drawings, specification, and following claims.
Claims
1.A computing system comprising:a memory controller;a processor including a hardware-based prefetcher; anda memory coupled to the processor and the memory controller, the memory including a plurality of executable program instructions, which when executed by the processor, cause the processor to:determine a reuse likelihood of data targeted by a request associated with a hardware cache,incorporate a reuse hint into an instruction if the reuse likelihood is greater than a threshold, andissue the instruction to the hardware-based prefetcher.2.The computing system of claim 1, wherein the hardware-based prefetcher includes logic coupled to one or more substrates, and wherein the logic is implemented at least partly in one or more of configurable or fixed-functionality hardware, the logic to:detect the instruction associated with the hardware cache,conduct an access pattern analysis on the instruction if the reuse hint is included in the instruction, andissue one or more prefetch requests based on the access pattern analysis.3.The computing system of claim 2, wherein the logic is further to bypass the access pattern analysis if the reuse hint is excluded from the instruction.4.The computing system of claim 2, wherein to conduct the access pattern analysis, the logic is further to one or more of record an address associated with the instruction or track a cache line associated with the instruction.5.The computing system of claim 1, wherein the plurality of instructions, when executed, further cause the processor to exclude the reuse hint from the instruction if the reuse likelihood is less than the threshold.6.The computing system of claim 1, wherein the request is to be a key-value cache request.7.The computing system of any one of claims 1 to 6, wherein the request is to correspond to one or more of an access of the hardware cache or a miss in the hardware cache, and wherein the data is to be associated with a generative artificial intelligence model.8.The computing system of claim 7, wherein when the request corresponds to the miss in the hardware cache, the plurality of instructions, when executed, cause the processor to issue one or more of a read request or a write request to a shared pending queue in the memory controller.9.At least one computer readable storage medium comprising a plurality of executable program instructions, which when executed by a computing system, cause the computing system to:determine a reuse likelihood of data targeted by a request associated with a hardware cache;incorporate a reuse hint into an instruction if the reuse likelihood is greater than a threshold; andissue the instruction to a hardware-based prefetcher.10.The at least one computer readable storage medium of claim 9, wherein the instructions, when executed, further cause the computing system to:detect the instruction associated with the hardware cache;conduct an access pattern analysis on the instruction if the reuse hint is included in the instruction; andissue one or more prefetch requests based on the access pattern analysis.11.The at least one computer readable storage medium of claim 10, wherein the instructions, when executed, further cause the computing system to bypass the access pattern analysis if the reuse hint is excluded from the instruction.12.The at least one computer readable storage medium of claim 10, wherein to conduct the access pattern analysis, the instructions, when executed, further cause the computing system to one or more of record an address associated with the instruction or track a cache line associated with the instruction.13.The at least one computer readable storage medium of claim 9, wherein the plurality of instructions, when executed, further cause the computing system to exclude the reuse hint from the instruction if the reuse likelihood is less than the threshold.14.The at least one computer readable storage medium of claim 9, wherein the request is to be a key-value cache request.15.The at least one computer readable storage medium of any one of claims 9 to 14, wherein the request is to correspond to one or more of an access of the hardware cache or a miss in the hardware cache, and wherein the data is to be associated with a generative artificial intelligence model.16.A semiconductor apparatus comprising:one or more substrates; andlogic coupled to the one or more substrates, wherein the logic is implemented at least partly in one or more of configurable or fixed-functionality hardware, the logic including:a cache interface;a memory interface; anda memory controller coupled to the cache interface and the memory interface, wherein the memory controller includes a first pending queue that is shared by read requests and write requests, and wherein the read requests and the write requests are to be associated with an access pattern analysis on an instruction including a reuse hint.17.The semiconductor apparatus of claim 16, wherein each entry in the first pending queue is to include a bit indicating whether the entry is a read request or a write request.18.The semiconductor apparatus of claim 16, wherein the logic further includes:a second pending queue coupled to the cache interface and the first pending queue, wherein the second pending queue is dedicated to the read requests; anda third pending queue coupled to the cache interface and the first pending queue, wherein the third pending queue is dedicated to the write requests, and wherein a first size of the first pending queue is greater than a second size of the second pending queue and a third size of the third pending queue.19.The semiconductor apparatus of any one of claims 16 to 18, wherein the first pending queue is to store requests targeting data associated with a generative artificial intelligence model.20.The semiconductor apparatus of any one of claims 16 to 18, wherein the logic coupled to the one or more substrates includes transistor channel regions that are positioned within the one or more substrates.