# US 2021/0279054 A1 · Implementing a micro-operation cache with compaction

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0279054 A1
- Document ID: US20210279054A1
- Status: Published application
- Kind: A1
- Application number: 17/325,067
- Filed: 2021-05-19
- Published: 2021-09-09
- Earliest claimed: 2019-03-08
- Assignees: Advanced Micro Devices, Inc.
- Applicants: Advanced Micro Devices, Inc.
- Inventors: Jagadish B. Kotra; John Kalamatianos
- Web page: https://patentgrep.com/patent/US20210279054A1

## CPC

- G06F 9/223: {Execution means for microinstructions irrespective of the microinstruction function, e.g. decoding of microinstructions and nanoinstructions; timing of microinstructions; programmable logic arrays; delays and fan-out problems}
- G06F 9/3814: {Implementation provisions of instruction buffers, e.g. prefetch buffer; banks}
- G06F 9/3016: {Decoding the operand specifier, e.g. specifier format}
- G06F 9/3818: {Decoding for concurrent execution}
- G06F 12/0875: with dedicated cache, e.g. instruction or stack
- G06F 12/126: with special data handling, e.g. priority of data or instructions, handling errors or pinning
- G06F 2212/452: Instruction code
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

Systems, apparatuses, and methods for compacting multiple groups of micro-operations into individual cache lines of a micro-operation cache are disclosed. A processor includes at least a decode unit and a micro-operation cache. When a new group of micro-operations is decoded and ready to be written to the micro-operation cache, the micro-operation cache determines which set is targeted by the new group of micro-operations. If there is a way in this set that can store the new group without evicting any existing group already stored in the way, then the new group is stored into the way with the existing group(s) of micro-operations. Metadata is then updated to indicate that the new group of micro-operations has been written to the way. Additionally, the micro-operation cache manages eviction and replacement policy at the granularity of micro-operation groups rather than at the granularity of cache lines.

## Claims

### Claim 1

A processor, comprising:
a decode unit configured to decode instructions from an instruction stream into groups of micro-operations; and
a micro-operation cache configured to:
receive a first group of micro-operations from the decode unit;
identify a second group of micro-operations stored in a first cache line;
store the first group of micro-operations together with the second group of micro-operations in the first cache line responsive to detecting a first condition; and
store the first group of micro-operations in a second cache line responsive to not detecting the first condition, wherein no other groups of micro-operations are stored in the second cache line.

### Claim 2 (depends on 1)

The processor as recited in claim 1, wherein the micro-operation cache is further configured to:
select a victim way from a set targeted by the first group of micro-operations responsive to receiving the first group of micro-operations;
evict all resident micro-operations from the victim way responsive to determining that the victim way is not compacted; and
evict a subset of a plurality of groups of micro-operations from the victim way responsive to determining that the victim way is compacted and responsive to determining the first group of micro-operations can fit in available space of the victim way after the subset is evicted.

### Claim 3 (depends on 2)

The processor as recited in claim 2, wherein the micro-operation cache is configured to select, as the subset to be evicted from the victim way, a minimum sized group in the victim way that can fit the first group of micro-operations.

### Claim 4 (depends on 1)

The processor as recited in claim 1, wherein storing the first group of micro-operations together with the second group of micro-operations in the first cache line comprises:
merging, within the first cache line, the first group of micro-operations together with the second group of micro-operations and immediate and/or displacement fields of the first group and the second group responsive to detecting the first condition;
storing a first offset indicating a starting location in the first cache line of micro-operations of the first group of micro-operations;
storing a second offset indicating a starting location in the first cache line of immediate and/or displacement fields of the second group of micro-operations; and
storing a third offset indicating a starting location in the first cache line of immediate and/or displacement fields of the first group of micro-operations.

### Claim 5 (depends on 1)

The processor as recited in claim 1, wherein the micro-operation cache is further configured to:
maintain metadata which indicates a number of groups of micro-operations stored in each cache line;
store a first indication in first metadata that the first cache line stores a plurality of micro-operation groups compacted together responsive to detecting the first condition; and
store a second indication in second metadata that the second cache line stores a single micro-operation group responsive to not detecting the first condition.

### Claim 6 (depends on 1)

The processor as recited in claim 1, wherein:
the first condition is determining that the first group and at least one existing group are able to fit into a single way of the micro-operation cache; and
responsive to detecting the first condition, the micro-operation cache is further configured to store immediate and/or displacement fields in the first cache line after micro-operations from the first group and the at least one existing group.

### Claim 7 (depends on 1)

The processor as recited in claim 1, wherein:
the micro-operation cache is further configured to maintain replacement policy metadata at a granularity of a micro-operation group; and
the processor further comprises an instruction cache configured to store the first group of micro-operations and at least one group of micro-operations together in a single cache line of the instruction cache responsive to the first cache line being evicted from the micro-operation cache.

### Claim 8

A method, comprising:
decoding, by a decode unit, instructions from an instruction stream into groups of micro-operations;
receiving, by a micro-operation cache, a first group of micro-operations from the decode unit;
identifying a second group of micro-operations stored in a first cache line;
storing, by the micro-operation cache, the first group of micro-operations together with the second group of micro-operations in the first cache line responsive to detecting a first condition; and
storing, by the micro-operation cache, the first group of micro-operations in a second cache line responsive to not detecting the first condition, wherein no other groups of micro-operations are stored in the second cache line.

### Claim 9 (depends on 8)

The method as recited in claim 8, further comprising:
selecting, based at least in part on criteria associated with compaction, a victim way from a set targeted by the first group of micro-operations responsive to receiving the first group of micro-operations;
evicting all resident micro-operations from the victim way responsive to determining that the victim way is not compacted; and
evicting a subset of a plurality of groups of micro-operations from the victim way responsive to determining that the victim way is compacted and responsive to determining the first group of micro-operations can fit in available space of the victim way after the subset is evicted.

### Claim 10 (depends on 9)

The method as recited in claim 9, further comprising selecting, as the subset to be evicted from the victim way, a minimum sized group in the victim way that can fit the first group of micro-operations.

### Claim 11 (depends on 8)

The method as recited in claim 8, wherein storing the first group of micro-operations together with the second group of micro-operations in the first cache line comprises:
merging, within the first cache line, the first group of micro-operations with at least a second group of micro-ops and one or more immediate and/or displacement fields of the first group and the second group responsive to detecting the first condition;
storing a first offset indicating a starting location in the first cache line of micro-operations of the first group of micro-operations;
storing a second offset indicating a starting location in the first cache line of immediate and/or displacement fields of the second group of micro-operations; and
storing a third offset indicating a starting location in the first cache line of immediate and/or displacement fields of the first group of micro-operations.

### Claim 12 (depends on 8)

The method as recited in claim 8, further comprising:
maintaining metadata which indicates a number of groups of micro-operations in each cache line;
storing a first indication in first metadata that the first cache line stores a plurality of micro-operation groups compacted together responsive to detecting the first condition; and
storing a second indication in second metadata that the second cache line stores a single micro-operation group responsive to not detecting the first condition.

### Claim 13 (depends on 8)

The method as recited in claim 8, further comprising storing immediate and/or displacement fields in the first cache line after micro-operations from the first group and at least one existing group.

### Claim 14 (depends on 8)

The method as recited in claim 8, further comprising:
maintaining replacement policy metadata at a granularity of a micro-operation group; and
storing the first group of micro-operations and the at least one group of micro-operations together in a single cache line of an instruction cache responsive to the first cache line being evicted from the micro-operation cache.

### Claim 15

A system, comprising:
a memory; and
a processor coupled to the memory;
wherein the processor is configured to:
store, in a first cache line, a first group of received micro-operations together with a second group of micro-operations that were previously stored in the first cache line of a micro-operation cache responsive to detecting a first condition; and
store the first group of micro-operations in a second cache line of the micro-operation cache responsive to not detecting the first condition, wherein no other groups of micro-operations are stored in the second cache line.

### Claim 16 (depends on 15)

The system as recited in claim 15, wherein the processor is further configured to:
select a victim way from a set of the micro-operation cache targeted by the first group of micro-operations responsive to receiving the first group of micro-operations;
evict all resident micro-operations from the victim way responsive to determining that the victim way is not compacted; and
evict a subset of a plurality of groups of micro-operations from the victim way responsive to determining that the victim way is compacted and responsive to determining the first group of micro-operations can fit in available space of the victim way after the subset is evicted.

### Claim 17 (depends on 16)

The system as recited in claim 16, wherein the processor is configured to select, as the subset to be evicted from the victim way, a minimum sized group in the victim way that can fit the first group of micro-operations.

### Claim 18 (depends on 15)

The system as recited in claim 15, wherein storing the first group of micro-operations together with the second group of micro-operations in the first cache line comprises:
merging, within the first cache line, the first group of micro-operations and the second group of micro-operations and immediate and/or displacement fields of the first group and the second group responsive to detecting the first condition;
storing a first offset indicating a starting location in the first cache line of micro-operations of the first group of micro-operations;
storing a second offset indicating a starting location in the first cache line of immediate fields of the second group of micro-operations; and
storing a third offset indicating a starting location in the first cache line of immediate fields of the first group of micro-operations.

### Claim 19 (depends on 15)

The system as recited in claim 15, wherein the processor is further configured to:
maintain metadata which indicates a number of groups of micro-operations in each cache line of the micro-operation cache;
store a first indication in first metadata that the first cache line stores a plurality of micro-operation groups compacted together responsive to detecting the first condition; and
store a second indication in second metadata that the second cache line stores a single micro-operation group responsive to not detecting the first condition.

### Claim 20 (depends on 15)

The system as recited in claim 15, wherein:
the first condition is determining that the first group is able to fit into a single way of the micro-operation cache; and
responsive to detecting the first condition, the processor is further configured to store immediate and/or displacement fields in the first cache line after micro-operations from the first group and the at least one other group.
