当前位置: 首页 > 工具软件 > micro-cache > 使用案例 >

【计算机系统结构】Micro-operation微操作

百里渊
2023-12-01

在CPU 中,micro-operations (also known as a micro-ops or μops) 是用于一些设计复杂机器指令的详细底层指令。

通常,微操作在数据存储方面的一个或多个寄存器执行基本的操作,包括寄存器之间传输数据或寄存器与CPU的额外总线之间传输数据,还有在寄存器上的算术运算或逻辑运算。在典型的取值-译码-执行周期,在执行时微操作的每一步被分解,因此CPUCPU确定并逐步通过一系列微操作。微操作的执行是受控于CPU 控制单元----这决定着执行不同的优化方法如重排序,融合,缓存的执行。

优化

WIKI 原文:

Micro-operation

A high-level illustration showing the decomposition of machine instructions into micro-operations, performed during typical fetch-decode-execute cycles.[1]:1
In computer central processing units, micro-operations (also known as a micro-ops or μops) are detailed low-level instructions used in some designs to implement complex machine instructions (sometimes termed macro-instructions in this context).[2]:8–9

Usually, micro-operations perform basic operations on data stored in one or more registers, including transferring data between registers or between registers and external buses of the central processing unit (CPU), and performing arithmetic or logical operations on registers. In a typical fetch-decode-execute cycle, each step of a macro-instruction is decomposed during its execution so the CPU determines and steps through a series of micro-operations. The execution of micro-operations is performed under control of the CPU’s control unit, which decides on their execution while performing various optimizations such as reordering, fusion and caching.[1]

Optimizations

Various forms of μops have long been the basis for traditional microcode routines used to simplify the implementation of a particular CPU design or perhaps just the sequencing of certain multi-step operations or addressing modes. More recently, μops have also been employed in a different way in order to let modern CISC processors more easily handle asynchronous parallel and speculative execution: As with traditional microcode, one or more table lookups (or equivalent) is done to locate the appropriate μop-sequence based on the encoding and semantics of the machine instruction (the decoding or translation step), however, instead of having rigid μop-sequences controlling the CPU directly from a microcode-ROM, μops are here dynamically buffered for rescheduling before being executed.[3]:6–7, 9–11

This buffering means that the fetch and decode stages can be more detached from the execution units than is feasible in a more traditional microcoded (or hard-wired) design. As this allows a degree of freedom regarding execution order, it makes some extraction of instruction level parallelism out of a normal single-threaded program possible (provided that dependencies are checked etc.). It opens up for more analysis and therefore also for reordering of code sequences in order to dynamically optimize mapping and scheduling of μops onto machine resources (such as ALUs, load/store units etc.). As this happens on the μop-level, sub-operations of different machine (macro) instructions may often intermix in a particular μop-sequence, forming partially reordered machine instructions as a direct consequence of the out-of-order dispatching of microinstructions from several macro instructions. However, this is not the same as the micro-op fusion, which aims at the fact that a more complex microinstruction may replace a few simpler microinstructions in certain cases, typically in order to minimize state changes and usage of the queue and reorder buffer space, therefore reducing power consumption. Micro-op fusion is used in some modern CPU designs.[2]:89–91, 105–106[3]:6–7, 9–15

Execution optimization has gone even further; processors not only translate many machine instructions into a series of μops, but also do the opposite when appropriate; they combine certain machine instruction sequences (such as a compare followed by a conditional jump) into a more complex μop which fits the execution model better and thus can be executed faster or with less machine resources involved. This is also known as macro-op fusion.[2]:106–107[3]:12–13

Another way to try to improve performance is to cache the decoded micro-operations, so that if the same macroinstruction is executed again, the processor can directly access the decoded micro-operations from a special cache, instead of decoding them again. The Execution Trace Cache found in Intel NetBurst microarchitecture (Pentium 4) is a widespread example of this technique.[4] The size of this cache may be stated in terms of how many thousands of micro-operations it can store: kμops.[5]

 类似资料: