# US 12,222,860 B2 · Processor and method designating an in-core cache of a hierarchical cache system to perform writing-back and invalidation of cached data

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

- Number: US 12,222,860 B2
- Document ID: US12222860B2
- Status: Granted
- Kind: B2
- Application number: 18/308,893
- Filed: 2023-04-28
- Published: 2023-12-14
- Granted: 2025-02-11
- Earliest claimed: 2022-06-08
- Assignees: Shanghai Zhaoxin Semiconductor Co., Ltd.
- Applicants: Shanghai Zhaoxin Semiconductor Co., Ltd.
- Inventors: Weilin Wang; Yingbing Guan; Yue Qin
- Web page: https://patentgrep.com/patent/US12222860B2

## CPC

- G06F 12/0808: with cache invalidating means (G06F12/0815 takes precedence)
- G06F 12/0811: with multilevel cache hierarchies
- G06F 12/0831: using a bus scheme, e.g. with bus monitoring or watching means
- G06F 12/0875: with dedicated cache, e.g. instruction or stack
- G06F 12/0891: using clearing, invalidating or resetting means
- G06F 12/0897: with two or more cache hierarchy levels (with multilevel cache hierarchies G06F12/0811)
- 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

A processor and a method for designating an in-core cache of a hierarchical cache system to perform writing-back and invalidation of cached data are shown. In response to an instruction that is in the instruction set architecture and is executed to designate a designated-level cache within the current core as a target to perform writing-back and invalidation, a decoder of the current core outputs microinstructions. According to the microinstructions, a level-designation request indicating the designated-level cache within the current core is transferred to the hierarchical cache system through the memory order buffer. In response to the level-designation request, the hierarchical cache system recognizes cache lines related to the designated-level cache of the current core, writes modified cache lines (which are obtained from the recognized cache lines) back to the system memory, and then invalidates all the recognized cache lines from the hierarchical cache system.

## Claims

### Claim 1

A processor, designating an in-core cache of a hierarchical cache system to perform writing-back and invalidation of cached data, comprising:
a first core, including a decoder, a memory order buffer, and a first-level cache; and
a last-level cache, coupled to the first core;
wherein:
the hierarchical cache system includes the first-level cache of the first core, the last-level cache, and in-core caches of the other cores of the processor, and the last-level cache is shared by the different cores of the processor;
the decoder decodes an instruction into microinstructions, wherein the instruction is in an instruction set architecture and is executed to designate a designated-level cache within a current core as a target to perform writing-back and invalidation;
according to the microinstructions, a level-designation request indicating the designated-level cache within the first core is transferred to the hierarchical cache system through the memory order buffer; and
in response to the level-designation request, the hierarchical cache system recognizes cache lines related to the designated-level cache of the first core, writes modified cache lines, which are obtained from the recognized cache lines, back to a system memory, and then invalidates all the recognized cache lines from the hierarchical cache system.

### Claim 2 (depends on 1)

The processor as claimed in claim 1, wherein:
the instruction designates the first-level cache of the first core as the designated-level cache.

### Claim 3 (depends on 2)

The processor as claimed in claim 2, wherein:
in response to the level-designation request that is transferred to the hierarchical cache system through the memory order buffer, the first-level cache of the first core is driven to return memory addresses of cache lines cached in the first-level cache of the first core to the memory order buffer.

### Claim 4 (depends on 3)

The processor as claimed in claim 3, further comprising:
a storage area outside the first core, recording a snoop table to show cache statuses in the different cores for each memory address,
wherein cache-status options include modified status, exclusive status, shared status, and invalid status.

### Claim 5 (depends on 4)

The processor as claimed in claim 4, wherein:
in response to each memory address returned from the first-level cache of the first core, the memory order buffer issues a writing-back and invalidation request carrying the memory address to consult the snoop table;
based on a result of consulting the snoop table, snoop requests carrying the memory addresses are transferred to the hierarchical cache system;
in response to the snoop requests, the hierarchical cache system loads modified cache lines, which are in the modified status among snooped cache lines, onto a bus, and then invalidates all of the snooped cache lines from the hierarchical cache system, wherein the bus is configured for communication between the system memory and the processor; and
the modified cache lines loaded onto the bus are further programmed from the bus into the system memory.

### Claim 6 (depends on 2)

The processor as claimed in claim 2, further comprising:
a storage area within the first core, which is a part of the hierarchical cache system and records an in-core cache table,
wherein:
the in-core cache table shows cache statuses in the first-level cache of the first core for the different memory addresses; and
cache-status options include modified status, exclusive status, shared status, and invalid status.

### Claim 7 (depends on 6)

The processor as claimed in claim 6, wherein:
in response to the level-designation request, the hierarchical cache system consults the in-core cache table to recognize modified cache lines, which are in the modified status, from the first-level cache of the first core, and loads the modified cache lines onto a bus;
the bus is configured for communication between the system memory and the processor;
the hierarchical cache system further consults the in-core cache table to recognize and invalidate all cache lines related to the first-level cache of the first core; and
the modified cache lines loaded onto the bus are further programmed from the bus into the system memory.

### Claim 8 (depends on 1)

The processor as claimed in claim 1, wherein:
the first core further comprises a second-level cache, which is a part of the hierarchical cache system;
the instruction designates the first-level cache as well as the second-level cache of the first core as the designated-level cache.

### Claim 9 (depends on 1)

The processor as claimed in claim 1, further comprising:
a microcode storage device, storing microcode for the decoder to decode the instruction into the microinstructions.

### Claim 10 (depends on 1)

The processor as claimed in claim 1, wherein:
the instruction designates the entire in-core cache structure of the current core as the designated-level cache.

### Claim 11 (depends on 10)

The processor as claimed in claim 10, further comprising:
a storage area outside the first core, recording a snoop table to show cache statuses in the different cores for each memory address, wherein each memory address represents one cache line,
wherein cache-status options include modified status, exclusive status, shared status, and invalid status.

### Claim 12 (depends on 11)

The processor as claimed in claim 11, wherein:
the level-designation request is transferred to the last-level cache through the memory order buffer;
in response to the first core that provides the level-designation request, the last-level cache determines that the designated-level cache includes the entire in-core cache structure of the first core, consults the snoop table to recognize modified cache lines which correspond to memory addresses in the modified status in the first core, and loads the modified cache lines onto a bus, wherein the bus is configured for communication between the system memory and the processor;
the last-level cache issues snoop requests to regard the entire in-core cache structure of the first core as the target, and performs invalidation; and
the modified cache lines loaded onto the bus are further programmed from the bus into the system memory.

### Claim 13

A method for performing writing-back and invalidation of cached data by designating an in-core cache of a hierarchical cache system, comprising:
operating a first core of a processor to execute an instruction, wherein the instruction is in an instruction set architecture and is executed to designate a designated-level cache within a current core as a target to perform writing-back and invalidation, and the hierarchical cache system includes a first-level cache of the first core, a last-level cache coupled to the first core, and in-core caches of the other cores which share the last-level cache with the first core;
according to microinstructions decoded from the instruction, transferring a level-designation request to the hierarchical cache system through a memory order buffer of the first core, wherein the level-designation request indicates the designated-level cache of the first core; and
in response to the level-designation request, operating the hierarchical cache system to recognize cache lines related to the designated-level cache of the first core, write modified cache lines, which are obtained from the recognized cache lines, back to a system memory, and then invalidate all the recognized cache lines from the hierarchical cache system.

### Claim 14 (depends on 13)

The method as claimed in claim 13, wherein:
the instruction designates the first-level cache of the first core as the designated-level cache.

### Claim 15 (depends on 14)

The method as claimed in claim 14, wherein:
in response to the level-designation request that is transferred to the hierarchical cache system through the memory order buffer, the first-level cache of the first core is driven to return memory addresses of cache lines cached in the first-level cache of the first core to the memory order buffer.

### Claim 16 (depends on 15)

The method as claimed in claim 15, further comprising:
recording a snoop table in a storage area outside the first core, to show cache statuses in the different cores for each memory address,
wherein cache-status options include modified status, exclusive status, shared status, and invalid status.

### Claim 17 (depends on 16)

The method as claimed in claim 16, wherein:
in response to each memory address returned from the first-level cache of the first core, the memory order buffer issues a writing-back and invalidation request carrying the memory address to consult the snoop table;
based on a result of consulting the snoop table, snoop requests carrying the memory addresses are transferred to the hierarchical cache system;
in response to the snoop requests, the hierarchical cache system loads modified cache lines, which are in the modified status among snooped cache lines, onto a bus, and then invalidates all of the snooped cache lines from the hierarchical cache system, wherein the bus is configured for communication between the system memory and the processor; and
the modified cache lines loaded onto the bus are further programmed from the bus into the system memory.

### Claim 18 (depends on 14)

The method as claimed in claim 14, further comprising:
recording an in-core cache table in a storage area within the first core which is a part of the hierarchical cache system,
wherein:
the in-core cache table shows cache statuses in the first-level cache of the first core for the different memory addresses; and
cache-status options include modified status, exclusive status, shared status, and invalid status.

### Claim 19 (depends on 18)

The method as claimed in claim 18, wherein:
in response to the level-designation request, the hierarchical cache system consults the in-core cache table to recognize modified cache lines, which are in the modified status, from the first-level cache of the first core, and loads the modified cache lines onto a bus, wherein the bus is configured for communication between the system memory and the processor;
the hierarchical cache system further consults the in-core cache table to recognize and invalidate all cache lines related to the first-level cache of the first core; and
the modified cache lines loaded onto the bus are further programmed from the bus into the system memory.

### Claim 20 (depends on 13)

The method as claimed in claim 13, wherein:
the first core further comprises a second-level cache, which is a part of the hierarchical cache system;
the instruction designates the first-level cache as well as the second-level cache of the first core as the designated-level cache.

### Claim 21 (depends on 13)

The method as claimed in claim 13, further comprising:
operating a decoder of the first core to decode the instruction into microinstructions based on microcode stored in a microcode storage device.

### Claim 22 (depends on 13)

The method as claimed in claim 13, further comprising:
the instruction designates the entire in-core cache structure of the current core as the designated-level cache.

### Claim 23 (depends on 22)

The method as claimed in claim 22, further comprising:
recording a snoop table in a storage area outside the first core, to show cache statuses in the different cores for each memory address, wherein each memory address represents one cache line,
wherein cache-status options include modified status, exclusive status, shared status, and invalid status.

### Claim 24 (depends on 23)

The method as claimed in claim 23, wherein:
the level-designation request is transferred to the last-level cache through the memory order buffer;
in response to the first core that provides the level-designation request, the last-level cache determines that the designated-level cache includes the entire in-core cache structure of the first core, consults the snoop table to recognize modified cache lines which correspond to memory addresses in the modified status in the first core, and loads the modified cache lines onto a bus, wherein the bus is configured for communication between the system memory and the processor;
the last-level cache issues snoop requests to regard the entire in-core cache structure of the first core as the target, and performs invalidation; and
the modified cache lines loaded onto the bus are further programmed from the bus into the system memory.
