# US 2017/0293486 A1 · Processors supporting atomic writes to multiword memory locations & methods

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

- Number: US 2017/0293486 A1
- Document ID: US20170293486A1
- Status: Published application
- Kind: A1
- Application number: 15/092,915
- Filed: 2016-04-07
- Published: 2017-10-12
- Earliest claimed: 2016-04-07
- Assignees: Imagination Technologies Limited
- Applicants: Imagination Technologies Limited
- Inventors: Ranjit J. Rozario; Andrew F. Glew; Sanjay Patel; James Robinson; Sudhakar Ranganathan
- Web page: https://patentgrep.com/patent/US20170293486A1

## CPC

- G06F 9/30043: {LOAD or STORE instructions; Clear instruction}
- G06F 9/3001: {Arithmetic instructions}
- G06F 9/3004: {to perform operations on memory}
- G06F 9/30087: {Synchronisation or serialisation instructions}
- G06F 9/3834: {Maintaining memory consistency}
- G06F 12/0875: with dedicated cache, e.g. instruction or stack
- G06F 12/0897: with two or more cache hierarchy levels (with multilevel cache hierarchies G06F12/0811)
- G06F 12/0811: with multilevel cache hierarchies
- G06F 12/0817: using directory methods
- G06F 2212/452: Instruction code
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system and method process atomic instructions. A processor system includes a load store unit (LSU), first and second registers, a memory interface, and a main memory. In response to a load link (LL) instruction, the LSU loads first data from memory into the first register and sets an LL bit (LLBIT) to indicate a sequence of atomic instructions is being executed. The LSU further loads second data from memory into the second register in response to a load (LD) instruction. The LSU places a value of the second register into the memory interface in response to a store conditional coupled (SCX) instruction. When the LLBIT is set and in response to a store (SC) instruction, the LSU places a value of the second register into the memory interface and commits the first and second register values in the memory interface into the main memory when the LLBIT is set.

## Claims

### Claim 1

A processor system comprising:
a load store unit (LSU) configured to execute load and store instructions;
a first register;
a second register;
a memory interface;
wherein the LSU is configured to, in response to processing an instruction, set a link load bit (LLBIT) to indicate atomic operations are to be executed;
wherein the LSU is configured to place a value of the second register into the memory interface in response to a store conditional coupled (SCX) instruction, and wherein the LSU is configured to place a value of the first register into the memory interface in response to a store (SC) instruction; and
a main memory, and wherein the LSU will only commit the first and second register values in the memory interface into the main memory when the LLBIT is set when the SC instruction is executed.

### Claim 2 (depends on 1)

The processor system of claim 1 wherein the LSU is configured to load first data from the main memory through the memory interface into the first register in response to a load link (LL) instruction and to set the LLBIT in response to the LL instruction, wherein the LSU is further configured to load second data from the main memory through the memory interface into the second register in response to a load (LD) instruction, and where the value of the second register is a modified and a different value than the second data before the value of the second register is placed into the memory interface in response to the SCX instruction.

### Claim 3 (depends on 2)

The processor system of claim 2 further comprising:
an arithmetic logical unit (ALU) configured to execute an ALU instruction operating on the value of the second register to create the modified and different value than the second data.

### Claim 4 (depends on 1)

The processor system of claim 1 wherein the LSU will not commit the first and second register values in the memory interface into the main memory when the LLBIT is not set, and wherein the processor system is configured to replay the atomic operations when the LLBIT is not set.

### Claim 5 (depends on 1)

The processor system of claim 1 further comprising:
a level two (L2) cache shared between two or more processors.

### Claim 6 (depends on 1)

The processor system of claim 1 wherein the processor system is a first processor and wherein memory interface further comprises:
a cache line of a level one (L1) cache, and further comprising:
an L2 cache; and
a second processor configured to share the L2 cache with the first processor.

### Claim 7 (depends on 6)

The processor system of claim 6 wherein the first processor does not share the L1 cache with the second processor.

### Claim 8 (depends on 7)

The processor system of claim 7 wherein the first processor is configured to write the cache line of the L1 cache back to the L2 cache when executing the SC instruction when the LLBIT is set.

### Claim 9 (depends on 1)

The processor system of claim 1 wherein the SC instruction is executed immediately after the SCX instruction.

### Claim 10 (depends on 1)

The processor system of claim 1 wherein the LSU is configured to clear the LLBIT if no SC instruction immediately follows the SCX instruction.

### Claim 11 (depends on 1)

The processor system of claim 1 wherein the first register and the second register are both 32-bit registers.

### Claim 12

A method of executing atomic instructions in a multithreaded system comprising:
executing a load link (LL) instruction to load a first data value from a memory block and set a corresponding LLBIT to indicate that the read from this memory location is part of a sequence of atomic instructions;
executing a load word (LW) instruction to load a second data value from another location in the memory block;
executing an store conditional coupled (SCX) instruction to write the second data value back to a memory interface but not committing data in the memory interface to the memory block; and
only if the LLBIT is still set executing a store conditional (SC) instruction to write the first data value to the memory interface and if the LLBIT is still set committing the second data value and the second data value in the memory interface to the memory block.

### Claim 13 (depends on 12)

The method of claim 12 further comprising:
if the LLBIT is not set when the SC instruction is executed, then the first data value and the second data value in the memory interface are not commit to memory and the method re-executes the atomic instructions again beginning at the LL instruction.

### Claim 14 (depends on 12)

The method of claim 12 further comprising:
changing value of the first data value before the first data value is written to the memory interface.

### Claim 15 (depends on 12)

The method of claim 12 further comprising:
executing the SCX and the SC instructions back-to-back.

### Claim 16 (depends on 12)

The method of claim 12 further comprising:
resetting the LLBIT when an instruction immediately following the SCX instruction is not the SC instruction.

### Claim 17

A processor system, comprising:
a set of registers, each having a bit length;
a memory hierarchy, comprising one or more elements of memory that is shared among a plurality of concurrently executing threads;
a load store unit (LSU) configured to execute a load instruction that loads an amount of data from a specified address in the memory hierarchy equal to the bit length of the registers, into a specified register, and causes a lock status bit to be set that indicates a memory block including the specified address is being access by an atomic instruction;
a coherency management (CM) unit capable of monitoring addresses for load instructions to be executed by a plurality of threads, wherein the CM unit is configured to clear the lock status bit in response to detecting a conflicting access directed to an address within the memory block; and
wherein the LSU is further configured to execute a store conditional coupled (SCX) instruction to store data from the specified register to a memory interface, and wherein the LSU is configured to execute, only when the lock status bit is set, a dependent store conditional (SC) instruction that stores data to a first address within the memory block, and wherein the LSU stores the data form the specified register in the memory interface to second memory location in the memory block, and wherein the LSU is configured to cause the SC instruction to fail if the lock status bit is cleared.

### Claim 18 (depends on 17)

The processor system of claim 17 wherein the SCX instruction is directed to a 32-bit SCX memory segment of the memory block and the SC instruction is directed to a 32-bit segment of the memory block adjacent to the SCX memory segment.

### Claim 19 (depends on 17)

The processor system of claim 17 wherein the conflicting access is at least one of a read transaction, a read with intent to modify transaction, and a write transaction.

### Claim 20 (depends on 17)

The processor system of claim 17 wherein the memory interface is associated with a cache line.
