System and method for performing memory compression
By using parallel hardware channels to execute compression and decompression algorithms in the computing system, and using dictionary and statistical methods to optimize data processing, the problem of processor time occupied in compression and decompression operations is solved, and data processing efficiency and system performance are improved.
Patent Information
- Application Number
- CN202310872581.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2017-07-28
- Filing Date
- 2018-07-26
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2038-07-26
AI Technical Summary
In computing systems, the processor takes up a sustained period of time while performing compression and decompression operations, causing the CPU to be unavailable and causing delays while other processors are waiting, affecting the rapid movement of data and processing efficiency.
A system and method are designed that utilize the compression unit and decompression unit in the processor to execute compression and decompression algorithms in parallel through multiple hardware channels, use dictionary and statistical methods to optimize data processing, reduce dependence on the processor, and improve throughput. .
It effectively reduces the time occupied by the processor in compression and decompression operations, improves data processing efficiency, reduces the exchange delay between local cache and permanent storage, and supports fast processing of multiple software applications.
Smart Images

Figure CN116841920B_ABST
Abstract
Description
[0001] This application is a divisional application of a Chinese patent application with a filing date of July 26, 2018, a national application number of 201810830354.7, and an invention name of “System and method for performing memory compression”. Technical Field
[0002] Embodiments described herein relate to the field of computing systems, and more particularly, to efficiently moving data for storage and processing. Background Art
[0003] Generally speaking, a variety of computing systems include a processor and memory, and the processor generates access requests for instructions and application data while processing one or more software applications. For example, when fetching instructions and data, the processor checks the hierarchy of local cache memories, and if not found, the processor issues a request for the desired instructions and data to the main memory or other storage device (such as a CD-ROM or hard drive).
[0004] Sometimes, the number of software applications running simultaneously on a computing system reaches a considerable number. In addition, many computing systems include multiple processors, such as central processing units (CPUs), data parallel processors (such as graphics processing units (GPUs)), digital signal processors (DSPs), etc. Thus, the amount of instructions and data used to process multiple software applications has grown significantly. However, the memory storage locations in the local cache memory have a limited amount of storage space. Thus, an exchange of instructions and data occurs between the local cache memory and the permanent storage device.
[0005] The exchange of information and the corresponding delays in waiting for a request to be loaded reduces the performance of the computing system. In order to reduce the amount of storage for a particular amount of data, the data is compressed. Such compression exploits the repeating sequence of individual data bits included in the data. When the data is to be accessed, the data is decompressed, and then once the access has been completed, the data may be recompressed.
[0006] Generally speaking, when a general-purpose processor such as a central processing unit (CPU) is executing a software routine to compress and / or decompress data, the general-purpose processor such as a central processing unit (CPU) is occupied during the duration of the operation. Additionally, in a system including multiple processors, many times, the CPU is the only processor that supports the desired data for retrieval, compression and decompression. Thus, when performing one or more of local and network data retrieval and compression, the CPU is partially or completely unavailable. In addition, other processors incur delays when waiting for the CPU to complete retrieval, compression and decompression operations on their behalf.
[0007] In view of the foregoing, methods and mechanisms for efficiently moving data for storage and processing are desired. Summary of the invention
[0008] It is contemplated that a system and method for efficiently moving data for storage and processing is provided. In various embodiments, a computing system includes a memory, a cache memory, and a processor. In response to receiving a compression instruction, the processor extracts data from the memory into the cache memory. In some embodiments, the data is divided into a plurality of input words. Subsequently, the processor loads a plurality of input words from the cache memory into a read buffer in the processor. A compression unit in the processor includes a circuit for executing the compression instruction. Thus, when the compression unit processes the compression instruction, the processor can be used to process other operations.
[0009] In an embodiment, the compression unit selects two or more input words from a plurality of words to be used as the input words assigned. The compression unit includes a plurality of hardware channels for performing the operation of the compression algorithm. Each of two or more hardware channels of the plurality of hardware channels is assigned to a corresponding one of the selected two or more input words. Each of the two or more hardware channels generates a corresponding compressed packet based at least on the input words assigned thereto. In order to generate the compressed packet, each hardware channel uses a value to compare with the assigned word to determine the intra-group dependency. However, in various embodiments, before determining the intra-group dependency of the first group of words with the same index, a dictionary is accessed for a newer second group of words, each word in the second group having the same index.
[0010] The compression unit combines the compressed packets into a group of compressed packets. In some embodiments, the compression unit also combines two or more groups into packet groups, and writes the packet groups to the write buffer. At a later time, the processor sends the packet groups from the write buffer to the target storage location.
[0011] In various embodiments, when processing each assigned input word, the repetitive sequence of data bits is searched by comparing with previously seen data. In some embodiments, the previously seen data is stored in the entry of a data structure (e.g., such as a table) called a dictionary. In some embodiments, multiple hardware channels perform the steps of a combination of a statistical compression algorithm and a dictionary-based compression algorithm. In some embodiments, each of two or more selected input words assigned to two or more hardware channels has a corresponding index pointing to the same entry in multiple entries of the table. In some embodiments, the content of the same entry of the table is read from the dictionary once for processing the input words currently assigned to two or more hardware channels. In an embodiment, the hardware channel with the oldest input word in the input word of two or more assignments generates a single read request. Additionally, the hardware channel with the latest input word in the input word of two or more assignments generates a single write request to update the table when the compression of the input word of two or more assignments is completed. Thus, multiple read and write requests for serial implementation for sequences stored in the table are reduced to a single read request and a single write request for parallel implementation using multiple hardware channels.
[0012] In another embodiment, the processor also includes a decompression unit that utilizes multiple hardware channels. In response to receiving a decompression instruction, the processor extracts the compressed packet, and the decompression unit in the processor includes a circuit for executing the decompression instruction. Thus, when the decompression unit processes the decompression instruction, the processor can be used to process other operations. Each of the multiple hardware channels of the decompression unit generates a word based on the compressed packet.
[0013]
[0013] These and other embodiments will also be apparent upon reference to the following description and accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The above and further advantages of the methods and mechanisms may be better understood by referring to the following description in conjunction with the accompanying drawings, in which:
[0015] Figure 1 is a block diagram of one implementation of a processor core.
[0016] Figure 2 is a block diagram of one embodiment of a compression / decompression unit.
[0017] Figure 3 is a block diagram of one embodiment of compressed information.
[0018] Figure 4 is a block diagram of one implementation of a compression engine.
[0019] Figure 5 is a block diagram of one implementation of a compression process.
[0020] Figure 6 is a block diagram of another embodiment of a compression process.
[0021] Figure 7 is a block diagram of another embodiment of a compression process.
[0022] Figure 8 is a block diagram of another embodiment of a compression process.
[0023] Fig. 9 is a flow chart of one embodiment of a method for efficiently compressing data.
[0024] Fig.10 is a block diagram of one implementation of a decompression process.
[0025] Fig.11 is a flow chart of one embodiment of a method for efficiently decompressing data.
[0026] Fig.12 is a block diagram of another implementation of a compression process.
[0027] Fig.13 is a block diagram of another embodiment of the decompression process.
[0028] Fig.14 is a block diagram of another embodiment of a compression process.
[0029] Although the embodiments described in the present disclosure may be affected by various modifications and alternative forms, their specific embodiments are shown in the drawings by way of example and will be described in detail herein. However, it should be understood that the drawings and their detailed description are not intended to limit the embodiments to the specific forms disclosed, but on the contrary, the present invention is intended to cover all modifications, equivalents and alternatives that fall within the essence and scope of the appended claims. As used in this patent application, the word "may" is used in a permissive sense (i.e., meaning with possibility) rather than a mandatory sense (i.e., meaning must). Similarly, the word "include", "including" and "includes" means including but not limited to.
[0030] Various units, circuits, or other components may be described as being "configured to" perform one or more tasks. In such contexts, "configured to" is a broad expression of a structure that generally means "having" a "circuit" that performs one or more tasks during operation. In this way, a unit / circuit / component may be configured to perform a task even when the unit / circuit / component is not currently connected. Generally speaking, a circuit that forms a structure corresponding to "configured to" may include a hardware circuit. Similarly, for convenience in description, various units / circuits / components may be described as performing one or more tasks. Such descriptions should be interpreted as including the phrase "configured to". The statement that a unit / circuit / component is configured to perform one or more tasks is explicitly intended not to invoke 35 U.S.C. §112 (f) for that unit / circuit / component. DETAILED DESCRIPTION
[0031] In the following description, numerous specific details are set forth to provide a thorough understanding of the embodiments described in the present disclosure. However, one of ordinary skill in the art will recognize that the embodiments may be practiced without these specific details. In some instances, well-known circuits, structures, and techniques are not shown in detail for ease of illustration and to avoid obscuring the description of the embodiments.
[0032] refer to Figure 1 , a block diagram of one embodiment of an exemplary processor core 100 is shown. In the exemplary embodiment, the processor core 100 includes an instruction fetch unit (IFU) 110, a core interface 170, a compression / decompression unit 180, an execution unit 130, and a last level cache 190. The execution unit 130 is coupled to a load store unit (LSU) 150, which is also coupled to send data back to the execution unit 130. In addition, the LSU 150 is coupled to the core interface 170, which in turn may be coupled to the last level cache 190. In the exemplary embodiment, the last level cache 190 includes a bus interface unit (BIU) 195, which communicates with the processor core 100 via an on-chip network (e.g., such as a Figure 1 The internal bus 105 shown is coupled to the main memory. It should be noted that Figure 1 The embodiments shown in the figure are only examples, and some circuit blocks have been omitted for clarity. In other embodiments, different numbers of circuit blocks and different arrangements of circuit blocks may be used.
[0033] In some embodiments, processor core 100 is a standalone processor in a computing system. In other embodiments, processor core 100 is one of multiple cores of a multi-core processor. In other embodiments, the multi-core processor including processor core 100 is one of multiple dies on a system on a chip (SOC). In various embodiments, processor core 100 is used in a computing system within a desktop computer, a portable computer, a tablet computer, a smart phone, a mobile device, a server, a peripheral device, or others.
[0034] In various embodiments, the compression / decompression unit 180 unloads the rest of the processor core 100 from performing the operation of the compression / decompression algorithm. Thus, when the compression / decompression unit 180 processes the compression / decompression algorithm, the rest of the processor core 100 can be used to process other operations. In some embodiments, the compression / decompression unit 180 compresses and decompresses data based on one of a plurality of dictionary-based algorithms. In other embodiments, the compression / decompression unit 180 compresses and decompresses data based on one of a plurality of hybrid algorithms using a combination of a statistically based algorithm and a dictionary-based (table-based) algorithm. As used herein, a "dictionary" (also referred to as a "table") is a data structure (hardware and / or software-based) comprising a plurality of entries, each of which is configured to store data values that have undergone a compression process. During the compression process, the data values to be compressed are compared with the values stored in the dictionary to determine whether they have been seen before (e.g., all or part).
[0035] As shown, compression / decompression unit 180 includes compression engine 182 and decompression engine 184. Each of engine 182 and engine 184 includes multiple hardware channels for parallel processing of compression / decompression algorithm operation. Thus, throughput increases during compression / decompression operation because multiple parts of data are compressed / decompressed simultaneously by multiple hardware channels. In an embodiment, each part of the data sent for compression is an input word of a known size. In one example, a 32-bit input word is a part of the data, but a variety of other sizes are possible and conceivable.
[0036] In some embodiments, the algorithm operation is a pipeline, which also increases throughput. In addition, although there is a dependency between the multiple input words currently assigned to the hardware channel of the compression engine 182, in an embodiment, different second groups of input words are assigned to the hardware channel before the dependency between the input words of the first group is determined. So, although the second group depends on the dictionary update by the first group, before the dependency between the input words of the first group is determined, the second group is assigned to the hardware channel of the compression engine 182. Due to the relatively high throughput of engine 182 and engine 184, the instruction and data volume growth for processing multiple software applications is allowed, and there is no long delay exchange between the local cache memory and the permanent storage device, but the memory storage location in the local cache memory has a limited amount of storage space.
[0037] As described in more detail below, compression / decompression unit 180 compresses or decompresses a page of data into a group of multiple input words at a time in response to detecting a compression or decompression command / instruction defined in an instruction set architecture (ISA) for processor core 100. In some embodiments, additional instructions can be added to the ISA of processor core 100. In various embodiments, two instructions with opcodes indicating encoding / compression and decoding / decompression are added to ISA for performing data compression and decompression, respectively. In some embodiments, the instruction uses one or more parameters of the address of the destination or target page in the address of the specified source page and the memory. In some embodiments, each of the two instructions is converted into multiple micro-operations, which are also referred to as "micro-operations (micro-ops)". Compression / decompression unit 180 processes micro-operations.
[0038] In various embodiments, compression / decompression unit 180 provides information to final level cache 190 to pre-fetch a page of data for compression or decompression. In some cases, a request for the page of data may be sent to main memory via bus interface unit (BIU) 195. The pre-fetched page of data may be stored in final level cache 190 or another suitable location. Once the pre-fetched page of data has been stored in final level cache 190, the page may be transferred to a read buffer included in compression / decompression unit 180. One of engine 182 and engine 184 processes the received page. Before further describing engine 182 and engine 184, a further description of the remainder of processor core 100 is first provided.
[0039] Instruction fetch unit (IFU) 110 provides instructions to the rest of processor core 100 for execution. In the illustrated embodiment, IFU 110 may be configured to perform various operations related to fetching instructions from cache or memory, selecting instructions from various threads for execution, and decoding such instructions before issuing such instructions to various functional units for execution. IFU 110 also includes instruction cache 114. In one embodiment, IFU 110 may include logic for: maintaining a fetch address (e.g., derived from a program counter) corresponding to each thread executed by processor core 100; and coordinating retrieval of instructions from instruction cache 114 based on those fetch addresses. Additionally, in some embodiments, IFU 110 may include a portion of a mapping of virtual instruction addresses to physical addresses. For example, this portion of the mapping may be stored in an instruction translation lookaside buffer (ITLB) such as ITLB 115.
[0040] Execution unit 130 may be configured to execute and provide results of certain types of instructions issued from IFU 110. In one embodiment, execution unit 130 may be configured to execute certain integer type and floating point instructions defined in an implemented ISA, such as arithmetic instructions, logical instructions, and shift instructions. It is contemplated that in some embodiments, processor core 100 may include more than one execution unit, and each of the execution units may or may not be symmetrical in functionality.
[0041] The load store unit (LSU) 150 may be configured to handle data memory references, such as integer and floating point load and store instructions. In some embodiments, the LSU 150 may also be configured to help handle instruction cache 114 misses originating from the IFU 110. The LSU 150 includes a data cache 152, and logic configured to detect cache misses and responsively request data from a particular cache memory via the cache interface 170. In one embodiment, the data cache 152 may be configured as a write-through cache, where all stores are written to a particular cache memory, regardless of whether all stores hit the data cache 152. In other embodiments, the data cache 152 may be implemented as a write-back cache.
[0042] In one embodiment, LSU 150 may include a miss queue configured to store a record of pending memory accesses that missed in data cache 152, so that additional memory access target memory addresses where misses are pending may not generate additional cache request communications. In the illustrated embodiment, address generation for a load / store instruction may be performed by one of the one or more execution units 130. Depending on the addressing mode specified by the instruction, one of the one or more execution units 130 may perform arithmetic (e.g., such as adding an index value to a base value) to generate the desired address. Additionally, in some embodiments, LSU 150 may include logic configured to convert virtual data addresses generated by one or more execution units 130 to physical addresses. For example, in the present embodiment, LSU 150 includes a data translation lookaside buffer (DTLB) 153.
[0043] Steering Figure 2 , illustrates a block diagram illustrating one embodiment of the compression / decompression unit 200. In various embodiments, the compression / decompression unit 200 may correspond to Figure 1 In the illustrated embodiment, the compression / decompression unit 200 includes a read buffer 201, a compression engine 204, a decompression engine 203, a dictionary 210, a multiplexing circuit 205, a write buffer 206, a finite state machine circuit 208, and a pre-fetch circuit 209. It should be noted that in Figure 2 The embodiments depicted in the block diagrams are examples only. In other embodiments, different circuit blocks and different circuit block arrangements are possible and conceivable.
[0044] Read buffer 201 may include multiple entries, such as entry 202a and entry 202b, and parts of a page of data may be stored in multiple entries. In various embodiments, entries may be organized to allow multiple data words to be processed in parallel. For example, in some embodiments, entries may be arranged to allow a given number of 32-bit data words to be read by compression engine 204 or decompression engine 203. In some cases, four 32-bit data words are read by compression engine 204 or decompression engine 203. In other cases, another number of data words is possible and conceivable. Read buffer 201 may also be configured to receive ready signals from each of compression engine 204 and decompression engine 203, and ready signals indicate that multiple parallel hardware channels in those engines are ready to receive more data.
[0045] In some cases, if read buffer 201 is not ready to receive requested data, the data may be maintained in a buffer included in a bus interface unit (BIU). In an embodiment, the BIU may be coupled to a communication bus that allows data to be moved between various cache memories and system memory. In some embodiments, read buffer 201 may use a credit-based system to request data from a low-level cache memory (e.g., such as data cache 252). As described in more detail below, each of compression engine 204 and decompression engine 203 may be configured to compress or decompress the portion of data received from read buffer 201, respectively. In some embodiments, compression engine 204 and decompression engine 203 compress and decompress data based on one of a plurality of dictionary-based algorithms. In other embodiments, compression engine 204 and decompression engine 203 compress and decompress data based on one of a plurality of hybrid algorithms using a combination of a statistically based algorithm and a dictionary-based algorithm.
[0046] In various embodiments, dictionary 210 may include multiple entries, each of which corresponds to a given index and is configured to store a commonly used bit sequence. In some embodiments, each entry may be configured to store an index. In other embodiments, the entry does not store an index. In some cases, dictionary 210 may be implemented as a content addressable memory (CAM), accessing the content addressable memory (CAM) using a hash output created from the bits of a particular data word to be compressed. In other cases, dictionary 210 may be implemented as a direct mapping data storage structure, such as a table, in which a table entry maintains a constant corresponding to an index. For example, in the use of dictionary 210, table entry 7 maintains the seventh entry of dictionary 210. Thus, the index value is not stored in the entry. Dictionary 210 may be designed according to one of various design styles. For example, dictionary 210 may include multiple latches, flip-flops, random access memory (RAM) cells, or other suitable storage circuits configured to store individual data bits included in various entries.
[0047] As the part of compression and decompression operation, compression engine 204 and decompression engine 203 can access dictionary 210.During compression and decompression operation, compression engine 204 and decompression engine 203 can update one or more entries in dictionary 210, so as to improve subsequent compression operation.In some embodiments, compression operation and decompression operation are pipelines, which also increases throughput.In addition, although there is a dependency between a plurality of input words currently assigned to the hardware channel of compression engine 203, in embodiments, before determining the dependency between the input words of the first group, different second groups of input words are assigned to the hardware channel.So, although the second group depends on the updating of dictionary 210 by the first group, before determining the dependency between the input words of the first group, the second group is assigned to the hardware channel of compression engine 203.
[0048] Multiplexing circuit 205 may include a plurality of individual data bit multiplexing circuits that allow the selection of output from compression engine 204 or decompression engine 203 depending on the command being executed. Finite state machine circuit 208 may be configured to generate a plurality of signals to control the operation of various other circuit blocks included in compression / decompression unit 200. In various embodiments, finite state machine circuit 208 may receive compression and decompression instructions / commands from instruction fetch unit and signal prefetch circuit 209 to initiate prefetching of a page of data specified in the received command. Finite state machine circuit 208 may additionally control copying of data from write buffer 206 to a target storage location. In various embodiments, finite state machine circuit 208 may include a plurality of sequential and combinational logic circuits configured to implement the functions mentioned above.
[0049] Prefetch circuitry 209 may include a processor that may be configured to fetch multiple lines into a lower level cache such as, for example, Figure 2 In some embodiments, the prefetch circuit 209 may send a prefetch request to the computing system based on a number of available credits. In some embodiments, the prefetch circuit 209 may perform prefetches in dependence on a stride value. For example, in the case of compression, the processor core may prefetch the first N (where N is a positive integer) rows of a desired page, and the prefetch circuit 209 may prefetch after each row has been prefetched, incrementing the stride from the source address plus N to the end of the desired page of data.
[0050] Steering Figure 3 , a block diagram illustrating one embodiment of compressed information 300 is shown. In an embodiment, compressed information 300 includes one or more of compressed packages 301-compressed packages 305, a group of compressed packages 310, and a group of compressed packages 330. Figure 3The compressed information types depicted in are examples only. In other embodiments, the compression / decompression unit generates and uses different packet types, which may include different arrangements of commands and data.
[0051] In various embodiments, each compressed packet includes commands and possibly other additional information, depending on the result of the comparison with the dictionary. In an embodiment, each command is a combination of data bits that encode a specific packet type. If the data bits of a portion of the data being operated on are all zero, then compressed packet 301 can be used to compress the page data of that portion of the data. Compressed packet 301 only includes commands that specify that all data bits in the uncompressed file are zero.
[0052] When a portion of data is compared to a dictionary, in some embodiments, there is one of three possibilities. If the sequence of data bits in a portion of data does not match any entry in the dictionary, a miss occurs, and a compressed packet 302 can be used for the compressed page of data for a portion of data. The compressed packet 302 includes a command indicating that the bit sequence was not found in the dictionary, as well as a copy of the original portion (word) of the data. It should be noted that in some embodiments, a miss can cause the compression engine to modify the dictionary to include a new entry that will allow a match to a portion of the data, provided that space is available in the dictionary. In other embodiments, a miss causes the compression engine to replace the entry of the dictionary with the data of a copy of the word. The entry is pointed to by an index generated from the data of the word.
[0053] If the portion of data matches an existing entry in the dictionary, a hit occurs and a compressed packet 303 is available for the compressed page of data for the portion of data. The compressed packet 303 includes a command indicating that the portion of data matches an entry in the dictionary, and an index to the matching entry in the dictionary. In various embodiments, the index may be a hash of the portion of data.
[0054] In some cases, a portion of the data may partially match an entry in the dictionary. When this occurs, compressed packet 304 may be used in the compressed page of data for a portion of the data. Compressed packet 304 may include a command indicating a partial hit, and an index or hash corresponding to an entry in the dictionary that partially matches a portion of the data, and a partial word from a portion of the data that does not match the entry. In various embodiments, the number of data bits that match between a portion of the data and a given entry in the dictionary may be adjustable, depending on any suitable criteria.
[0055] In some embodiments, each of compressed packet 301 (zero) and compressed packet 303 (hit) does not modify the dictionary, while compressed packet 302 (miss) and compressed packet 304 (partial hit) do have information stored in the dictionary. In an embodiment, as described earlier, the entire 32-bit word (or other selected word length) is stored in the dictionary. In some embodiments, the word written to the dictionary replaces the word read from the dictionary and is used to perform a comparison between the dictionary word and the word in the current group being processed. In one example, if each of the three words in the current group has the same index, such as index 7, then entry 7 of the dictionary is accessed, such as by a read request. The word in entry 7 is retrieved from the dictionary and compared to the three words in the current group.
[0056] If the first two words of the current group match the words from entry 7 of the dictionary, the two comparisons result in a hit, and a compressed packet 303 is generated for each of the two words. No modification of the dictionary is performed on these two words. However, if the third word of the current group does not match the word from entry 7, the comparison results in a miss, and a compressed packet 302 is generated for the third word. In addition, the third word is added to the dictionary. In an embodiment, the third word replaces the word in entry 7 of the dictionary. Thus, the dictionary is updated for the third word.
[0057] Similar to the above example, a partial hit comparison result also causes the dictionary to be updated. If a portion of the third word matches the word in entry 7, but another different portion does not match, the comparison results in a partial hit. For a partial hit, a compressed packet 304 is generated. In the example, if bits 10 to 31 of the 32-bit third word in the current group match bits 10 to 31 of the 32-bit word retrieved from entry 7 of the dictionary, the comparison results in a partial hit. Bits 0 to 9 are stored in the compressed packet 304, and the entire 32 bits of the third word replace the word in entry 7 of the dictionary.
[0058] As in Figure 3 As can be seen in the embodiment illustrated in , each of compressed packet 303 (hit) and compressed packet 304 (partial hit) stores the generated index. Thus, during a later decompression operation, the index is not regenerated because the index can be retrieved from the compressed packet. Compressed packet 301 (zero) does not store the index, but during a later decompression operation, the index is not regenerated. Compressed packet 302 (miss) does not store the generated index. Thus, during a later decompression operation, the index is regenerated from the content of the word in compressed packet 302.
[0059] A fifth type of package may also be used. Compressed package 305 may include a command indicating a count of the number of repeated packages. Such packages may be used to replace multiple identical packages with a specific package following a run length encoding (RLE) package indicating how many times a specific package occurs in a sequence. By using RLE packages, additional compression may be achieved by storing only a single copy of a repeated package in a sequence and the number of times the package will repeat rather than all instances of the repeated package.
[0060] In some embodiments, a compressed packet such as Figure 3 310 may be combined to form a group. The group of compressed packets 310 depicts a specific embodiment of a group of compressed packets. In the illustrated embodiment, compressed packet 312, compressed packet 314, compressed packet 316, and compressed packet 318 are concatenated together into a single group that can be written to a target storage location. However, in some cases, it may be desirable to separate commands from their corresponding payloads in the various compressed packets. Figure 3 An embodiment of a group of compressed packets 330 employing such a technique is illustrated in FIG. In the illustrated embodiment, payload 332a, payload 334a, payload 336a, and payload 338a are concatenated together. Similarly, command Cmd 332b, command Cmd 334b, command Cmd 336b, and command Cmd 338b corresponding to payload 332a through payload 338a may then be concatenated onto the previously concatenated payloads.
[0061] Steering Figure 4 , illustrates a block diagram of one embodiment of a compression engine 400. In various embodiments, the compression engine 400 corresponds to Figure 2 4. In the illustrated embodiment, the hardware channel 400 includes a read interface 401, a packet generator 402, an RLE filter 404, a packet buffer 404, a group generator 405, and a write interface 406. In various embodiments, each of the components 401 to 406 includes multiple hardware channels. It should be noted that Figure 4 The embodiments shown in are examples only. In other embodiments, different circuit blocks and different circuit block arrangements may be used.
[0062] In various embodiments, the read interface 401 reads from a read buffer (such as, for example, Figure 2201). For example, in some embodiments, read interface 401 can read four 32-bit words in parallel from the read buffer. In other embodiments, another number of words and another word size are possible and conceivable. Read interface 401 can additionally perform some checks on the data read from the read buffer. For example, read interface 401 can check to determine whether one of the words contains all zeros with zero detection logic. In addition, read interface 401 can check whether any one of the words is the same or partially the same as one or more of the other words.
[0063] In addition, the read interface 401 can calculate the hash or index to be used with the dictionary lookup, and check to see whether any one of the words has the same index. In one example, a 4-bit index is used to access a 16-entry dictionary of direct mapping. In some embodiments, the read interface 401 can perform an XOR Boolean operation between specific bits of a given 42-bit word to generate a 4-bit index. In other embodiments, the read interface 401 accesses a hash table based on the specific bits of the word to generate an index. In other embodiments, a hash function is performed to the specific bits of a given word to generate an index. In addition, a combination of one or more of a table lookup, a plurality of hash functions, and a plurality of Boolean logic functions is used to generate an index. When generating an index for accessing a dictionary, the compression engine 400 performs a combination of a statistically based compression algorithm and a dictionary-based compression algorithm.
[0064] In an embodiment, a group of words is read by read interface 401 so that the leftmost word is the oldest word of the group, and the rightmost word is the newest word of the group. Words between the oldest word and the newest word are sorted in a similar manner. In other embodiments, the rightmost word is the oldest word of the group, and the leftmost word is the newest word of the group. In some embodiments, when two or more words have the same index, a single read request is sent to the dictionary, rather than multiple read requests, in which one read request comes from each word. In an embodiment, read interface 401 generates a read request only for the oldest word in two or more words with the same index, and sends a read request with the generated index to the dictionary on behalf of the other words in the two or more words with the same index.
[0065] The read interface 401 may include a plurality of flip-flop circuits, latches, and other sequential elements to store words before sending them to the packet generator 402. Additionally, in some embodiments, the read interface 401 includes two or more pipeline stages. Thus, in an embodiment, a read request for the contents of a particular entry of a dictionary (such as representing two or more words with the same index) is stored in a pipeline sequential element at the end of a first pipeline stage. The read request is sent to the dictionary in a later second pipeline stage, while the next group of words is read from the read buffer, and an index is generated for the next group.
[0066] In various embodiments, packet generator 402 generates a compressed packet for each of the words received from read interface 401. Packet generator 402 generates a compressed packet similar to Figure 3 In one embodiment, a CAM-based comparison circuit is used to compare a given word with each entry in the dictionary. In other embodiments, an index that specifies a particular entry of the dictionary is used to access the dictionary and to retrieve the word for use in the comparison. However, for parallel execution by multiple hardware channels, packet generator 402 generates a packet similar to the packet described in FIG. 4 by comparing a given word with a word from another hardware channel rather than with what is retrieved from the dictionary. Figure 3 . The selection logic is based on the loading of pipeline stages of multiple hardware channels. Additional details are provided later with examples. Packet generator 402 can determine the appropriate command and payload based on the comparison performed. Packet generator 402 can also include multiple flip-flop circuits for storing generated packets before sending the generated packets to RLE filter 403.
[0067] The RLE filter 403 may include a sequential logic circuit or state machine configured to track a sequence of similar packets. Similar packets may be, for example, a sequence of ZERO packets (i.e., packets that include all zero data bits), or a sequence of HIT packets to the same dictionary index. Once the start of a possible sequence is detected, such as, for example, a ZERO packet, the RLE filter 403 may track the subsequent number of packets in the sequence. Once the sequence ends, the RLE filter 403 may generate an RLE packet indicating the number of times a particular packet has been copied. The initial packet and the RLE packets in the sequence may be stored, thereby reducing the number of packets that need to be stored. The RLE packets may be used during decompression to generate additional copies of the packet that started the sequence.
[0068] Packet buffer 404 may include a plurality of flip-flops or other suitable storage circuits necessary to store packets prior to group generation by group generator 405. In various embodiments, group generator 405 may include a plurality of multiplexing circuits and shift registers. The multiplexing circuits and shift registers and other logic circuits may be arranged to allow a group of packets to be formed. In some embodiments, the format of the group of packets may correspond to Figure 3 The format of the package group is shown in .
[0069] The write interface 406 may include multiple buffers in which the groups are packaged. In various embodiments, the write interface 406 may package multiple groups into a single buffer until the buffer is full, at which point the contents of the buffer may be written to the write buffer waiting to be copied to the target storage location. Since the packets may be of various sizes, the groups may also be of various sizes. Thus, multiple groups may be combined in a single buffer. The buffers included in the write interface 406 may be arranged to allow pipeline operation within the write interface 406.
[0070] Reference now Figure 5 , a block diagram of an embodiment of an exemplary compression process 500 is shown. In the illustrated embodiment, a hybrid compression algorithm is executed serially, and the hybrid compression algorithm uses a combination of a statistically based compression algorithm and a dictionary-based compression algorithm. As shown, a single hardware channel referred to as "channel 0" is used. Later, a compression process with parallel execution in multiple hardware channels is provided. Although channel 0 is shown four times, this is for ease of illustration, and only a single hardware channel is used in the illustrated example. The portion of the compressed data is called a word. As shown, a dictionary 510 stores the most recently seen words in multiple entries. In the illustrated example, the dictionary 510 is a directly mapped data storage structure, such as a table. The dictionary 510 may include multiple latches, flip-flops, random access memory (RAM) cells, or other suitable storage circuits configured to store individual data bits included in various entries.
[0071] As shown, at time t0, channel 0 is loaded with word 0=C. Here, "C" is used as a general value for representing multi-bit values. Hexadecimal and other representations are not used here. For example, the value "C" can represent a 32-bit word. At time t1, an index is generated by a hash function, and the resulting index is 7. At time t2, a read request is generated. The read request specifies the index as 7. The read request is sent to the dictionary 510, and entry 7 is accessed. The value stored in entry 7 (which is the value C) is copied and returned to channel 0.
[0072] At time t3, comparison logic in channel 0 compares two values. The first value is the value C retrieved from entry 7 of dictionary 510. The second value is the value of word 0, which is C. The comparison result is a hit. At time t4, logic within channel 0 determines that there is no update to dictionary 510. At time t5, two operations are started. The first operation is to load channel 0 with word 1=C. The second operation builds a packet for word 0. With respect to the first operation, no updates are performed to dictionary 510 for the case where word 0=C. However, if updates do occur at time t4, then those updates need to be completed before any read requests for word 1=C are sent to dictionary 510. Channel 0 is shown loaded with word 1=C in the second copy of channel 0. With respect to the second operation, in an embodiment, the compressed packet generated is similar to Figure 3 For example, a compressed packet 303 may be generated for word 0.
[0073] As shown, at time t5, channel 0 is loaded with word 1=C. Again, channel 0 is shown loaded with word 1=C in the second copy of channel 0. An index is generated by the hash function, and the resulting index is 7. At time t6 (not shown for ease of illustration), a read request is generated. The read request specifies the index as 7. The read request is sent to dictionary 510, and entry 7 is accessed. The value stored in entry 7, which is value C, is copied and returned to channel 0. At time t7 (not shown), comparison logic in channel 0 compares two values. The first value is value C retrieved from entry 7 of dictionary 510. The second value is the value of word 1, which is C. The comparison result is a hit.
[0074] At time t8 (not shown), logic within channel 0 determines that there is no update to dictionary 510. At time t9 (not shown), two operations are initiated. The first operation is to load channel 0 with word 2=C. The second operation is to build a packet for word 1. The operation is repeated for word 2 and word 3. As shown, the operations at time t1 and time t5 can be completed in parallel, so although a serial implementation is shown with a single hardware channel, processing of subsequent words can begin before compressed packets are generated for earlier words. Thus, other pipeline stages can be used between and within the indicated times (such as time t1 to time t5). For example, at time t1, a first pipeline stage can load a word and a second pipeline stage can generate an index. However, there are dependencies between words, such as updating dictionary 510 and reading entries from dictionary 510 based on comparison results.
[0075] Reference now Figure 6, a block diagram illustrating another embodiment of a compression process 600 is shown. In the illustrated embodiment, a hybrid compression algorithm is performed serially, which uses a combination of a statistics-based compression algorithm and a dictionary-based compression algorithm. As shown, a single hardware channel, referred to as "channel 0", is used. The dictionary 510 described earlier is numbered identically.
[0076] As shown in the figure, at time t0, channel 0 is loaded with word 0 = A. The operations performed from time t1 to time t5 are the same as Figure 5 510 . However, here, the value stored in entry 7 of dictionary 510 is A. At time t5, channel 0 is loaded with word 1=B. Although value B is different from value A, the subset of value B used by the hash function generates the same index, which is 7. In one example, the subset is bits 10 to 17 of the 32-bit word. Thus, at time t7 (not shown, but equivalent to time t3), the comparison logic compares the value B of word 1 with the value A retrieved from entry 7 of dictionary 510. In this example, the comparison result is a miss. A partial hit comparison result is also possible, but in this example, a miss is used. At time t8, entry 7 of dictionary 510 is updated with the value B of word 1 because word 1 is now the most recently seen word.
[0077] At time t9, channel 0 is loaded with word 2=B, and index 7 is generated by the hash function. Thus, at a later time t11 (not shown, but equivalent to time t3), the comparison logic compares the value B of word 2 with the value B retrieved from entry 7 of dictionary 510. The comparison result is a hit. Thus, dictionary 510 does not need to be updated.
[0078] At time t13, channel 0 is loaded with word 3=C. Although value C is different from value A and value B, the subset of value C used by the hash function generates the same index, which is 7. Thus, at time t15 (not shown, but equivalent to time t3), the comparison logic compares the value C of word 3 with the value B retrieved from entry 7 of dictionary 510. In this example, the comparison result is a miss. A partial hit comparison result is also possible, but in this example, a miss is used. At time t16, entry 7 of dictionary 510 is updated with the value C of word 3 because word 3 is now the most recently seen word. As can be seen in this example, there are dependencies between words, such as updating dictionary 510 based on the comparison results and reading entries from dictionary 510. However, reading the entry of dictionary 510 for a given word is irrelevant to generating compressed packets for words that are older than the given word and processed before the given word.
[0079] Reference now Figure 7, a block diagram of one embodiment of an exemplary compression process 700 is shown. In the illustrated embodiment, a hybrid compression algorithm is performed in parallel, which uses a combination of a statistical-based compression algorithm and a dictionary-based compression algorithm. As shown, multiple hardware channels are used, referred to as "channel 0", "channel 1", "channel 2", and "channel 3". Although four hardware channels are shown in the illustrated embodiment, another number of multiple hardware channels is possible and contemplated. The dictionaries 510 described earlier are numbered identically.
[0080] As described earlier, pipeline stages may be used between indicated times (such as between each of time t1 to time t5) and within indicated times. For example, at time t1, a first pipeline stage may load a plurality of words, and a second pipeline stage may generate an index for each of the plurality of loaded words. In addition, one or more of the indicated times may be placed in the same pipeline stage. For example, operations performed at time t3 and time t4 may be combined in a single pipeline stage if the operations are completed within a given clock cycle. As shown, at time t0, each of channels 0 to 3 is loaded with a corresponding one of words 0 to 3. In this example, each of words 0 to 3 has a value of C.
[0081] With some adjustments, the operations performed for a given hardware channel at time t1 to time t5 for channel 0 to channel 3 are the same as Figure 5 5. For example, at time t2, a single read request is sent from channel 0 to dictionary 510 on behalf of hardware channels channel 0 to channel 3. In various embodiments, control logic in the compression engine determines that each hardware channel of channel 0 to channel 3 accesses the same entry of dictionary 510. In various embodiments, the control logic is implemented in hardware circuitry. Thus, it is known that channel 0 has the oldest word of a set of words word 0 to word 3. In this case, word 0 is the oldest word and word 0 is loaded into channel 0.
[0082] Additionally, the control logic determines that channel 3 has the newest word in the group of words word 0 through word 3. In this case, word 3 is the newest word and word 3 is loaded into channel 3. There is a dependency between the first group of words (such as word 0 through word 3) and the second group of words (such as a later group of loaded words with word 4 through word 7). Figure 7 In the illustrated embodiment of , the comparison result does not indicate a need to update dictionary 510. However, if the value of word 3=C is sent to dictionary 510 to update entry 7 of dictionary 510, no corruption occurs.
[0083] The update of dictionary 510 based on the comparison result of word 0 to word 3 needs to be completed before a read request for any of the later words 4 to word 7 is sent to dictionary 510. However, the dependency is based on updating dictionary 510 by the current latest word, which is word 3, rather than a dependency between any two words from word 0 to word 3. The next example highlights this fact.
[0084] Reference now Figure 8 , a block diagram illustrating another embodiment of compression processing 800 is shown. In the illustrated embodiment, parallel execution is again performed for a hybrid compression algorithm using hardware channels Channel 0 to Channel 3 and dictionary 510. As shown, at time t0, each of Channel 0 to Channel 3 is loaded with a corresponding one of Word 0 to Word 3. In this example, Word 0 has a value A, each of Word 1 and Word 2 has a value B, and Word 3 has a value C. Entry 7 of dictionary 510 has a value A. With some adjustments, the operations performed for a given hardware channel of Channel 0 to Channel 3 at time t1 to time t5 are the same as described earlier. At time t1, when it is found that each of Channel 0 to Channel 3 generates the same index 7, in various embodiments, the control logic implemented in the circuit determines that Channel 0 has the oldest word in a group of words Word 0 to Word 3 with the same index. Additionally, the control logic determines that Channel 3 has the newest word in a group of words Word 0 to Word 3 with the same index.
[0085] In some embodiments, when at least one of word 0 to word 3 does not have the same index as another word, the at least one word has not been passed to the next pipeline stage, so that only a group of words with the same index are processed simultaneously. For example, if word 3 has index 12, then word 0 to word 2 can be passed to the next pipeline stage for access to dictionary 510, while word 3 waits. However, word 3 still moves along the pipeline stage in front of later word 4. In other embodiments, when word 3 has a different index (such as index 12), word 3 is passed to the next pipeline stage when other words have the same index 7 among them. In such cases, dictionary 510 is dual-ported to support two simultaneous accesses, or word 3 waits in the later pipeline stage to access dictionary 510.
[0086] In another example, when word 1 has index 12 and each of word 0, word 2, and word 3 has index 7, in some embodiments, word 0 is sent to the next pipeline stage alone. In a later clock cycle, word 1 is sent to the next pipeline stage alone. In a later pipeline stage, each of word 2 and word 3 is sent to the next pipeline stage. Thus, the order of word 0 to word 3 is maintained, and the generation of compressed packets has the same order. In other embodiments, each of word 0, word 2, and word 3 is sent together in the next pipeline stage, but the indication is maintained that word 1 is newer than word 0 and older than word 2. In other embodiments, each of word 0 to word 3 is sent to the next pipeline stage, and dictionary 510 is dual-ported to support two simultaneous accesses.
[0087] Returning to the example where each of words 0 through 3 have the same index 7, at time t2, a single read request is sent from channel 0 to dictionary 510 on behalf of hardware channels channel 0 through channel 3. At time t3, it should be noted that each of the comparisons performed in channels 0 through channel 3 is between the value of the corresponding word of the channel and the value retrieved from entry 7 of dictionary 510. Thus, while there is a dependency relationship between each of words 0 through 3, a copy of the value A from entry 7 of dictionary 510 is used in each of channels 0 through channel 3. For example, again briefly referring to Figure 6 , during serial execution, when the dependencies between words are considered, each of word 2 and word 3 is compared to value B. The update of dictionary 510 occurs between the serial processing of each of word 0 to word 3. However, here Figure 8 In , during parallel execution, each of word 2 and word 3 is compared to value A (value A is a copy of entry 7 of dictionary 510), and no update has yet been performed on dictionary 510. Although the initial values of word 0 to word 3 and entry 7 are the same, multiple hardware channels are used to execute in parallel. Figure 8 The comparison results shown are compared with those performed serially by a single hardware channel. Figure 6 The comparison results shown in are different.
[0088] Figure 6 The comparison results in can be used to generate compressed packets for each of words 0 to 3, and Figure 8The comparison results in cannot be used to generate compressed packets for each of word 0 to word 3. However, again, allowing any of the later second group of words (such as word 4 to word 7) to access dictionary 510 is dependent on the update of dictionary 510 by the current latest word (the current latest word is word 3), rather than the dependency between any two words from word 0 to word 3. Thus, once it is known that dictionary 510 is updated by the current latest word (the current latest word is word 3), the later second group of words (such as word 4 to word 7) are permitted to access dictionary 510. For example, the update of the latest word can be forwarded (bypassed) to a read request from the later second group of words (such as word 4 to word 7).
[0089] In the illustrated embodiment, at time t4, it is known that word 3 is the newest word in a group of words (words 0 to 3) with the same index (7), and in addition, it is known that at least one update has occurred for the group of words. For example, a comparison result of a miss indicates that dictionary 510 will be updated. As described earlier, a comparison result of a partial hit also indicates that dictionary 510 will be updated. Although the indication of at least one dictionary update may not be used to generate a compressed packet, the indication can be used to determine whether dictionary 510 will be updated. In this example, in addition to determining that the update is to write entry 7 with the value C, the control logic determines that an update of dictionary 510 has occurred. Thus, at time t5, a compressed packet is generated for each of word 0 to word 3, while at the same time, a second group of words 4 to word 7 is later loaded into channels 0 to channel 3.
[0090] In some embodiments, at time t4, a second group of words 4 to 7 are loaded into channels 0 to 3, and the corresponding index is found by the hash function. At time t5, if words 4 to 7 have the same index, a read request is sent to the dictionary 510 on behalf of words 4 to 7. In addition, if words 4 to 7 also have the same index 7, the update corresponding to word 3 can be forwarded to the read request. Thus, although the dependency between words 0 to 3 has not been determined before the read request for words 4 to 7, channels 0 to 3 use the value C for comparison at time t6 for words 4 to 7.
[0091] In some embodiments, there are no significant number of time constraints for generating compressed packets. When multiple passes are performed on groups of compressed packets, the delay for generating compressed packets can be hidden. Thus, at time t5, when processing has begun on the second group of words 4 to 7, the control logic for determining the true dependency between words 0 to 7 can begin processing. For example, finding the true dependency value for the comparison operation is completed. Again briefly referring to Figure 6, the true dependent value of each of word 2 and word 3 is value B instead of value A. Value B is the value of word 1, which is the newest word among the words older than word 2. Each of word 0 and word 1 is older than word 2, and word 1 is the newest word among the two words. Similarly, each of word 0, word 1, and word 2 is older than word 3, and word 2 is the newest word among the three words. The value of word 2 is also B, and the value of word 2 is the true dependent value for the comparison operation of word 3.
[0092] The control logic for finding the true dependency value may include comparison logic and a multiplexer circuit. The delay for finding the true dependency value may be considerable, especially as the number of hardware channels increases. Rather than adding this delay between processing the first group of words 0 to 3 and the second group of words 4 to 7, this delay may be removed and hidden in the later intra-group fixation operation and subsequent compressed packet generation. It should be noted that fixation does not occur for the words loaded into channel 0 because, in some embodiments, the words loaded into channel 0 are always the oldest words of a particular index. Thus, the true dependency value of the comparison operation is always a value read from the dictionary 510 or a value forwarded (bypassed) from the processing of the previous word.
[0093] Reference now Fig. 9 , shows a generalized flow chart of one embodiment of a method 900 for efficiently compressing data. For discussion purposes, the embodiments (and for Fig.11 However, in other embodiments, some steps may occur in an order different from that shown, some steps may be performed concurrently, some steps may be combined with other steps, and some steps may not exist.
[0094] In some embodiments, the instruction fetch unit receives instructions from other suitable locations in the instruction cache or system memory. The instruction is decoded and determined to be a compression instruction (box 902). In an embodiment, the compression engine of the compression / decompression unit loads (prefetches) source data (such as source pages) into a source buffer (box 904). In some embodiments, the source data is first stored in the data cache, and then later stored in a read buffer in the compression / decompression unit. In an embodiment, a first number of rows are prefetched by a processor core, and later the remaining rows remaining in the desired page source data are prefetched by a dedicated circuit included in the compression / decompression unit. The dedicated circuit can prefetch using a predetermined stride value, which can be different for compression and decompression operations.
[0095] At least two or more of the plurality of hardware channels are assigned corresponding words of source data (box 906). In some embodiments, the source data is divided into portions such as words of a fixed size. A specific index is determined for each word, wherein the index specifies the entry of a dictionary to be accessed (box 908). The dictionary stores the most recently seen words during a compression or decompression operation. As described earlier, a specific bit field within a word is used with a hash function to generate an index. For a first group of words, a dictionary is accessed, each word in the first group having the same first index (box 910). For example, a single read request is sent to the dictionary on behalf of multiple words in the first group with the same index.
[0096] Before determining the real intra-group dependency of the first group, for the second group of words, access the dictionary, each word in the second group has the same index (box 912). In various embodiments, each of the first group and the second group has the same index, and therefore accesses the same entry in the dictionary. For a given word of the first group, the real intra-group dependency is the comparison result and dictionary update of each of the words older than the given word of the first group. The comparison result and dictionary update of the given word are parts of the real intra-group dependency of the words newer than the given word in the first group. The real group dependency of the first group is used to generate a compressed package for the first group, and correctly update the dictionary for the subsequent and newer second group. However, when the latest word of the first group is known and it is found that at least one dictionary update occurs for the first group, although the real intra-group dependency of the first group is still unknown, the dictionary update required by the second group is now known. The dictionary update required by the second group is the value of the latest word of the first group written into the entry of the dictionary pointed to by the index of the first group. In various embodiments, the value of the latest word of the first group is forwarded (bypassed) to the second group, and the dictionary update actually occurs later or at the same time.
[0097] A compressed package (or "compressed package") is generated for the words in each of the first group and the second group (block 914). In various embodiments, an intra-group fixup operation is performed for at least the first group. In an embodiment, during processing of the compression operation, an indication of at least one dictionary update is generated based on comparing each word of the first group with a copy of the word stored in the dictionary entry pointed to by the index of the first group. During the intra-group fixup operation, a true intra-group dependency is found by finding a true value for comparison with each word of the first group. In some embodiments, the true value of a given word of the first group is the value of the most recent word that is older than the given word of the first group.
[0098] As described earlier, the control logic for finding the real intra-group dependency value for comparison with a given word in the first group may include comparison logic and a multiplexer circuit. The delay for finding the real intra-group dependency value may be considerable, especially as the number of hardware channels increases. Rather than adding this delay between the processing of the first group and the second group, this delay may be removed and hidden in a later intra-group fixed operation. Before providing other examples of compression operations, an example of a decompression operation is described below.
[0099] Now turn to Fig.10 , a block diagram illustrating one embodiment of a decompression process 1000 is shown. In the illustrated embodiment, a parallel execution is again performed on the hybrid compression algorithm. Here, parallel hardware channels Channel 0 through Channel 3 are used in the decompression engine. Although four hardware channels are shown in the illustrated embodiment, another number of multiple hardware channels is possible and conceivable. The dictionaries 510 described earlier are numbered identically. Similar to the hardware channels of the compression engine, the hardware channels of the decompression engine can use pipeline stages.
[0100] As shown, channel 0 is assigned packet 0 with a Cmd (command) specifying a hit and an index of 7. Although "compressed" is not used in the name, each of packets 0 to 3 is a compressed packet generated as described earlier. Channel 1 is assigned packet 1 with a Cmd specifying a miss and a payload with a value of B. Channel 2 is assigned packet 2 with a Cmd specifying a hit and an index of 7, and channel 3 is assigned packet 3 with a Cmd specifying a miss and a payload with a value of C. Entry 7 of dictionary 510 initially stores the value A. At time t1, packets without an index have an index generated from the corresponding payload. The index generation operation described earlier can be used again. As shown, each of packets 1 and 3 has an index of 7 generated.
[0101] In various embodiments, the control logic in the decompression engine determines that each hardware channel of channel 0 to channel 3 accesses the same entry of dictionary 510 because it has the same index 7. In various embodiments, the control logic is implemented in hardware circuits. Thus, it is known that channel 0 has the oldest packet and channel 3 has the newest packet of packets 0 to 3. At time t2, on behalf of hardware channels channel 0 and channel 2, a single read request is sent from channel 0 to dictionary 510. Each of packet 1 and packet 3 has a payload, and therefore, it is not necessary to access dictionary 510 for the word corresponding to the compressed packet. As shown, each of channel 0 and channel 2 receives value A from entry 7 of dictionary 510 as the decompressed word.
[0102] Again briefly refer to Figure 6 , we can see that word 2 has value B. Therefore, for Fig.10, the decompression engine has an erroneous value A for word 2 in time t2. If the true intra-group dependency is taken into account at time t2, the value B will be determined for word 2. However, similar to the compression engine and in order to achieve relatively high throughput, the decompression engine does not determine the true intra-group dependency at this time. Allowing any packet of the later second group of packets (such as packets 4 to 7) to access the dictionary 510 is dependent on the update of the dictionary 510 by the current latest packet (the current latest packet is packet 3), rather than the dependency between any two packets of packets 0 to 3. Thus, once it is known that the dictionary 510 is updated by the current latest packet (the current latest packet is packet 3), the later second group of packets (such as packets 4 to 7) are granted access to the dictionary 510. For example, the update of the latest packet can be forwarded (bypassed) to the read request from the later second group of packets.
[0103] In the illustrated embodiment, at time t3, it is known that Pack 3 is the latest of Packs 0 to 3 with the same index (7), and in addition, it is known that at least one update has occurred for the group of packets. For example, a command (Cmd) that misses indicates that the dictionary 510 will be updated. As described earlier, a command that partially hits also indicates that the dictionary 510 will be updated. Although the indication of at least one dictionary update may not be used to generate a decompressed word, the indication may be used to determine whether the dictionary 510 will be updated.
[0104] In this example, in addition to determining that the update is to write entry 7 with value C, the control logic determines that an update of dictionary 510 occurs. Thus, at time t4, a decompressed word is generated for each of packets 0, 1, and 3, and the decompressed word is written into the write buffer, while a second group of packets 4 to 7 are loaded into channels 0 to 3 later. If forwarding (bypass) is used, the second group of packets 4 to 7 are loaded into channels 0 to 3 even earlier. In some embodiments, the intra-group positioning operation occurs unconditionally for each of packets 0 to 3. In other embodiments, the oldest packet in the group (such as packet 0) skips this operation. In addition, the command of the packet can be used to determine whether a particular packet requires intra-group positioning. For example, a miss command indicates that the payload has the correct decompressed word. In contrast, a hit command indicates that the correct decompressed word is in dictionary 510, and the data read from dictionary 510 may be incorrect at this time because the true intra-group dependency is not considered at this time to hide the delay at a later time.
[0105] Reference now Fig.11, a generalized flow chart of one embodiment of a method 1100 for efficiently compressing data is shown. In some embodiments, an instruction fetch unit receives instructions from an instruction cache or other suitable location in a system memory. The instruction is decoded and determined to be a decompression instruction (block 1102). In an embodiment, a decompression engine of a compression / decompression unit loads (prefetches) source data (such as source pages of a compressed packet) into a source buffer (block 1104). In some embodiments, the source data is first stored in a data cache, and then later stored in a read buffer in the compression / decompression unit. Similar to the compression engine, a variety of methods can be used to prefetch data into a source buffer.
[0106] At least two or more of the plurality of hardware channels are assigned corresponding compressed packets of source data (block 1106). For compressed packets that do not specify an index for accessing a dictionary, a particular index is determined (block 1108). The dictionary stores packets most recently seen during a compression or decompression operation. As described earlier, a particular bit field within the packet is used with a hash function to generate an index. For a first group of packets, the dictionary is accessed, each packet in the first group having the same first index (block 1110). For example, on behalf of multiple packets in the first group with the same index, a single read request is sent to the dictionary and does not include a payload with a decompressed word.
[0107] Before determining the real intra-group dependency of the first group, for the second group of packets, access the dictionary, each packet in the second group has the same index (box 1112). In various embodiments, each of the first group and the second group has the same index, and therefore accesses the same entry in the dictionary. For a given packet of the first group, the real intra-group dependency is the comparison result provided as the command in the packet and the dictionary update of each packet older than the given packet of the first group. The comparison result and dictionary update of the given packet are parts of the real intra-group dependency of the packet updated than the given packet in the first group. The real group dependency of the first group is used to generate the decompressed word for the first group, and correctly update the dictionary for the subsequent and newer second group. However, when the latest packet of the first group is known and at least one dictionary update is found to occur in the first group during compression, although the real intra-group dependency of the first group is not known, the dictionary update required by the second group is now known. The dictionary update required by the second group is the value of the decompressed word of the latest packet of the first group written into the entry of the dictionary pointed to by the index of the first group. In various embodiments, the values of the most recent packet of the first group are forwarded (bypassed) to the second group, while the dictionary update actually occurs later or simultaneously.
[0108] Decompressed words are generated for each of the packets in the first group and the second group (block 1114). In various embodiments, an intra-group fixation operation is performed on at least the first group. Similar to the intra-group fixation (positioning) operation of the compression engine, the intra-group fixation (positioning) operation of the decompression engine determines the true intra-group dependency by finding the true source of the decompressed words for each packet of the first group. In some embodiments, the true value of a given packet of the first group is the value of the latest packet that is older than the given packet of the first group.
[0109] As described earlier, the control logic for finding the true intra-group dependency value for comparison with a given packet in the first group may include comparison logic and a multiplexer circuit. The delay for finding the true intra-group dependency value may be considerable, especially as the number of hardware channels increases. Rather than adding this delay between the processing of the first and second groups, the delay may be removed and hidden in a later intra-group fixation operation.
[0110] Reference now Fig.12 , a block diagram illustrating one embodiment of compression processing 1200 is shown. In the illustrated embodiment, parallel execution is again performed for a hybrid compression algorithm using hardware channels channel 0 to channel 3 and dictionary 510. As shown, at time t0, each of channels 0 to channel 3 is loaded with a corresponding one of words 0 to word 3. The values of words 0 to word 3 are Figure 8 The operations performed for a given hardware channel of channel 0 to channel 3 at time t1 to time t5 are the same as those described earlier, with some adjustments.
[0111] In the illustrated embodiment, at time t2, channel 1 to channel 3 determine the real intra-group dependency value for comparison with the value of the word assigned to the channel. As described earlier, in some embodiments, only words with the same index advance together in the pipeline. In addition, it was described earlier that the real intra-group dependency value of a given word is the latest among the words older than the given word. Thus, since words are assigned to channels and only words with the same index are allowed to advance together in the pipeline, the real dependency value is the word in the adjacent channel. It is known in advance that the real dependency value of word 0 in channel 0 is the word read from dictionary 510, and the real dependency value of word 1 in channel 1 is word 0 in channel 0, and the real dependency value of word 2 in channel 2 is word 1 in channel 1, and the real dependency value of word 3 in channel 3 is word 2 in channel 2. Multiplexing circuits and comparators are not used. On the contrary, direct lines can be used. Thus, intra-group positioning operations are not required before generating compressed packets.
[0112] Now turn to Fig.13, a block diagram illustrating one embodiment of a decompression process 1300 is shown. In the illustrated embodiment, parallel execution is again performed for a hybrid decompression algorithm using hardware channels Channel 0 to Channel 3 and dictionary 510. As shown, at time t0, each of Channel 0 to Channel 3 is loaded with a corresponding one of Packets 0 to Packets 3. The values of Packets 0 to Packets 3 are Fig.10 The operations performed for a given hardware channel of channel 0 to channel 3 at time t1 to time t4 are the same as those described earlier, with some adjustments.
[0113] In the illustrated embodiment, at time t2, channels 1 to 3 determine the true intra-group dependency values for generating their decompressed words. As described earlier, in some embodiments, only packets with the same index advance together in the pipeline. In addition, it was described earlier that the true intra-group dependency value of a given packet is the latest among packets older than the given packet. Thus, since packets are assigned to channels and only packets with the same index are allowed to advance together in the pipeline, after time t1 known for each index in the assigned packets, the command (Cmd) of the packet is used to select between the payload (Cmd=miss) and the decompressed word from the adjacent channel (Cmd=hit). It is known that between time t1 and time t2, the true decompressed word of packet 0 in channel 0 is the packet read from dictionary 510, and the true decompressed word of packet 1 in channel 1 is the payload of channel 1, and the true decompressed word of packet 2 in channel 2 is the payload of channel 3. Some multiplexing circuits and comparators are used for the Cmd values. However, the delay may still be fairly small and, therefore, no intra-group positioning operation is required before storing the decompressed word in the write buffer.
[0114] Reference now Fig.14 , a block diagram illustrating one embodiment of compression processing 1400 is shown. In the illustrated embodiment, parallel execution is again performed for a hybrid compression algorithm using hardware channels channel 0 to channel 3 and dictionary 510. As shown, at time t0, each of channels 0 to channel 3 is loaded with a corresponding one of words 0 to word 3. The values of words 0 to word 3 are Figure 8 and Fig.12 The operations performed for a given hardware channel of channel 0 to channel 3 at time t1 to time t5 are the same as those described earlier, except that they are performed in a different order.
[0115] As described earlier, it may be known in advance that channel 0 has the oldest word of word 0 to word 3, and channel 3 has the newest word of word 0 to word 3. At time t2, a single read request is sent from channel 0 to dictionary 510. In addition, at time t2, the value of the newest word (the newest word is word 3) is stored for later updating of dictionary 510. For example, the value C of word 3 may be stored in a register for writing entry 7 of dictionary 510 and for forwarding (bypassing) the value C to the newer second group with word 4 to word 7. At time t4, the determination for finding the true intra-group dependency value is started. In some embodiments, the processing step at time t4 lasts for two or more pipeline stages. The comparison is completed at time t5, and a compressed packet is generated without performing an intra-group positioning operation.
[0116] In various embodiments, the program instructions of the software application can be used to implement the previously described methods and / or mechanisms. The program instructions can describe the behavior of the hardware in a high-level programming language such as C. Alternatively, a hardware design language (HDL) such as Verilog can be used. The program instructions can be stored on a non-transitory computer-readable storage medium. Many types of storage media are available. During use, the storage medium can be accessed by a computer to provide the program instructions and attached data to the computer for program execution. In some embodiments, a synthesis tool reads the program instructions to generate a netlist including a gate list from a synthesis library.
[0117] It should be emphasized that the above embodiments are only non-limiting examples of specific implementations. Once the above disclosure is fully understood, many variations and modifications will become apparent to those skilled in the art. The present invention is intended that the following claims be interpreted as covering all such variations and modifications.
Claims
1. An apparatus for performing memory compression, include: a table, the table comprising a plurality of entries; and A compression circuit comprising a plurality of hardware channels, wherein in response to receiving an indication of a compression instruction, the compression circuit is configured to: assigning a first set of two or more input words to the plurality of hardware channels; In response to determining that at least a first input word and a second input word of the first set of two or more input words correspond to a same entry of the table, generating for the first input word and the second input word: a single read request for the table; and a single write request to the table; as well as A compressed packet is generated for each of the first input word and the second input word. 2 . The apparatus of claim 1 , wherein the compression circuit is further configured to generate an index for each word assigned to a channel of the plurality of channels.
3. The apparatus of claim 2, wherein to determine that a first input word and a second input word in the first set of two or more input words correspond to the same entry of the table, the circuit is configured to determine that the first input word and the second input word have the same index. 4 . The apparatus of claim 1 , wherein the compression circuit is configured to generate an index corresponding to a given input word based at least in part on a hash of the given input word.
5. The apparatus of claim 1 , wherein the compression circuit is configured to determine whether to update the table with any input word of the first group before determining intra-group dependencies between input words of the first group by determining, for one or more input words of the first group, comparison results with older input words of the first group.
6. The apparatus of claim 5, wherein the compression circuit is configured to: assigning a second group of input words from the plurality of input words to the plurality of hardware channels, wherein the second group is different from the first group; Wherein for each table entry to be accessed, the compression circuit is further configured to: determining the latest input word of the first group; and Before determining the intra-group dependencies between the input words of the first group, the latest input word is forwarded to the second group.
7. The apparatus of claim 6 , wherein for each table entry to be accessed, the compression circuit is further configured to: determining the oldest input word of the first group; and A read request for an input word in the table is sent from a channel of the plurality of hardware channels that is assigned to the oldest input word.
8. A method for performing memory compression, include: storing the input word in a table comprising a plurality of entries; as well as In response to receiving an indication of a compression instruction: assigning a first set of two or more input words to a plurality of hardware channels; In response to determining that at least a first input word and a second input word of the first set of two or more input words correspond to a same entry of the table, generating for the first input word and the second input word: a single read request for the table; and a single write request to the table; as well as A compressed packet is generated for each of the first input word and the second input word. 9 . The method of claim 8 , further comprising generating an index for each word assigned to a channel of the plurality of channels.
10. The method of claim 9, wherein to determine that a first input word and a second input word in the first set of two or more input words correspond to the same entry of the table, the method comprises determining that the first input word and the second input word have the same index.
11. The method of claim 8, further comprising generating an index corresponding to a given input word based at least in part on a hash of the given input word.
12. The method of claim 8, further comprising determining whether to update the table with any input words of the first group before determining intra-group dependencies between input words of the first group by determining comparison results with older input words of the first group for one or more input words of the first group.
13. The method according to claim 12, further comprising: include: assigning a second group of input words from the plurality of input words to the plurality of hardware channels, wherein the second group is different from the first group; as well as For each table entry that will be accessed: Determine the latest input word of the first group; as well as Before determining the intra-group dependencies between the input words of the first group, the latest input word is forwarded to the second group.
14. The method of claim 13, wherein for each table entry to be accessed, the method further include: Determine the oldest input word of the first group; as well as A read request for an input word in the table is sent from a channel of the plurality of hardware channels that is assigned to the oldest input word.
15. A system for performing memory compression, include: Memory; a cache memory coupled to the memory; and a processor coupled to the memory and the cache, wherein the processor is configured to: assigning a first set of two or more input words to a plurality of hardware channels; In response to determining that at least a first input word and a second input word of the first set of two or more input words correspond to a same entry of the table, generating for the first input word and the second input word: a single read request for the table; and a single write request to the table; as well as A compressed packet is generated for each of the first input word and the second input word.
16. The system of claim 15, wherein the processor is further configured to generate an index for each word assigned to a channel of the plurality of channels.
17. The system of claim 16, wherein to determine that a first input word and a second input word in the first set of two or more input words correspond to the same entry of the table, the processor is configured to determine that the first input word and the second input word have the same index.
18. The system of claim 15, wherein the processor is configured to generate an index corresponding to a given input word based at least in part on a hash of the given input word.
19. The system of claim 15, wherein the processor is configured to determine whether to update the table with any input word of the first group before determining intra-group dependencies between input words of the first group by determining, for one or more input words of the first group, comparison results with older input words of the first group.
20. The system of claim 19, wherein the processor is configured to: assigning a second group of input words from the plurality of input words to the plurality of hardware channels, wherein the second group is different from the first group; Wherein for each table entry to be accessed, the processor is further configured to: determining the latest input word of the first group; and Before determining the intra-group dependencies between the input words of the first group, the latest input word is forwarded to the second group.
