Contest tracking for processor cache management

By detecting and managing memory contention in the processor, the performance bottleneck and cache coherence overhead caused by data contention in computer systems are resolved, resulting in faster memory operation processing and higher computer system performance.

CN116521581BActive Publication Date: 2026-11-27NVIDIA CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211021189.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-01-20
Filing Date
2022-08-24
Publication Date
2026-11-27
Estimated Expiration
2042-08-24

AI Technical Summary

Technical Problem

In computer systems, performance bottlenecks and increased cache coherence overhead caused by multiple threads contending for data in memory are difficult to manage effectively with existing technologies.

Method used

By detecting data contention in memory within the processor, contention tracing techniques are used to manage cache and memory operations, control the storage location of data in shared and private caches, and handle out-of-order memory operations based on contention.

Benefits of technology

It reduces the number of copies in the private cache, lowers cache coherency overhead, improves the processor's memory operation speed, reduces lock acquisition time, and enhances the overall performance of the computer system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116521581B_ABST
    Figure CN116521581B_ABST
Patent Text Reader

Abstract

The present disclosure relates to contention tracking for processor cache management. The technology disclosed herein relates to tracking contention and using tracked contention to manage processor caches. The technology is implemented in cache control logic of a processor and enables the processor to track which locations in a main memory are contentious. The technology can use the contentiousness of a location to determine where to store data in a cache and how to allocate and evict cache lines in the cache. In one example, the technology can store data in a shared cache when a location is contentious, while it can bypass the shared cache and store data in a private cache when a location is not contentious. This can be advantageous because storing data in a shared cache can reduce or avoid having multiple copies in different private caches, and can reduce the cache coherency overhead involved in keeping copies in private caches synchronized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of this disclosure generally relate to processor caches, and more specifically, to tracking contention and managing cache and memory operations based on contention. Background Technology

[0002] Data stored in memory is typically accessed by different threads executing on one or more processors. Processors usually store local copies of the data in caches to speed up access. Threads typically cooperate and take turns modifying the data to avoid overwriting each other's modifications. Attached Figure Description

[0003] This disclosure will be more fully understood from the detailed description given below and from the accompanying drawings of various embodiments thereof. However, the drawings should not be construed as limiting the invention to the specific embodiments, but are for explanation and understanding only.

[0004] Figure 1 An example computing device including a processor and memory is shown according to some embodiments of the present disclosure.

[0005] Figure 2 This is a schematic diagram of a processor and a multi-level cache according to some embodiments of the present disclosure.

[0006] Figure 3 This is a detailed block diagram illustrating an example component and module for contention-based cache management according to some embodiments of the present disclosure.

[0007] Figure 4 This is a detailed block diagram illustrating an example component and module for contention-based memory management operations according to some embodiments of the present disclosure.

[0008] Figure 5 This is a flowchart of a method for managing a cache using contention tracking, according to some embodiments of the present disclosure.

[0009] Figure 6 This is a flowchart of a method for managing memory operations using contention tracking, according to some embodiments of the present disclosure.

[0010] Figure 7 This is a block diagram of an example computer system in which embodiments of the present disclosure may operate. Detailed Implementation

[0011] This disclosure relates to computer systems capable of tracking contention and using the tracked contention to manage processor caches, out-of-order processing of memory operations, or combinations thereof. Contention can occur when multiple threads contend for access to data in memory. The data can be referred to as contentious data and can include the contents of variables read and written by threads. Computer systems typically manage contention by enabling one of the threads to access the data, causing the remaining threads to wait until the thread completes. A thread can perform one or more operations on the contentious data before completing. The remaining threads wait for one or more operations to complete and wait for the data to become accessible. In one example, a lock can be used to manage contention and can be referred to as lock contention. The initial thread can acquire the lock on the data, and waiting threads can attempt to acquire the lock and access the data. Waiting for the data to become accessible can degrade the performance of the computer system and can lead to contentious data causing performance bottlenecks.

[0012] Processor caches are designed to improve computer system performance by storing copies of data closer to the processor cores for faster data access. A processor may include a set of cores, and a processor cache may include a shared cache shared by the set of cores and private caches, each private to one of the multiple cores. A processor cache can store multiple copies of data in the cache and can use cache coherence techniques to keep these copies synchronized. Cache coherence techniques can detect changes to one of the copies and update one or more copies to indicate that the copy is stale, a replacement copy, or a combination thereof. When data is accessed by threads on different cores, the processor cache typically stores copies of the data in the private cache of each of those cores. Having multiple copies of data being modified typically increases the overhead of cache coherence techniques and can adversely affect the performance of the computer system.

[0013] The aspects of this disclosure address the aforementioned and other shortcomings by providing techniques that enable a processor to detect data contention in memory and use contention to manage caches, manage memory operations, or a combination thereof. These techniques may involve enabling the processor to identify locations in memory and determine whether those locations are contentious. Locations in memory may correspond to one or more physical, virtual, or logical addresses in memory. A location can be determined to be contentious if any thread is unable to access it because another thread is using that location. For example, a first thread may have acquired a lock on data at that location (e.g., a ticket lock), and a second thread may be prevented from accessing the data while it is locked. Once a location is determined to be contentious, it may remain contentious even after it is unlocked, as it is more likely to become the subject of thread contention again in the future. Contention can be tracked by updating one or more data structures to indicate whether a location is contentious, uncontentious, or a combination thereof (e.g., a contention table in a cache entry, a contention bit flag).

[0014] Processors can use location contention to manage caches. This technique controls whether data is stored in the cache (e.g., a shared cache) and how entries in the cache (e.g., cache lines, cache blocks) are allocated and evicted. As described above, a cache can include copies of data from main memory, and copies of data can be stored in one or more private caches, shared caches, or combinations thereof. The processor can determine whether a location is disputed before, during, or after receiving data located at that location in main memory. The processor can store data in a shared cache when there is a location dispute, and can bypass the shared cache (e.g., avoid storing in a shared cache) and store data in a private cache when there is no location dispute. This can be advantageous because storing data in a shared cache can reduce or avoid having multiple copies in different private caches (e.g., avoid duplicate copies in the L2 cache). This can significantly reduce the cache coherence overhead involved in keeping copies in private caches synchronized when data is disputed. In one example, this technique can be implemented in the processor's cache control logic (e.g., cache controller circuitry and / or control registers).

[0015] The processor can also, or alternatively, use location contention to manage the processing of memory operations. Threads executing the processor can generate memory operations, which can be added to a queue (e.g., an ordered set) to be processed. As described above, a thread accessing data at a certain location can perform multiple operations on the data before the thread finishes using the data. Multiple operations can be added to a queue, and the queue can include one or more intervening operations. The operations in the queue can have a specific order, such as First-In-First-Out (FIFO). The processor can process some operations according to the order of the queue, or it can process some operations out of order.

[0016] Each operation can be associated with data from a location in memory (e.g., a physical address in main memory), and the processor can select the next operation to process based on contention for that location. For example, a processor can execute one of multiple memory operations for a thread, and if there is contention for the location associated with a memory operation, one or more of the remaining memory operations can be processed first, so that the remaining memory operations can be executed out of order before one or more intervention operations. In one example, the multiple memory operations can be exclusive memory operations, and the first memory operation can be a load exclusive that loads (e.g., reads) data from a location and can determine whether that location is locked, and the second memory operation can be a storage exclusive that acquires the lock on that location if it is not locked.

[0017] The advantages of the techniques disclosed herein include, but are not limited to, enhancing the processor's use of cache to reduce the number and duration of performance bottlenecks caused by memory contention. This can be achieved by reducing the number of copies in the private cache, thereby reducing cache coherence overhead. The techniques can also enable the processor to process memory operations (e.g., memory exclusivity) faster by reducing the duration of memory location inaccessibility (e.g., reducing the time required to acquire a lock). Furthermore, the techniques can be used to process atomic operations faster by detecting when an atomic operation is associated with an uncontested location and using near-atomic operations instead of far-atomic operations on local data.

[0018] Figure 1 An example computing device 100 according to some embodiments of the present disclosure is shown, which includes a processor having techniques for tracking contention and using contention tracking to manage cache and process memory operations. The computing device 100 may include a processor 110, a cache 120, and a memory 130.

[0019] The computing device 100 can be any physical device and can be or include server computing devices (e.g., servers), distributed computing devices (e.g., cloud devices, cluster devices), supercomputers, personal computers (PCs) (e.g., workstations, desktops, laptops, notebooks), mobile devices (e.g., mobile phones, tablets), vehicles (e.g., airplanes, drones, trains, cars or other vehicles), Internet of Things (IoT) devices, embedded computers (e.g., computers included in industrial equipment or connected business equipment), or any such computing device including one or more processors 110.

[0020] Processor 110 can refer to a processing device that includes one or more processing devices or processing units capable of executing instructions encoded for arithmetic, logic, memory, or I / O operations. Processor 110 can be implemented as a single integrated circuit, two or more integrated circuits, or can be a component of a multi-chip module (e.g., where a single microprocessor die is included in a single integrated circuit package). Processor 110 can be or include one or more central processing units (CPUs), graphics processing units (GPUs), data processing units (DPUs), arithmetic logic units (ALUs), floating-point units (FPUs), memory management units (MMUs), memory protection units (MPUs), application-specific integrated circuits (ASICs), tensor processing units (TPUs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs), network interface controllers (NICs), cache controllers, memory controllers, quantum processors, other processors, or combinations thereof.

[0021] Processor 110 can implement an instruction set architecture (ISA), which serves as the interface between processor 110 and computing device 100. The instruction set architecture can be compatible with advanced RISC machines. x86 (e.g., ), Scalable processor architecture Other computer architectures or combinations thereof are the same or similar. Processor 110 may use a single processing core or multiple processing cores 111A-Z to process instructions in the set.

[0022] Processing cores 111A-Z can be portions of processor 110 capable of reading and executing instructions of a computer program loaded from memory 130. The computer program may include instructions (e.g., executable data), information (e.g., non-executable data), or combinations thereof. Processor 110 may dispatch instructions into one or more pipelines, thereby utilizing instruction-level parallelism. Pipelines may attempt to keep multiple portions of the processor busy with some instructions by dividing the instructions into a series of sequential steps executed by different processor units, where different portions of the instructions are processed in parallel. Instructions may be arranged into different instruction streams, which will be discussed below with respect to threads 113A-Z. In one example, each of processing cores 111A-Z may be a processing device and may include portions of the processor involved in executing instructions and portions of cache 120 (e.g., a private cache including cache 120).

[0023] Cache 120 may be a hardware cache used by processor 110 to store data received from memory 130 (e.g., main memory). Cache 120 is part of a memory hierarchy, and the memory hierarchy may be part of tiered storage of computing device 100. The memory hierarchy can extend from the lowest level of processor registers to the highest level of main memory. Tiered storage can further extend to secondary storage (e.g., hard disk drives, solid-state drives) and may extend to remote storage (e.g., distributed storage, network-attached storage (NAS), storage area network (SAN)).

[0024] Cache 120 may include multiple different caches. These different caches may be physically separate caches (e.g., different parts of a chip or on different chips), different parts of the same cache (e.g., different parts of the same set of memory cells), or combinations thereof. The different caches may use any form of data storage technology to store data and may include volatile memory (e.g., transient or non-persistent memory), non-volatile memory (e.g., persistent memory), or combinations thereof. Data storage may include static random access memory (SRAM), embedded dynamic random access memory (eDRAM), other forms of memory, or combinations thereof, of random access memory (RAM). Figure 1 As shown, cache 120 may include a shared cache 122 and one or more private caches 124A-Z.

[0025] Processor 110 may use shared cache 122 and private caches 124A-Z to store data in memory 130 for access by one or more processing cores 111A-Z. Shared cache 122 may be shared by a group of multiple processing cores and may be the same as or similar to system-level cache (SLC), last-level cache (LLC), or level 3 cache, other terms, or combinations thereof. Each of the private caches 124A-Z may be private to its respective processing core. Private caches may be the same as or similar to local caches, level 1 (L1) caches, level 2 (L2) caches, other caches, or combinations thereof.

[0026] exist Figure 1 In the example shown, the shared cache 122 can be used by all processing cores of the processor 110 (e.g., processing cores 111A-Z) and can be located further away from the processing cores and provide slower access compared to the corresponding private caches. Each of the private caches 124A-Z can be dedicated to a single processing core and can be located closer to the processing core to provide faster access to the processing core.

[0027] Each of threads 113A-Z is an execution thread, which can be a minimal sequence of programming instructions that can be independently managed by the scheduler of the operating system (OS), the processor, or other parts of computing device 100 (e.g., OS threads, computing threads). In the illustrated example, each of threads 113A-Z can be executed by a different one of the processing cores 111A-Z. In other examples, one or more threads 113A-Z can execute concurrently on the same processing core (e.g., thread-level parallelism). Threads 113A-Z can correspond to the same computing process (e.g., main thread and worker threads), different computing processes, or a combination thereof. Each of threads 113A-Z, when executed by a processing core, can cause a corresponding memory operation in memory operations 115A-Z.

[0028] Memory operations 115A-Z can be any operation performed by a processing device accessing stored data. Access can involve one or more read accesses (e.g., loading data), write accesses (e.g., storing data), or combinations thereof. Stored data can be accessed from memory 130, shared cache 122, private caches 124A-Z, processor registers, other data stores, or combinations thereof. Memory operations 115A-Z can include one or more hardware instructions (e.g., processor instructions, CPU instructions), software instructions (e.g., function calls, machine code, bytecode), firmware instructions (e.g., opcodes, microcode), other operations, or combinations thereof. In one example, memory operations 115A-Z can be an external operation that is provided from a source outside processor 110 (e.g., kernel code, application code) and invokes processor instructions (e.g., CPU instructions). In another example, memory operations 115A-Z can be an internal operation provided from a source inside processor 110 (e.g., cache controller logic). In either example, each of memory operations 115A-Z can be an exclusive operation, an atomic operation, other operations, or combinations thereof.

[0029] Exclusive memory operations may involve the use of exclusion mechanisms that grant access to data to a specific thread's memory operation but not to one or more other threads' memory operations (e.g., non-existent, free, or lacking access). Exclusion mechanisms can be the same as or similar to concurrency control or synchronization mechanisms and may involve one or more exclusion data structures. Exclusion data structures (e.g., synchronization primitives) can be the same as or similar to locks, semaphores, mutexes, fast user-space mutexes (futexes), barriers, other exclusion data structures, or combinations thereof. In one example, an operation may involve one or more locks, and a memory operation may activate the exclusion mechanism (e.g., acquire the lock) and a subsequent memory operation may deactivate the exclusion mechanism (e.g., release the lock). In another example, an operation may involve one or more critical sections, which consist of a piece of executable code that only one thread can execute and that cannot be interrupted under certain conditions (e.g., kernel code). Critical sections may be protected by one or more locks, and contention may occur as multiple threads attempt to enter the critical section.

[0030] In one example, memory operations 115A-Z may include load exclusive operations and store exclusive operations. Load exclusive operations and store exclusive operations can be used together to check if a memory location is associated with a deactivated exclusion data structure and update the exclusion data structure to activate the exclusion mechanism. In one example, a load exclusive operation may load data at a location in memory 130 into cache 120 and determine if the exclusion mechanism for the memory location has been activated by another requester (e.g., another thread). If the exclusion mechanism is not activated, a store exclusive operation can be used to activate the exclusion mechanism for the requester by storing updated data in the exclusion data structure. Store exclusive operations and / or load exclusive operations may perform one or more conditional operations based on the state of the exclusion data structure. For example, a store exclusive operation may conditionally activate the exclusion mechanism if it is not currently activated by another thread. After a store exclusive operation occurs, one or more storage operations (e.g., non-exclusive storage operations) may occur and cause the exclusion data structure to be deactivated (e.g., unlock, remove, clear, reset). In one example, load exclusive operations and store exclusive operations may work together to acquire a lock. A load exclusive operation can check if the lock has already been acquired by another thread. If the lock has not been acquired by another thread, a store exclusive operation can be used to attempt to acquire the lock. A store exclusive operation either succeeds, indicating that the lock has been acquired, or fails, meaning that another thread may have already acquired the lock. For example, another thread might have acquired the lock between the completion times of the load exclusive operation and the storage exclusive operation.

[0031] Atomic memory operations can involve executing one or more memory operations as an atomic transaction. An atomic transaction can be a set of indivisible and irreducible operations that either all occur or none occur. This set can include one or more exclusive or non-exclusive memory operations, and an atomic transaction provides atomicity to prevent partial occurrence of the set of operations. Some examples of atomic memory operations (e.g., atomic memory operations) are test and set operations, get and add (FAA) operations, compare and swap (CAS) operations, load linked / store condition (LL / SC) operations, read-modify-write operations, other atomic operations, or combinations thereof. In one example, a thread's memory operation can be executed as an atomic transaction to avoid preemption of the thread during the atomic transaction. In another example, a thread's memory operation can be executed as an atomic transaction that allows preemption and can be completed when the thread's execution returns from preemption. In either example, memory operations 115A-Z (whether atomic, exclusive, or otherwise) may encounter contention 117.

[0032] Contention 117 occurs when memory operations from different threads contend for access to data from the same location in memory 130. For example, a first thread 113A may initiate an exclusive or atomic memory operation 115A to access data 134A at location 132A. A second thread 113B may initiate a memory operation 115B corresponding to the same location 132A, but memory operation 115B will not be able to complete until the first thread 113A completes. Once contention occurs, the location may remain classified as disputed even after the contention has been resolved. For example, after the first thread completes access to the data at that location, other threads may access the location, but it may still remain a disputed location. This is advantageous because once a location is disputed, it is more likely to be disputed in the future, and the techniques disclosed herein can handle the location differently to enhance the overall performance of computing device 100.

[0033] Contention 117 can be, includes, or involves thread contention, processor core contention, lock contention, or a combination thereof. Thread contention can occur when multiple threads executing on the same or different processor cores compete for access to a shared memory location. These threads can be part of the same computing process (e.g., a multithreaded process) or different computing processes. Different computing processes can use the same or different operating systems. Processor core contention can occur when multiple different processing cores on the same or different processors compete for access to a shared memory location. Lock contention can occur when a computing entity acquires a lock on a memory location and different computing entities attempt to access data at that location before the lock is released. Different computing entities can include one or more different threads, processes, processing cores, processors, computing devices, hosts, nodes, other computing systems, or combinations thereof.

[0034] Locations 132A and 132B are example locations in memory 130, which are being accessed by a set of memory operations 115A-Z. Location 132A is an example of a contentious location because it is the object of contention 117, as described above. Location 132B is an example of a contentious location because the access occurs without contention even though threads 113Y and 113Z cause corresponding memory operations 115Y and 115Z to access location 132B. Accesses may be contentious for a number of reasons. In one example, the earlier memory operation 115Y may not be an exclusive or atomic operation (e.g., it did not acquire the lock), so memory operations 115Y and 115Z may overlap or have concurrent accesses to location 132B (e.g., multiple read-only operations). In another example, the earlier memory operation 115Y may be exclusive or atomic, but the later memory operation 115Z does not access location 132B until after thread 113Z has finished using memory location 132B (e.g., after the lock is released).

[0035] Locations 132A and 132B can be locations in the address space and can correspond to one or more addresses. Addresses can be physical addresses (e.g., physical memory addresses), virtual addresses (e.g., virtual memory addresses), logical addresses (e.g., logical memory addresses), other addresses, or combinations thereof. Each location can correspond to a data storage block, and the location can indicate the beginning, end, or middle of the block. Processor 110 can access locations in the address space using interconnect 140.

[0036] Interconnect 140 couples processor 110 to memory 130. As used herein, “coupled” or “coupled to” generally refers to a connection between components or devices, which can be an indirect or direct communication connection (e.g., without intervention from the components or devices), whether wired or wireless, including connections such as electrical, optical, magnetic, etc. Interconnect 140 provides a communication channel between processor 110 and memory 130. Interconnect 140 may include one or more interfaces, connectors, adapters, other hardware or software, or combinations thereof. Interconnect 140 may implement standard or proprietary communication protocols, including or based on compute-fast links. TM (Compute Express Link TM CXL) and peripheral component interconnection TM (Peripheral ComponentInterconnect TM For example, PCI, PCIe), and non-volatile memory fast TM (Non-Volatile MemoryExpress TM NVMe), Advanced Host Controller InterfaceTM (Advanced Host Controller Interface TM AHCI), Serial Advanced Technology Add-on Interface TM (Serial Advanced Technology AttachmentInterface TM (e.g., SATA, mSATA) Small Computer System Interface TM (Small Computer SystemInterface TM SCSI, iSCSI), integrated driver electronics TM (Integrated Drive Electronics TM For example, IDE, EIDE), InfiniBand TM Other communication technologies, or combinations thereof.

[0037] In one example, interconnect 140 may be a CPU-to-memory interconnect that connects one or more CPUs to memory 130 used as primary memory (e.g., primary storage). Memory 130 may include one or more DIMMs (e.g., DRAM) and may span one or more nodes (e.g., NUMA nodes) and include one or more local memory nodes, remote memory nodes, or combinations thereof.

[0038] exist Figure 1 In the example shown, processor 110 may include a contention tracing component 112, a cache controller component 114, and an operation processing component 116. Contention tracing component 112 enables processor 110 to detect locations in memory that are contention targets and update data structures indicating which locations in memory are contentious, uncontentious, or combinations thereof. Cache controller component 114 enables processor 110 to use contention tracing to manage cache 120. This may involve performing cache allocation and eviction operations to store data from memory 130 in shared cache 122, private caches 124A-Z, other portions of processor 110, or combinations thereof. Operation processing component 116 enables processor 110 to process memory operations 115 more efficiently and uses contention tracing to perform out-of-order processing for specific memory operations (e.g., complementary memory exclusive operations). The following section discusses... Figure 3-4 Components 112, 114 and 116 will be discussed in more detail.

[0039] Figure 2An example processor 110 is shown, illustrating techniques for tracking contention and managing multi-level processor caches according to some embodiments of this disclosure. Cache 120 and... Figure 1 The cache 120 is the same as or similar to the cache 224A-Z, and the cache is shown in more detail. In the example shown, the cache 120 may include cache level 220A with caches 224A-Z, cache level 220B with private caches 124A-Z, and cache level 220C with shared cache 122.

[0040] Cache 120 can be a multi-level cache with a memory architecture using a cache hierarchy. The cache hierarchy allows processor 110 to store data from memory as cached data in one or more levels of cache 120. Processing cores 111A-Z can access and process cached data faster than accessing data from memory 130 (e.g., main memory access). Each access to memory 130 can become a bottleneck for the performance of processing cores 111A-Z because they will have to waste cycles waiting to retrieve data from main memory. Processor 110 reduces the number of wasted cycles by using multiple cache levels 220A-C.

[0041] During operation, processor 110 uses multiple cache levels 220A-C. The cache control logic of processor 110 operates by checking lower-level caches before checking higher-level caches. For example, processor 110 checks the cache of a lower cache level 220A (e.g., L1), and if the data is present (e.g., a cache hit), the processing core can access it; if the data is not present (e.g., a cache miss), processor 110 continues checking other cache levels. Processor 110 may check the next level, namely cache level 220B (e.g., L2), before determining that the data is not present in all levels of cache 120 and retrieving the data from memory 130 (e.g., main memory), and so on.

[0042] Each of the cache stages 220A-C is communicatively coupled to the processor 110 and may be located either inside or outside the processor 110. Figure 2In the example shown, all levels of cache 120 may be internal to processor 110 (e.g., included within the processor). If a cache level is located on the processor die (e.g., on-chip) or within the processor package (e.g., a multi-chip module), then the cache level is internal to the processor. Similarly, one or more cache levels 220A-C may be included within or outside the respective processing cores of processor 110. For example, cache levels 220A and 220B may be included within their respective processing cores (e.g., partial processing cores), and cache level 220C may be included outside all processing cores. In other examples, one or more levels of cache 120 may be external to processor 110 and its processing cores (e.g., outside the processor). For example, cache level 220C (L3) or one or more additional levels (e.g., L4) may be located outside processor 110 (e.g., outside the chip and / or package). In any example, there may be one or more lower cache levels 220A-B (e.g., L1, L2) used as private caches and one or more higher cache levels 220C (e.g., L3, L4, etc.) used as shared caches.

[0043] Cache level 220A may be a lower level of cache 120 (e.g., the lowest cache level) and may include one or more hardware caches that separate instruction data from non-instruction data. A cache that separates instruction data (e.g., executable data) from information data (e.g., non-executable data) may be referred to as a separate cache. The separate caches of cache level 220A may include multiple different portions of the same hardware cache, multiple different hardware caches, or a combination thereof. Figure 2 In the example shown, cache level 220A can be a Level 1 cache (L1) that includes two separate local caches for each processing core 111A-Z, and processing core 111A can include cache 224A for storing instruction data (e.g., L1i) and cache 224B for storing information data (e.g., L1d). The caches in cache level 220A can be private caches and can be referred to as local caches because they are located within the processing core or are the cache closest to each respective processing core.

[0044] Cache level 220B can be an intermediate level of cache 120 and may include unified caches. Unified caches avoid the separation of instruction data and have a combination of instruction data and information data; they can be called unified caches, combined caches, or other terms. Figure 2In the example shown, cache level 220B can be a Level 2 cache (L2) and includes a single federated cache for each processing core 111A-Z, with processing core 111A using a private cache 124A and processing core 111Z using a private cache 124Z. The caches in cache level 220B can be private to the corresponding processing core (as shown), or they can be private to a subset of processing cores 111A-Z (e.g., a private pair of cores). The caches in cache level 220B may not be the closest to the processing core, but they can still be considered local caches when they are part of the processing core.

[0045] Cache level 220C can be a higher level than cache 120 and can include one or more shared caches. Cache level 220C can be the highest level of cache 120 (e.g., when L4 is not present). The highest level of cache is the last level before main memory and can be called the last level cache (LLC). Figure 2 In the example shown, cache level 220C can be a level 3 cache (L3 cache) and can include a single shared cache 122 shared by all processing cores 111A-Z. Shared cache 122 can be a cache that stores both instruction data and information data, and can be used with... Figure 1 The shared cache 122 is the same as or similar to the shared cache 122. Cache level 220C can be internal to processor 110 (as shown) or external to processor 110 (e.g., off-chip or off-package). In one example, cache level 220C can be exclusively used by processor 110 (e.g., system-level cache). In another example, cache level 220C can be used by multiple processors (e.g., global cache). In either example, cache level 220C can be part of a multi-level CPU cache that includes one or more unified cache levels and one or more separate cache levels available for storing data 134A-B.

[0046] Data 134A-B can be received from main memory by processor 110 and can be stored in cache 120. Data 134A-B stored in cache 120 can be referred to as cached data and can include instruction data (e.g., executable data), information data (e.g., non-executable data), other data, or combinations thereof. Instruction data can include executable data of a computer program loaded into main memory and can include one or more processor instructions (e.g., CPU instructions, GPU instructions). Information data can be non-executable data created, read, updated, or deleted by processor 110 before, during, or after the execution of processor instructions. In one example, data 134A-B can be one or more variables (e.g., shared variables or constants), file system objects (e.g., shared files, links, directories), database objects (e.g., records, tuples), other data data storage objects, or combinations thereof. Data 134A-B can be stored in cache 120 as one or more blocks 234A-C.

[0047] Blocks 234A-C are units of data storage and can be stored in cache 120, memory 130, or a combination thereof. Data blocks stored in the cache can be called cache blocks, while data blocks stored in memory can be called memory blocks. Cache blocks can also be called cache lines, and their structure will be explained below. Figure 3 This will be discussed in more detail. The sizes of blocks 234A-C can be the same at the level of cache 120, or they can be different at the level of cache 120. In one example, the sizes of blocks 234A-C in cache 120 can be the same, possibly matching or not matching the size of the blocks received from main memory (e.g., cache blocks and memory blocks are the same size). In another example, the sizes of blocks 234A-C in cache 120 can be different, and blocks at lower levels (e.g., L1) can be smaller than blocks at intermediate levels (e.g., L2), and blocks at intermediate levels can be smaller than blocks at higher levels (e.g., L3). Figure 2 In the example shown, blocks 234A-C are cache blocks stored at different levels of cache 120. Block 234A is stored in cache level 220A (L1), block 234B is stored in cache level 220B (L2), and block 234C is stored in cache level 220C (L3).

[0048] Processor 110 can use cache controller component 114 to access data 134A-B and store it in cache 120. Processing core 111A can attempt to access data 134A-B, and processor 110 can retrieve data 134A and data 134B from main memory. Processor 110 can determine that data 134A corresponds to a disputed location (e.g., contentious data) and data 134B corresponds to an undisputed location (e.g., non-contentious data). Processor 110 can store a copy of the contentious data 134A in shared cache 122, so that all processing cores 111A-Z can access the same copy of the contentious data 134A, which can reduce cache coherence operations.

[0049] Processor 110 may store a copy of non-contentionable data 134B in a private cache 124A (L2) for a specific processing core 111A that attempts to access it. Storing non-contentionable data in a private cache allows for faster access to the non-contentionable data, but introduces additional cache coherence (e.g., when the data is used by one or more other processing cores). For example, at a subsequent point in time, processing core 111Z may attempt to access the same data 134B. Processor 110 may create a copy of data 134B and store it in private cache 124Z (L2) for use by processing core 111B. Cache 120 now includes multiple copies of data 134B in cache level 220B (L2), and processor 110 will consume additional computational resources (e.g., processor overhead) to maintain the consistency of the copies by performing one or more cache coherence operations 213.

[0050] Cache coherence operation 213 is an operation performed by processor 110 to maintain cache coherence. Cache coherence is the consistency of data stored in multiple caches of cache 120. When a processing core modifies data shared by other processing cores, the data may become inconsistent between different copies. Cache coherence operation 213 can be used to manage the cache and indicate which copies are inconsistent (e.g., stale), to update inconsistent copies of data, or combinations thereof. (See below for more details.) Figure 3 The cache controller component 114 and cache coherence are discussed in more detail.

[0051] The location where data is stored can classify an atomic operation as either near-atomic 215A or far-atomic 215B. Near-atomic 215A may involve operations on local data, while far-atomic 215B may involve operations on non-local data. In one example, if the data is stored locally within the processing core performing the atomic operation, the data is local. When the data is stored inside the processing core (e.g., local cache, private cache, L1 / L2), the atomic operation can be near-atomic, while when the data is stored outside the processing core (e.g., shared cache, L3 / L4), the atomic operation can be far-atomic. In another example, if the data is stored locally within the processor performing the atomic operation, the data is local. When the data is stored inside the processor, the atomic operation is near-atomic, while when the data is stored outside the processor (e.g., outside the chip or package, L3 / L4), the atomic operation is far-atomic. In either example, processor 110 may default to using far-atomic operations to reduce cache coherence overhead, and by detecting that the atomic operation corresponds to an uncontested operation, processor 110 may execute near-atomic operations, which are faster than far-atomic operations.

[0052] Figure 3-4 This is a block diagram illustrating an exemplary processor 110 according to some embodiments of the present disclosure, the processor 110 having techniques for tracking contention for data in memory and using the tracked contention during its operation. Figure 3 In this context, processor 110 can use the tracked contention to manage the cache and determine where to store data within the cache. Figure 4 In this context, the processor 110 can use the tracked contention to manage memory operations and determine which memory operations can be executed out of order.

[0053] about Figure 3-4 The features discussed in the components and modules can be implemented in the processor 110 in software (e.g., program code) or hardware (e.g., circuitry). Without loss of generality, more or fewer components or modules may be included. For example, two or more components may be combined into a single component, or features of a component may be divided into two or more components. Reference Figure 3 The processor 110 may include a contention tracing component 112 and a cache controller component 114.

[0054] Contention tracking component 112 can be used to detect locations in memory that are contention targets and update one or more data structures to indicate which locations in memory are contentious, uncontentious, or a combination thereof. In one example, contention tracking component 112 may include contention determination module 312, data structure update module 314, and location checking module 316.

[0055] The contention determination module 312 enables the processor 110 to determine that contention exists at a location in memory. Contention may occur when one or more memory operations from a first group (e.g., a first thread) compete with one or more memory operations from a second group (e.g., a second thread) to access data from a common location in memory. The common location may occur when the memory operations correspond to the same memory location, or it may occur when the memory operations correspond to different memory locations but the different memory locations all include at least one common location (e.g., an overlapping portion of memory).

[0056] The contention determination module 312 can detect the occurrence of contention by detecting one or more computation events. Computation events can include one or more specific errors, faults (e.g., cache miss, page fault), exceptions, traps, or state transitions. State transitions can be used to exit or enter thread states (e.g., waiting, blocked, paused, sleeping, running, paused, terminated), locked states (e.g., locked, unlocked, open, closed), other state transitions, or combinations thereof. The contention determination module 312 can predict whether contention exists (e.g., disputed), whether contention does not exist (e.g., no dispute, no contention, lack of contention), whether contention will continue, whether the absence of contention will continue, whether future contention will occur, other predictions, or combinations thereof.

[0057] The contention determination module 312 enables the processor 110 to register one or more event listeners that trigger analysis in response to an event. In one example, the contention determination module 312 can detect lock contention in response to a subsequent thread failing to acquire a lock on a locked memory location (e.g., a lock attempt failing) or failing to access a locked memory location (e.g., a read error or write error), where no attempt to acquire the lock may have occurred. In another example, the contention determination module 312 can detect barrier contention. A barrier is a software mechanism used to ensure that a group of threads has reached a point in its instruction flow, and then allows any thread to proceed beyond that point. This point may be before, during, or after one or more critical sections.

[0058] The data structure update module 314 enables the processor 110 to update one or more data structures 334 based on detected or predicted contention. Data structures 334 can be any data structure used by the processor 110 to manage one or more portions of the memory hierarchy, including processor registers, caches, main memory, or combinations thereof. Data structures 334 may include metadata that defines, describes, or organizes data stored in caches and main memory. Data structures 334 may be stored in the processor's storage space (e.g., registers, caches), main storage devices (e.g., main memory), secondary storage devices (e.g., hard disk drives, solid-state drives), other storage locations, or combinations thereof. Data structures 334 may include a set of one or more entries corresponding to locations in memory. Data structures 334 may represent this set as one or more lists (e.g., linked lists), arrays (e.g., multidimensional arrays, matrices, tables), other storage objects, or combinations thereof.

[0059] The entries in the set may each correspond to one or more memory locations and may each include contention data indicating that one or more memory locations are contested, uncontested, or a combination thereof. In one example, data structure 334 may include a set (e.g., a table, a linked list) that includes entries (e.g., rows, columns, elements, nodes) for each contested memory location (e.g., contention data), but excludes entries for uncontested memory locations, and vice versa. In another example, data structure 334 may include a set (e.g., a bitmap) having entries representing each location in memory and indicators (e.g., bit flags, contention data) for each location indicating whether that location is contested. In yet another example, data structure 334 may be a cached data structure that includes a set of cache entries with embedded contention data (e.g., contention indicators).

[0060] Cache entries may include a structure with one or more tags, data blocks, and indicators. Each tag may include location metadata indicating the location in memory corresponding to the cache entry. The location metadata may include the entire location identifier (e.g., an address) or a portion of the identifier (e.g., the low or high bits of the address). Each data block may include data from memory that is being stored in the cache and may be the same as or similar to a cache line or cache block. Each indicator may include one or more bits that indicate the state of the data block and may correspond to contention (e.g., contested or uncontested), consistency (e.g., stale, valid, invalid), update (e.g., not written, dirty, clean), locking (e.g., locked, unlocked), sharing, other states, or combinations thereof.

[0061] Data structure update module 314 can indicate whether a location is a contested location in response to a single contention instance or in response to multiple contention instances. In one example, a memory location can be a contested memory location if it is the target of contention at least once (e.g., a single contention instance). In another example, a memory location can be a contested memory location if one or more contention metrics satisfy one or more thresholds (e.g., above, below, or equal to a threshold). Contention metrics can be based on one or more contention quantities (e.g., x instances), contention duration (e.g., y clock cycles, y nanoseconds), contention rate (e.g., x instances per y duration), the number of computational entities involved in the contention (e.g., z threads attempting to lock), the type of computational entities involved (e.g., threads, processes, cores, processors, computing devices), other metrics, or combinations thereof.

[0062] Once a data structure is updated to indicate a disputed location, that location may remain disputed even after the contention has been resolved. For example, a contention indicator may be retained after the contention is resolved (e.g., the location is unlocked). A contention indicator may be retained for any duration until the data structure is updated to remove the indicator. Updating a data structure to remove an indicator may involve updating a set to remove an indicator, location, entry, or the entire data structure as a removal operation. Removal operations may be the same as or similar to toggling (e.g., bit flipping), replacing (e.g., overwriting), deleting an entry, deleting, clearing, refreshing, other operations, or combinations thereof. Removal operations may occur after a predetermined time (e.g., n nanoseconds, a scheduled time, a time period) or in response to a computational event (e.g., thread termination, power cycling, page input / output, context switching, load / store).

[0063] The location checking module 316 enables the processor 110 to determine whether one or more specific locations in memory are disputed, undisputed, or a combination thereof. Determining whether a specific location is disputed may involve accessing and analyzing data structure 334 using locations in memory (e.g., location data in tags). This may involve identifying entries in a location set based on the location and determining whether the entry indicates that the location is disputed or undisputed.

[0064] Cache controller component 114 can access data from contention tracking component 112 and use that data to manage cache 120. This may involve performing cache allocation and eviction operations to store data from memory in a shared cache, a private cache, other parts of the cache, or a combination thereof. In one example, cache controller component 114 may include memory access module 322 and data storage module 324.

[0065] Memory access module 322 enables processor 110 to access main memory to retrieve data at a location in memory. Memory access module 322 may receive a location in memory as input, or it may receive different locations and resolve that location (e.g., a logical or virtual location) to a location in memory (e.g., a physical location). Resolving a location may involve one or more operations mapping one or more first addresses (e.g., logical or virtual addresses) to one or more second addresses (e.g., physical addresses), which may or may not use a Translation Lookaside Buffer (TLB). Memory access module 322 may use one or more interconnects (discussed above) to access data stored at that location. As described above, accessing data in memory may involve read access, write access, or a combination thereof. Read access may involve loading data from memory into a cache and involves processor 110 receiving data from a location in memory. Write access may involve storing data from a cache into memory and involves processor 110 sending data from the cache to a location in memory.

[0066] Data storage module 324 enables processor 110 to store data received from main memory in one or more caches of processor 110. Data storage module 324 can determine where to place data in the processor's caches. As described above, the processor cache may include multiple caches at different levels and may include a shared cache and one or more private caches. Data storage module 324 can use data from contention tracking component 112 to determine where to store data in the processor cache. As described above, when data corresponds to a disputed location, data storage module 324 may store the data in a shared cache (e.g., L3). When data corresponds to an undisputed location, data storage module 324 may store the data in one or more private caches (e.g., L2, L1d).

[0067] For disputed locations, data storage module 324 can store the data as a single copy in the shared cache and avoid having multiple copies of the data in the private cache. In one example, the entire processor cache (e.g., L1-L3) may have a single copy of the data, and this single copy is in the shared cache (e.g., in L3, but not in L2 or L1). In another example, the entire processor cache may have a single copy in the shared cache (e.g., in L3) and a single copy in the private cache (e.g., L1d, but not L2). Due to processor design, the latter case may always or occasionally occur. In any of these examples, data storage module 324 can avoid having multiple copies in the private cache. This can significantly reduce cache coherence overhead because the data originates from a disputed location and may be accessed by multiple cores, which would otherwise store it in the corresponding private caches of multiple cores.

[0068] For undisputed locations, data storage module 324 can bypass the shared cache by storing a copy of the data without allocating storage space in the shared cache. In one example, the data can still be received by the shared cache and can pass through the shared cache before being received and stored in the corresponding private cache (e.g., L2).

[0069] As mentioned above, processor caches can avoid having multiple copies in a private cache (L2) and can be referred to as a primary exclusive cache, a partially exclusive cache, a non-exclusive cache, other terms, or combinations thereof. A cache may be a "primarily exclusive cache" or a "partially exclusive cache" because cached data is typically stored once across multiple cache levels of the processing core, but in some cases there may be multiple copies (e.g., one copy in a private L1d and a shared L3). In one example, a processor cache may be a "dedicated federated cache" because it includes a single copy of the data in a federated cache portion for a specific processing core, even though another copy may exist in a separate cache portion (e.g., L1d or L1i) for that specific processing core.

[0070] Data storage module 324 can handle the allocation and eviction of data from the cache. Evicting data from the cache may involve removing data from the cache (e.g., eviction) to free up space in the cache to store incoming data. Eviction may be based on the contention of the data storage location. For example, eviction may make removing data corresponding to an undisputed location take precedence over removing data corresponding to a disputed location. When space is used to store incoming data, the data evicted from the cache may subsequently be overwritten. Data storage module 324 can handle the allocation of space. In one example, allocating space may involve generating a cache entry that includes a label, a cache line, and a set of indicators. As described above, the label may indicate a memory location, and the cache line may include data from the memory location. The set of indicators may include one or more of a contention indicator, a dirty indicator, and a stale indicator.

[0071] refer to Figure 4 According to some embodiments of this disclosure, processor 110 may include techniques for tracking data contention in memory and using the tracked contention to process memory operations. Processor 110 may include a contention tracking component 112 and an operation processing component 116. Contention tracking component 112 may be related to the above-mentioned... Figure 4 The contention tracking component 112 discussed is the same as or similar to this component.

[0072] Operation processing component 116 enables processor 110 to process memory operations 115 more efficiently and to perform out-of-order processing for specific memory operations using contention tracing (e.g., memory exclusive operations that supplement previous load operations of the same thread). In one example, operation processing component 116 may include queue module 422, operation analysis module 424, and processing module 426.

[0073] Queue module 422 enables processor 110 to manage an ordered set of operations. Managing an ordered set of operations can involve adding, deleting, reordering, or combinations thereof. The operations in the set can include any operation performed by processor 110, and can include memory operations and any non-memory operations performed by processor 110. Memory operations have been discussed above with respect to memory operation 115 and can be the same as or similar to memory access operations involving accessing data in main memory (e.g., read access or write access) or managing accesses (e.g., locking, excluding, or synchronizing). The ordered set of operations can be stored by queue 432.

[0074] Queue 432 may be a data structure used to store and organize a set of operations. A queue may be the same as or similar to a buffer, array, list, other storage structure, or a combination thereof. In one example, queue 432 may include both memory operations and non-memory operations. In another example, queue 432 may include memory operations but not non-memory operations. In either example, queue 432 may include one or more receive queues that store operations before, during, or after processing. Once an operation is processed (e.g., completed), operations can be removed from queue 432 or can be updated to indicate that they have been processed and retained in queue 432 until they are overwritten (e.g., a circular queue).

[0075] Operation analysis module 424 enables processor 110 to analyze operations in a set (e.g., in queue 432). Operation analysis module 424 can detect that the set includes load-memory operations, store-memory operations, and zero or more intervention operations. Threads may include load-memory operations targeting a specific memory location and may include one or more complementary store-memory operations targeting the same memory location (e.g., complementary load / store pairs for thread A). Intervention operations may occur between these complementary load and store-memory operations in the ordered set. Intervention operations can be of any type and may include memory operations (e.g., load or store operations by another thread), non-memory operations (e.g., comparisons, data manipulations), or combinations thereof.

[0076] Load and store operations can be exclusive operations, atomic operations, or a combination thereof. In one example, load and store memory operations can be exclusive memory operations. For instance, a load memory operation can be an exclusive load operation caused by a load exclusive processor instruction from the executing thread, while a store memory operation can be an exclusive store operation caused by a store exclusive processor instruction from the same executing thread. An exclusive load operation can determine whether the lock on the memory location was previously acquired by another thread, and the exclusive store operation can acquire that lock. In another example, operations in an ordered set can include atomic operations that perform the load and store as a single transaction, which may or may not acquire the lock on the memory location.

[0077] Processing module 426 enables processor 110 to process operations within an ordered set of operations. This set of load and store memory operations may have a specific order. This order may be based on First-In-First-Out (FIFO). This order can be used as input to determine when to process memory operations. Processing module 426 may access data (e.g., metadata and data structures) from contention tracking component 112 and use this data to process operations out of order. For example, processing module 426 may process later memory operations for disputed locations before processing earlier memory operations for undisputed locations. In one example, processing module 426 may process load exclusive memory operations for disputed memory locations based on the existing order of the set and may process supplementary exclusive memory operations out of order. In another example, processing module 426 may process load exclusive and store exclusive operations for disputed locations out of order. In either example, processing operations out of order means that it can bypass (e.g., skip) one or more earlier operations, which can reduce the time spent acquiring, maintaining, releasing locks, or combinations thereof for disputed locations.

[0078] Processing module 426 enables processor 110 to use multiple threads to process an ordered set of operations (e.g., queue 432). Processor 110 can use a first thread to process memory operations for loading data from main memory into a cache (e.g., load exclusive memory operation). Processor 110 can use a second thread to process memory operations for storing data from a cache into main memory (e.g., store exclusive memory operation). The second thread can analyze the ordered set of operations and identify complementary memory operations and process them out of order.

[0079] Processing module 426 can also use data from contention tracking component 112 to process atomic operations more efficiently. By default, atomic operations can be processed using far atomic memory operations to reduce cache coherence overhead. Processing module 426 can detect whether an atomic operation corresponds to a disputed or undisputed location. When an atomic operation corresponds to an undisputed location, processing module 426 can process the atomic operation as a near atomic operation (e.g., for local data). When an atomic operation corresponds to a disputed location, the operation processing module can process the atomic operation as a far atomic. This can be advantageous because processing module 426 can cover the typical processing of atomic operations to process memory operations faster.

[0080] Figure 5This is a flowchart of a method 500 for managing a cache using contention tracing, according to some embodiments of the present disclosure. Method 500 may be executed by processing logic, which may include hardware (e.g., processing device, circuitry, dedicated logic, programmable logic, microcode, device hardware, integrated circuits, etc.), software (e.g., instructions that run or execute on the processing device), or a combination thereof. In some embodiments, method 500 is performed by… Figure 1-4 The processor 110 executes the process. Although shown in a specific order or sequence, the order of processing may be modified unless otherwise stated. Therefore, the illustrated embodiments should be understood as examples only, and the illustrated processes may be executed in different orders, and some processes may be executed simultaneously or in parallel. Furthermore, one or more processes may be omitted in various embodiments. Therefore, not all processes are required in every embodiment. Other process flows are possible.

[0081] In operation 510, the processing logic of the processing device can identify a location in memory and that the location in memory includes data. The processing logic can receive data from the location in memory and generate a cache entry including a tag, a cache line, and a set of indicators. The tag may include the location, the cache line may include data from the location in memory, and the set of indicators may include one or more of a contention indicator, a dirty indicator, and an obsolete indicator. In one example, the processing logic can access a multilevel processor cache that includes separate cache levels and one or more combined cache levels. The separate cache levels can separate instruction data from information data, and one or more combined cache levels can each combine instruction data with information data. In one example, the processing logic may be part of a central processing unit (CPU) that includes multiple processing cores and caches (e.g., a multilevel processor cache).

[0082] In operation 520, the processing logic can determine if a location is disputed. A location in memory may be disputed if at least one thread is blocked from accessing the location while the location is locked by another thread. In one example, the processing logic can determine that a first thread has acquired the lock on the location and detect lock contention in response to a second thread failing to acquire the lock on the location. The first thread can execute on a first processing core and the second thread can execute on a second processing core. The processing logic can update the data structure to indicate that the location is disputed.

[0083] In operation 530, processing logic can store data in a shared cache in response to location disputes. This shared cache can be used by multiple processing cores. In one example, data is stored as a single copy in the shared cache, avoiding multiple copies of data in a private cache to reduce cache consistency operations. In another example, the cache can be a primary exclusive cache that maintains single copies of data at multiple cache levels, including a federated cache level 2 (L2) and a federated cache level 3 (L3). Processing logic can evict data from the cache before, during, or after storage. Eviction can prioritize removing data corresponding to undisputed locations over removing data corresponding to disputed locations.

[0084] At operation 540, in response to no positional dispute, the processing logic can bypass the shared cache and store the data in a private cache. The private cache can be used by a single processing core among multiple processing cores. Data can be stored in the private cache instead of the shared cache. The shared cache can be a Level 3 (L3) cache shared by multiple processing cores, and the private cache can include a Level 2 (L2) cache and a Level 1 (L1) cache private to one of the processing cores. In one example, the processing device can process multiple atomic operations on the positional data. Multiple atomic operations can be processed as far atomic operations when there is a positional dispute and as near atomic operations when there is no positional dispute.

[0085] Figure 6 This is a flowchart of a method 600 for managing memory operations using contention tracing, according to some embodiments of the present disclosure. Method 600 may be executed by processing logic, which may include hardware (e.g., processing device, circuitry, dedicated logic, programmable logic, microcode, device hardware, integrated circuits, etc.), software (e.g., instructions that run or execute on the processing device), or a combination thereof. In some embodiments, method 600 is performed by… Figure 1-4 The processor 110 executes the process. Although shown in a specific order or sequence, the order of processing may be modified unless otherwise stated. Therefore, the illustrated embodiments should be understood as examples only, and the illustrated processes may be executed in different orders, and some processes may be executed in parallel. Furthermore, one or more processes may be omitted in various embodiments. Therefore, not all processes are required in every embodiment. Other process flows are possible.

[0086] In operation 610, the processing logic of the processing device can determine that a thread is prevented from accessing data in multiple locked memory locations. The processing logic can determine that a first thread has acquired a lock on a memory location and detect lock contention in response to a second thread failing to acquire a lock on one of the memory locations. The first thread can execute on a first processing core of the processing device, and the second thread can execute on a second processing core of the processing device.

[0087] In operation 620, the processing logic can update a data structure to indicate that multiple memory locations are disputed and that these locations may remain disputed after being unlocked. In one example, the processing logic can initiate an update in response to detected contention.

[0088] In operation 630, the processing logic can handle a first memory operation from the queue. The queue may include the first memory operation, multiple intervening operations, and a second memory operation. The first and second memory operations can manipulate data at memory locations. The first and second memory operations can occur while the memory location is locked. In one example, the first memory operation can be an exclusive load operation and the second memory operation can be an exclusive store operation. An exclusive load operation can be initiated by executing a load exclusive processor instruction of a thread, and an exclusive store operation can be initiated by executing a store exclusive processor instruction of the same thread.

[0089] In operation 640, the processing logic can determine whether a memory location is disputed based on a data structure. In one example, the memory location could be a physical memory address in main memory. This data structure can indicate a physical memory address that is disputed at any time within a predetermined time period.

[0090] In operation 650, the processing logic may process the second memory operation before at least one intervention operation in the intervention operation. The intervention operation may occur between the first and second memory operations in the queue. Processing the second memory operation (e.g., a store operation) before at least one intervention operation in the queue can reduce the duration for which a disputed location is locked. The queue may be an ordered set of memory operations, including multiple exclusive load operations followed by multiple exclusive store operations. The processing logic may process all multiple exclusive store operations for a disputed location before all multiple exclusive store operations for undisputed locations. In one example, the queue may be processed by multiple threads. The first thread may process the memory operations for loading data, while the second thread may process the memory operations for storing data.

[0091] Figure 7An example machine of computer system 700 is shown, in which a set of instructions can be executed to cause the machine to perform any or more of the methods discussed herein. In some embodiments, computer system 700 may be a computing device including a processor having a cache controller, a memory controller, or a combination thereof. In alternative embodiments, the machine may be connected (e.g., networked) to other machines in a LAN, intranet, extranet, and / or the Internet. The machine may operate as a server or client machine in a client-server network environment, as a peer machine in a peer-to-peer (or distributed) network environment, or as a server or client machine in a cloud computing infrastructure or environment.

[0092] The machine can be a personal computer (PC), tablet PC, set-top box (STB), personal digital assistant (PDA), cellular phone, network device, server, network router, switch or bridge, or any machine capable of executing a set of instructions (sequential or otherwise) that specify the action to be taken by the machine. Furthermore, while a single machine is described, the term "machine" should also be understood to include any collection of machines that individually or jointly execute a set (or more) of instructions to perform any or more of the methods discussed herein.

[0093] Example computer system 700 includes processing device 702 (e.g., processor 110), main memory 704 (e.g., read-only memory (ROM), flash memory, dynamic random access memory (DRAM), such as synchronous DRAM (SDRAM) or Rambus DRAM (RDRAM), etc.), static memory 706 (e.g., flash memory, static random access memory (SRAM), etc.) and data storage system 718, which communicate with each other via bus 730.

[0094] Processing device 702 represents one or more general-purpose processing devices, such as microprocessors, central processing units, etc. More specifically, the processing device may be a Complex Instruction Set Computing (CISC) microprocessor, a Reduced Instruction Set Computing (RISC) microprocessor, a Very Long Instruction Word (VLIW) microprocessor, or a processor implementing other instruction sets, or a processor implementing combinations of instruction sets. Processing device 702 may also be one or more special-purpose processing devices, such as application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), network processors, etc. Processing device 702 is configured to execute instructions 726 to perform the operations and steps discussed herein. Computer system 700 may further include a network interface device 708 for communication via network 720.

[0095] Data storage system 718 may include machine-readable storage medium 724 (also referred to as non-transitory computer-readable medium) on which one or more sets of instructions 726 or software embodying any one or more methods or functions described herein are stored. Instructions 726 may also reside wholly or at least partially within main memory 704 and / or processing device 702 during execution by computer system 700, which also constitute machine-readable storage media. Machine-readable storage medium 724, data storage system 718, and / or main memory 704 may correspond to... Figure 1 The memory 130.

[0096] In one embodiment, instruction 726 includes methods for implementing the corresponding Figure 1-4 The contention tracking component 112 contains instructions for its functionality. While machine-readable storage medium 724 is shown as a single medium in the example embodiment, the term "non-transitory machine-readable storage medium" should be understood to include a single medium or multiple media storing one or more sets of instructions. The term "machine-readable storage medium" should also be understood to include any medium capable of storing or encoding a set of instructions for machine execution and causing the machine to perform any one or more methods of this disclosure. Therefore, the term "machine-readable storage medium" should be understood to include, but is not limited to, solid-state memories, optical media, and magnetic media.

[0097] Some of the parts described in detail above have been presented in terms of algorithms and symbolic representations of operations on data bits within computer memory. These algorithmic descriptions and representations are the most efficient way for those skilled in the art of data processing to communicate their work to others skilled in the art. Algorithms are, and are generally considered, self-consistent sequences of operations that lead to desired results. These operations are those that require physical manipulation of physical quantities. Typically, though not always necessary, these quantities take the form of electrical or magnetic signals that can be stored, combined, compared, and otherwise manipulated. Sometimes, primarily for common reasons, it has proven convenient to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, etc.

[0098] However, it should be remembered that all these and similar terms will be associated with appropriate physical quantities and are merely convenient labels applied to those quantities. This disclosure may refer to the actions and processes of a computer system or similar electronic computing device, the operation of which is represented as data of physical (electronic) quantities in the registers and memory of the computer system, and the conversion of data represented as physical (electronic) quantities in the registers and memory of the computer system into other data similarly represented as physical quantities in the computer system's memory or registers or other such information storage systems.

[0099] This disclosure also relates to an apparatus for performing the operations described herein. The apparatus may be specifically constructed for its intended purpose, or it may comprise a general-purpose computer selectively activated or reconfigured by a computer program stored in a computer. Such a computer program may be stored in a computer-readable storage medium, such as, but not limited to, any type of disk, including floppy disks, optical disks, CD-ROMs and magneto-optical disks, read-only memory (ROM), random access memory (RAM), EPROM, EEPROM, magnetic cards or optical cards, or any type of medium suitable for storing electronic instructions, each connected to a computer system bus.

[0100] The algorithms and displays presented herein are not inherently related to any particular computer or other device. Various general-purpose systems can be used with the programs taught herein, or it can be demonstrated that it is convenient to construct more specialized devices to perform the methods. The structures of various such systems will be described below. Furthermore, no particular programming language is referenced in describing this disclosure. It should be understood that the teachings of this disclosure as described herein can be implemented using a variety of programming languages.

[0101] This disclosure may be provided as a computer program product or software, which may include a machine-readable medium having instructions stored thereon, which can be used to program a computer system (or other electronic device) to perform processes according to this disclosure. Machine-readable media include any mechanism for storing information in a machine-readable (e.g., computer-readable) form. In some embodiments, machine-readable (e.g., non-transitory computer-readable) media include machine-readable (e.g., computer-readable) storage media, such as read-only memory (“ROM”), random access memory (“RAM”), disk storage media, optical storage media, flash memory components, etc.

[0102] In the foregoing description, embodiments of the present disclosure have been described with reference to specific exemplary embodiments. It will be apparent that various modifications can be made thereto without departing from the broader spirit and scope of the embodiments of the present disclosure as set forth in the appended claims. Therefore, the description and drawings should be regarded as illustrative rather than restrictive.

Claims

1. A system comprising: Caches, which include shared caches and private caches; as well as A processing device operatively coupled to the cache to perform the following operations: Identify a first location and a second location in the memory, wherein the first location includes first data and the second location includes second data; Determine whether the first position is disputed and whether the second position is disputed, wherein a dispute means that there is a contention for use at the corresponding position; In response to a dispute regarding the first location, the first data is stored in the shared cache, wherein the shared cache is used by multiple processing cores; and In response to the lack of dispute regarding the second location, the shared cache is bypassed and the second data is stored in the private cache, wherein the private cache is used by one of the processing cores among the plurality of processing cores; In response to a dispute at the first position at a first moment, contention data associated with the first position is stored in the data structure of the processing device; and In response to the fact that the first position is no longer disputed at the second moment, the contention data is updated.

2. The system of claim 1, wherein the system includes a central processing unit (CPU), the CPU includes the plurality of processing cores and the shared cache and the private cache, wherein the shared cache includes a Level 3 (L3) cache shared by the plurality of processing cores, and the private cache includes a Level 2 (L2) cache and a Level 1 (L1) cache private to the processing cores.

3. The system of claim 1, wherein the first location in the memory is disputed when at least one thread is blocked from accessing the first location while the first location is locked by another thread.

4. The system of claim 1, wherein the first data originates from a disputed location in the memory and is stored as a single copy in the shared cache, and multiple copies of the first data in the private cache are avoided to reduce cache coherence operations.

5. The system of claim 1, wherein the second data originates from an undisputed location in the memory and is stored in the private cache instead of the shared cache.

6. The system of claim 1, wherein the operation further comprises processing a plurality of atomic operations, wherein when operating on data at disputed locations, the plurality of atomic operations are processed as far atomic operations, and when operating on data at undisputed locations, the plurality of atomic operations are processed as near atomic operations.

7. The system of claim 1, wherein the operation further comprises: Data is evicted from the shared cache or private cache prior to storage, wherein the removal of data corresponding to undisputed locations takes precedence over the removal of data corresponding to disputed locations.

8. The system of claim 1, wherein at least one of the shared cache or the private cache comprises a separate cache level and one or more combined cache levels, wherein the separate cache level separates instruction data from information data, and each of the one or more combined cache levels combines the instruction data with the information data.

9. The system of claim 1, wherein the operation further comprises: It is determined that the first thread has acquired the lock at the first location, wherein the first thread is executing on the first processing core among the plurality of processing cores; Lock contention is detected in response to a second thread failing to acquire the lock at the first location, wherein the second thread is executing on a second processing core among the plurality of processing cores.

10. The system of claim 1, wherein the operation further comprises: The processing device receives first data from the first location in the memory; as well as Generate a cache entry comprising a label, a cache line, and a set of indicators, wherein the label comprises the first location, the cache line comprises the first data from the first location in the memory, and the set of indicators comprises one or more of a contention indicator, a dirty indicator, and a stale indicator.

11. The system of claim 1, wherein the private cache includes a Level 1 cache (L1) and a primary exclusive federated Level 2 cache (L2), and maintains a single copy of the first data across multiple levels of the private cache, wherein the multiple levels include the Level 1 cache (L1), the federated Level 2 cache (L2), and the shared cache, wherein the shared cache includes a federated Level 3 cache (L3).

12. A method comprising: The processing device identifies a location in the memory, wherein the location in the memory includes data; The processing device determines whether the location is disputed, wherein a dispute means that there is a contention for the location; In response to a dispute regarding the location, the data is stored in a shared cache, which is used by multiple processing cores. In response to the absence of dispute regarding the location, the shared cache is bypassed and the data is stored in a private cache, wherein the private cache is used by one of the processing cores among the plurality of processing cores; In response to a dispute over the location at a first moment, contention data associated with the location is stored in the data structure of the processing device; and In response to the fact that the position described at the second time point is no longer disputed, the contention data is updated.

13. The method of claim 12, wherein the processing device includes a central processing unit (CPU), the CPU includes the plurality of processing cores, the shared cache and the private cache, wherein the shared cache includes a Level 3 (L3) cache shared by the plurality of processing cores, and the private cache includes a Level 2 (L2) cache and a Level 1 (L1) cache private to the processing cores.

14. The method of claim 12, wherein the location in the memory is disputed if at least one thread is blocked from accessing the location while the location is locked by another thread.

15. The method of claim 12, wherein the location is a disputed location, and wherein the data is stored as a single copy in the shared cache, and multiple copies of the data in a private cache are avoided to reduce cache consistency operations.

16. A system comprising: Processor cache, which includes shared cache and private cache; as well as A processor, comprising multiple processing cores, wherein the processor is operatively coupled to the processor cache and performs the following operations: Identify a first location and a second location in the main memory, wherein the first location includes first data and the second location includes second data; Determine whether the first location is disputed and whether the second location is disputed, wherein the first location in the main memory is disputed if at least one thread is blocked from accessing the first location while the first location is locked by another thread; In response to a dispute regarding the first location, the first data is stored in the shared cache, which is used by the plurality of processing cores; In response to the lack of dispute regarding the second location, the shared cache is bypassed and the second data is stored in the private cache, wherein the private cache is used by one of the processing cores among the plurality of processing cores; In response to a dispute at the first position at a first moment, contention data associated with the first position is stored in the processor's data structure; and In response to the fact that the first position is no longer disputed at the second moment, the contention data is updated.

17. The system of claim 16, wherein the processor includes a central processing unit (CPU), the CPU includes the processor cache, and wherein the shared cache includes a Level 3 (L3) cache shared by the plurality of processing cores, and the private cache includes a Level 2 (L2) cache and a Level 1 (L1) cache private to each processing core.

18. The system of claim 16, wherein the first data originates from a disputed location in the main memory and is stored as a single copy in the shared cache, and multiple copies of the first data in a private cache are avoided to reduce cache coherence operations.

19. The system of claim 16, wherein the second data originates from an undisputed location in the memory and is stored in the private cache instead of the shared cache.

20. The system of claim 16, wherein the operation further comprises processing a plurality of atomic operations, wherein when operating on data at disputed locations, the plurality of atomic operations are processed as far-atom operations, and when operating on data at undisputed locations, the plurality of atomic operations are processed as near-atom operations.

Citation Information

Patent Citations

  • Controller address contention assumption

    US20210034438A1