# US 2017/0255571 A1 · Atomic instruction having a local scope limited to an intermediate cache level

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

- Number: US 2017/0255571 A1
- Document ID: US20170255571A1
- Status: Published application
- Kind: A1
- Application number: 15/452,073
- Filed: 2017-03-07
- Published: 2017-09-07
- Earliest claimed: 2016-03-07
- Assignees: Kalray
- Applicants: Kalray
- Inventors: Benoit DUPONT DE DINECHIN; Marta RYBCZYNSKA; Vincent RAY
- Web page: https://patentgrep.com/patent/US20170255571A1

## CPC

- G06F 12/1475: {in a virtual system, e.g. with translation means}
- G06F 9/3004: {to perform operations on memory}
- G06F 9/52: Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F 12/0804: with main memory updating (G06F12/0806 takes precedence)
- G06F 12/0811: with multilevel cache hierarchies
- G06F 12/0815: Cache consistency protocols
- G06F 12/0862: with prefetch
- G06F 2212/1052: Security improvement
- G06F 2212/283: Plural cache memories
- G06F 2212/602: Details relating to cache prefetching
- G06F 2212/621: Coherency control relating to peripheral accessing, e.g. from DMA or I/O device
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The invention relates to a method for updating a variable shared between multiple processor cores. The following steps are implemented during execution in one of the cores of a local scope atomic read-modify-write instruction (AFA), having a memory address (a1) of the shared variable as a parameter: performing operations of the atomic instruction in a cache line (L(a1)) allocated to the memory address; and locally locking the cache line (LCK) while authorizing access to the shared variable by cores connected to another cache memory of same level during execution of the local scope atomic instruction.

## Claims

### Claim 1

A multi-core processor comprising:
a cache memory shared by a group of several cores configured to delegate atomic instructions to the cache memory;
in its instruction set, an atomic read-modify-write instruction, taking as a parameter a memory address of a shared variable, wherein the atomic instruction can have a global scope;
a cache memory controller configured for receiving and processing each global atomic instruction executed by a given core of the group by globally locking an address space containing the address of the shared variable, to prevent access to the shared variable by any other core during execution of the global atomic instruction;
wherein the atomic instruction can also have a local scope, the cache memory controller being configured for processing each local atomic instruction executed by a given core of the group by locally locking a cache line allocated to the address of the shared variable, while authorizing access to the shared variable to cores connected to another cache memory of same level during execution of the local atomic instruction.

### Claim 2 (depends on 1)

The processor of claim 1, wherein the cache memory controller is configured for using a cache coherence protocol for implementing the global atomic instructions, and for, during execution of a local atomic instruction, locally locking the cache line without invalidating nor locking an analogous cache line in the other cache memory of same-level.

### Claim 3 (depends on 1)

The processor of claim 1, wherein the cache controller is configured for locking a system memory area containing the shared variable during execution of a global atomic instruction, and for, during execution of a local atomic instruction, accessing the variable in the cache line without locking any area of the system memory.

### Claim 4 (depends on 1)

The processor of claim 1, wherein the global and local scopes of the atomic instructions are implemented by two respective dedicated instructions of the processor instruction set.

### Claim 5 (depends on 1)

The processor of claim 1, wherein the global and local scopes of the atomic instructions are implemented by a same instruction of the processor instruction set, and are differentiated by using two distinct virtual address spaces assigned to a same physical address space containing the shared variable, the processor including a memory management unit for performing virtual to physical address translations, and which assigns an “uncached” attribute to the virtual address space associated to the global scope.

### Claim 6 (depends on 1)

The processor of claim 1, wherein the local atomic instruction is a fetch-and-add instruction, having as an additional parameter an increment value, and the cache controller is configured to add the increment to the variable.

### Claim 7

A method for updating a variable shared between multiple processor cores, comprising the following steps implemented during execution in one of the cores of a local scope atomic read-modify-write instruction, having a memory address of the shared variable as a parameter:
performing operations of the atomic instruction in a cache line allocated to the memory address; and
locally locking the cache line while authorizing access to the shared variable by cores connected to another cache memory of same level during execution of the local scope atomic instruction.

### Claim 8 (depends on 7)

The method of claim 7, comprising the step of:
locking the cache line without invalidating nor locking an analogous cache line in other cache memories of same level.

### Claim 9 (depends on 7)

The method of claim 7, comprising the steps of:
defining the local scope of the atomic instruction through the execution of a dedicated instruction of the processor instruction set; and
including a dedicated atomic instruction of global scope in the processor instruction set.

### Claim 10 (depends on 7)

The method of claim 7, comprising the steps of:
translating a physical address space containing the shared variable from first and second distinct virtual address spaces through a memory management unit;
assigning an “uncached” attribute to the second virtual address space;
executing a generic atomic instruction with the first virtual address space for obtaining a local scope; and
executing the same generic atomic instruction with the second virtual address space for obtaining a global scope.
