Docsity

Cache Memory Optimization Techniques: A Comprehensive Guide - Prof. Ferretti, Appunti di Architettura Dei Calcolatori

Toggle sidebar
bg1
Microarchitecture: the internal structure of a processor, and its datapath: namely, the
path where instructions go through when executed.!
ISA (Instruction Set Architecture): is the set of machine instructions of a processor. Two
distinct processors can have the same ISA but different microarchitectures (that is, two
different ways to execute those instructions).!
The simple RISC microarchitecture that we consider, executes fixed-length 32 bit
instructions. We shall consider the “integer” section of the architecture only: instructions
operate on integer registers, memory and PC.!
We shall cover mainly the datapath of the CPU, with only some hints to the Control Unit
(CU): is the section that control and synchronises the different datapath blocks during
the instruction execution.!
The two main features of a modern RISC machine are:!
•machine instructions are simple
•as a consequence, the control unit is simple too, and there is no need for a complex
microprogram to steer (guidare) machine instruction execution within the CPU.!
The architecture has, at least, 32 general purpose integer registers, each of 32 bits. In
MIPS, register R0 is special and always stores 0 (this also in 64 bits architectures).!
Since we don’t consider floating point operations, the architecture we describe has
neither floating point registers nor functional units to process floating point data.!
A generic MIPS instruction has the following format:!
•op: represents the class of the operation!
•reg_1: represents the source register 1!
•reg_2: represents the source register 2!
•reg_dest: represents the destination register!
•shift: is used in shift operations on registers!
•funct: specifies the type of the operation within its class!
With these fields we can describe the following formats:!
R-type instructions: have one or two registers as operands and produce the result in a
third register.!
“D” prefix usually denotes an integer
instruction, while “F” is used for floating point.
In the symbolic notation, the first register is
the destination register (R1, R5).!
I-type instructions: use an immediate as operand (an integer in our case)!
di 1 110
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Anteprima parziale del testo

Scarica Cache Memory Optimization Techniques: A Comprehensive Guide - Prof. Ferretti e più Appunti in PDF di Architettura Dei Calcolatori solo su Docsity!

Microarchitecture : the internal structure of a processor, and its datapath : namely, the path where instructions go through when executed. ISA ( I nstruction S et A rchitecture): is the set of machine instructions of a processor. Two distinct processors can have the same ISA but different microarchitectures (that is, two different ways to execute those instructions). The simple RISC microarchitecture that we consider, executes fixed-length 32 bit instructions. We shall consider the “integer” section of the architecture only: instructions operate on integer registers, memory and PC. We shall cover mainly the datapath of the CPU, with only some hints to the Control Unit (CU) : is the section that control and synchronises the different datapath blocks during the instruction execution. The two main features of a modern RISC machine are:

- machine instructions are simple - as a consequence, the control unit is simple too, and there is no need for a complex microprogram to steer (guidare) machine instruction execution within the CPU. The architecture has, at least, 32 general purpose integer registers, each of 32 bits. In MIPS, register R0 is special and always stores 0 (this also in 64 bits architectures). Since we don’t consider floating point operations, the architecture we describe has neither floating point registers nor functional units to process floating point data. A generic MIPS instruction has the following format: - op: represents the class of the operation - reg_1: represents the source register 1 - reg_2: represents the source register 2 - reg_dest: represents the destination register - shift: is used in shift operations on registers - funct: specifies the type of the operation within its class With these fields we can describe the following formats: R-type instructions : have one or two registers as operands and produce the result in a third register. “D” prefix usually denotes an integer instruction, while “F” is used for floating point. In the symbolic notation, the first register is the destination register (R1, R5). I-type instructions : use an immediate as operand (an integer in our case)

I-type format can also be used for load/store instructions. The final format includes: Branch instructions (conditional) Jump instructions (unconditional) MIPS instructions execution is similar for any type of instruction (this is true for all RISC architectures). The first two steps are actually (in realtà) always identical in any instruction, because:

  1. the PC is used to fetch from Instruction Memory the instruction to be executed (Instruction Fetch, IF)
  2. instruction decoding (ID) and reading one or two registers, using the proper instruction fields to select the correct register(s). After that, the subsequent actions depends on the instruction type, which can be:

- memory access

- arithmetical-logical operation

- branch/jump

All the instructions, except jump , uses the ALU ( A rithmetic L ogic U nit). Instructions are completed in different modes:

- load and store instructions access the data memory, and load updates a register;

- arithmetical-logical instructions update a register ( without access the data memory);

- jump/branch instructions change the PC value.

Here is a high level single cycle sketch of MIPS datapath. Note the separate memory units for instructions and for data.

Write operations into the register file are controlled by a specific signal, but read operations are “immediate”: at any time, the register file outputs on SRC1data and SRC2data the content of registers addressed by inputs SRC1addr and SRC2addr. To set up a CU in MIPS it’s necessary to define the control signals for the ALU, that receives two inputs and transform them into an output according to four control signals. As an instance: Control signals for the ALU can be generated by a simple ALU control sub- unit (which is a part of the CU) that receives in input:

- the “ funct ” field of the executing

instruction;

- two control bits “ALUop” from the CU,

that depends on the “op” field of the instruction, and establish if the operation to be carried out is a sum, a subtraction or other. ALUcontrol is the logic circuit that realises the truth table which maps its input bits (composed of ALUop + funct bits) into the outputs: the four ALU control bits. The two most significant bits of the “funct” field are not used. The design of the main CU follows the steps outlined for ALU control. The main CU has in input the 6 bits of the “op” field and has to output control signals for:

- enabling registers write ( RegWrite )

- controlling data memory for read and write ( MemRead and MemWrite )

- setting the muxes

- controlling the ALU ( ALUop , the two signals just discussed)

The CU is simply a combinational circuit , actually a truth table, with inputs from the 6 bits of the “op” field of each instruction, and 9 outputs (e.g. ALUop), which are the control signals in the MIPS datapath. As an instance, let us track the execution of an R-type instruction.

  1. the PC content is used to address the Instruction Memory which outputs the correct instruction to be executed
  2. the “op” field is sent to the CU, and fields reg_1 and reg_2 are used to address the register file ( note that at this stage the datapath has no notion of the instruction type)
  3. The CU produces 9 control signals for an R-type instruction, specifically ALUop=10 ; these, once input to ALUcontrol with the “funct” field, set the actual R-type operation to be carried out by the ALU
  4. meanwhile, the register file outputs the values of reg_1 and reg_2 , as signal ALUsrc= selects the second input to the ALU from the second output of the register file
  1. the ALU outputs the result from the computation, which is forwarded to the register file according to the signal MemtoReg.
  • All these steps can be carried out within the same clock cycle, provided that the clock cycle is longer than the cumulative signal delay through all functional units involved. Up to now (finora), state elements involved in the execution have not changed their state (they have not stored new values). They just behaved as combinational elements, delivering as outputs the values at their inputs, with no delay.
  1. at this point, the value available at register file input WriteData has to be brought into the register addressed with the instruction field reg_dest , and the actual store happens at the proper (corretta) clock transition, according the flip-flop type.
  • note that control signal RegWrite is asserted to enable the write into the destination register of the register file A MULTICYCLE VERSION OF MIPS Single cycle datapath can work correctly, but it is not used in current implementations because of their pour efficiency. Different instructions take a different amount of time to be executed, according to the required operations within the datapath. The clock cycle must be chosen once for all, and its duration must accomodate for the longest instruction: this causes a waste in all instructions that execute in a shorter time. Which are the design criteria for a modern multi cycle processor? First of all, the designer breaks instruction execution down into a set of steps, each of them deemed (ritenuto) executable in a single clock cycle. It is highly advisable (consigliabile) that each step can be carried out in roughly (circa) the same amount of time. Indeed, if a step is longer than the others, the clock cycle must match the longest. Each stage can host at most a single operation on each functional unit. If the CPU hosts a single ALU, it cannot be used in the same time both to increment the PC and to add two registers. Here is the complete datapath of the multi cycle MIPS. Now we comment its operation at each step of the execution of the considered instructions.

a) I-type instructions or memory access (load/store)

  • ALUout <— A + IR[15-0]
  • the ALU adds the content of the temporary register A and the immediate value b) R-type instructions (register-register)
  • ALUout <— A op B
  • the ALU executes the specified operation on the contents of temporary registers A and B c) Conditional branch
  • if(A==B) PC <— ALUoutput
  • the ALU compares the two source registers, and signal Zero, if asserted, has the content of ALUout stored in the PC. d) Unconditional branch (jump)
  • PC <— jump address
  • Note that in a taken branch , the PC is written twice: once during the IF phase, then it is overwritten during the EX phase. Fourth step: Memory access(MEM/WriteReg) a) load/store
  • MDR (Memory Data Register) <— memory[ALUout] (load)
  • memory[ALUout] <— B (store) b) arithmetic/logical instruction (I or R-type)
  • reg[IR[15-11]] <— ALUout In MIPS architecture datapath, there are two memories : one for the instructions accessed during IF, and another one for the data, accessed during “MEMory access”. They could also be realised as a single memory, since the two memories are accessed in different phase of instruction execution: this is the well known principle of operation of modern computers in which the RAM stores both data and instructions. However, when we consider instruction pipelining, it will be clear that both memories are accessed in the same clock cycle, because of the two instructions that are both executing in different phases: were they are not distinct, the concurrent access would be impossible. Indeed, in MIPS datapath, as well as in any other modern CPU , the Instruction Memory and the Data Memory are two distinct memories. These memories are actually first-level caches ; the first level cache is split into I-cache and D-cache, with separate addressing and data lines. This double memory, located within the CPU, works at the same speed as the CPU, so it does not delay instructions execution.

Fifth step: Write Back Register (WB/REG)

- reg[IR[20-16]] <— MDR(Memory Data Register, contains momentarily data from/to CPU) - The load operation is completed by moving the MDR content into the destination register specified in the instruction. During this phase, the CU asserts RegWrite (WE) signal of register file to allow writing of destination register's bits IR[20-16]. In this implementation of MIPS, a branch takes 3 clock cycle, an arithmetic/logical I-type, R-type or store takes 4 and a load takes 5. How does the CU change in a multi-cycle version of MIPS? For sure, it is more complex, because it has to specify which signals have to be asserted in each step, and which is the next step. Each step is described by a truth table whose inputs are: - the type of the instruction being executed (the ‘ op ’ field) - the current step in the sequence describing the instruction execution the output of the truth table at each step consists of: - the set of signals to be asserted - the next step in the sequence This is just an informal description of a Moore machine , which is a type of finite state automation: - each state has an output that only depends on the state - the transition to the next state depends only on the current state and on the input. What is the difference between a datapath controlled by a finite state machine and another controlled by a microprogram? None, really. Microprogramming applies a symbolic representation of control based on instructions, to describe CU operation: microinstructions executed on a simple microprocessor. A microprogram is nothing more than a textual representation of Moore finite state machine, with each microinstruction corresponding to a state in the machine. So, why having a double representation (finite state operation and microprogramming) for the CU operation? It’s only a matter (questione) of complexity of the CU, which actually depends on the number and richness of the ISA instructions. A real RISC architecture features many more instructions than we considered so far and some take various clock cycles to be executed. The control in these architectures is definitely much more complex and consequently the associated automaton will be more complex too. But, beyond (al di la) a certain complexity, the automaton representation is no longer a viable means (non è più un mezzo praticabile). As we will see, CISC architectures usually feature hundreds of instructions, some of them really complex since they combine arithmetic/logic operations with memory access. The number of steps to execute these instructions is very high, resulting in a finite state automaton with thousands of states and hundred of state sequences for many instructions. Microprogramming was the natural choice for architectures in the 60s and 70s; the trend was designing ISA with a very rich set of very complex and “powerful” instructions. The basic idea of microprogramming is to introduce a further (ulteriore) layer between the ISA level and instruction execution, decomposing instructions into finer steps: the microinstructions.

  • in principle,^ each phase of a given instruction can be executed in parallel to a^ different phase of another instruction : this is pipelining. If pipeline is split into 5 phases, and a clock cycle (e.g 2 ns) is required to go from one phase to the other, an instruction is executed in 10 nanoseconds. But if pipelining is exploited (sfruttata) at the maximum level, every 2 ns a new instruction can be launched, and every 2 ns an instruction completes execution. Actually, this is only the theoretical case, since there is a chance that the pipeline gets “stalled”. A pipelined architecture is slightly more complex (and thus slower) than a non- pipelined one. Pipelining is the technique that best suites (che meglio si adatta) RISC architectures. The processor name “MIPS” stand for Microprocessor without Interlocked Pipelines Stages , just to highlight an architecture with few dependencies within instructions that allows to exploit as much as possible the parallelism inherently embedded in the instructions (ILP).

Pipelining basics

MIPS simplified architecture can be realised by having each instruction executed in a single clock cycle, approximately long as the 5 clock cycles required to complete the 5 phases. Why would this approach be inconvenient? We already know one reason: the longer cycle would waste time in all instructions that take less to execute. There is another relevant reason: by breaking down into more clock cycles, it is possible to overlap (sovrapporsi) the execution of an instruction with other instructions. At each clock cycle, while a section of the datapath takes care of an instruction, another section can be used to execute another instruction. If we start a new instruction at each new clock cycle, each of the 5 phases of the multi- cycle MIPS architecture becomes a stage in the pipeline.

Pipelining only works if one does not attempt to execute at the same time two different operations that use the same datapath resources. Using reduced instructions makes it fairly (abbastanza) easy to determine at each time which datapath resources are free and which are busy. This is very important to best exploit (sfruttare al meglio) CPU resources. Why are phases WB and ID highlighted in clock cycle 5? Let instruction i be a load, and i+3 be an R-type. In cycle 5 the result from instruction i is being written in the register file and the operands for instruction i+3 are being read from the same register file. Well, it looks like we are trying to use the same resource in the same clock cycle for two different instructions… Actually, this is allowed at those functional units that can be used twice during different phases of the same clock cycle. In the following figure depicting the execution pattern of a load instruction, each phase is associated to the unit it use: the grey part shows that the unit is not used in that portion of the clock cycle: The register file is written in WB in the first half of the clock cycle, and it is read during ID in the second half of the cc. The MIPS pipeline can be thought as a series of datapaths shifted in time, each one for each instruction being executed. This pipeline drawing calls (richiede) for two observations:

  1. it is mandatory that there exist distinct memory units (caches) for data (DM) and instructions (IM); this prevents conflicts between IF and MEM phases. Both phases access memory, that is used 5 time more than with no pipelining. The memory subsystem must be capable of handling the increased workload.
  2. the drawing does not show the PC, that is incremented at each clock cycle in the IF phase. In actual implementations, each pipeline stage is separate and connected to the following one by special pipeline registers. At the end of each clock cycle, the results of the operations in a stage are stored in a pipeline register that will be used as a source for the next stage in the next cc. These pipeline registers also buffer intermediate results to be used by a non-adjacent stages of the pipeline. The pipeline registers have the same role of the internal registers introduced to transform the single-cycle MIPS architecture into the multi-cycle version: IR, A, B, ALUout, MDR. They serve the purpose to transferring outputs produced in a phase to the subsequent phase in the multi-cycle implementation.

IM ALU DM

IF ID EX MEM WB CC1 CC2 CC3 CC4 CC RegFile (read) RegFile (write)

Instruction Decode : the IF/ID register is read to address the register file. Both addressed registers are read, even if should only one be actually used later. The 16 bits of the immediate operand are converted into a 32 bits and the three data are stored with the PC in ID/EX. EXecution : the “load” reads in ID/EX the content of register 1 and the immediate, sums them using the ALU and writes the result into EX/MEM. If the execution is a branch or a jump, the adder uses the PC value (available on ID/EX) to compute the new PC value (it is be used only if the branch is taken). MEMory : the data memory is accessed, using the value available in EX/MEM as address. The data is stored into MEM/WB. Write Back : the load destination register is written with the data read from memory Pipelining is not simple as it appears so far (finora): in this datapath, when an instruction reaches (raggiunge) the WB stage, the IF/ID register already contains the id of the destination register of a successive instruction. To avoid (evitare) loading the data into the wrong register, the load instruction cannot simply store the id of its destination register in IF/ID, because it would be overwritten at the next clock by a new instruction in its IF phase. In the various execution steps of the LOAD, the id of the destination register must be transferred from IF/ID to ID/EX, to EX/MEM and eventually to MEM/WB, to be used to address the correct register during WB.

Here is a correct datapath to handle (gestire) the load: the destination register id flows through all pipeline registers to be available during WB. The pipeline registers must be extended to store this value as well. PERFORMANCE The pipeline makes the complete execution of an instruction longer than its counterpart (controparte) in a not pipelined datapath. But the CPU throughput (portata) increases, so programs execute faster. Let us consider a CPU with no pipeline and the following characteristic:

- ALU and branch operations take 4 clock cycles

- Memory operations take 5 clock cycles

- ALU op = 40%; branch = 20%; memory access = 40%

- clock = 1ns

What is the average execution time for an instruction? Avg. exec time = (0.4 + 0.2) • 4ns + 0.4 • 5ns = 4.4 ns. Let us now assume that the CPU is pipelined, and that the overhead (sovraccarico) caused by the hardware for pipelining is 0.2ns. Then, speedup = avg. execution time without pipelining / avg. execution time with pipeline = 4.4ns / 1.2ns = 3.7. PIPELINING HAZARDS Unfortunately, pipelining is not that simple. There are three types of problems ( hazards ) that limit the effectiveness (efficacia) of pipelining:

  1. Structural hazards : conflicts due to datapath resources , they arise when a specific combination of instructions cannot be executed simultaneously in the pipeline.
  2. Data hazards : conflicts due to a data dependency , they arise when an instruction depends on the result, not yet available, of a previous one.
  3. Control hazards : due to pipelined branch execution, that can change the PC and instruction flow. When an hazard arises, it is necessary to stall the pipeline: some instructions can proceed while others are delayed. We can assume that when an instruction IS causes an hazard in the pipeline:

- instructions issued earlier than IS can proceed to their commit;

- instructions issued later than IS are in a stall phase.

Let us consider some basic solutions for the three types of hazards. Usually, structural hazards arise because some hardware resources within the datapath cannot be duplicated, and are requested at the same time by two different instructions in the pipeline. As an instance, a single L1 cache for data and instructions would continuously cause structural hazards, and this is why L1 caches are separate. Another hazard arises if two instructions cannot use the same ALU during the same clock cycle.

pipeline. The pipeline circuitry detects this situation and stalls subsequent instructions, for a single cc in the best case, until the value they require is available. The hazards detection unit , checks for producer-consumers dependencies that cannot be solved through forwarding. It stalls the pipeline (IF and ID phases) and produces a “bubble” (a NOP with proper control signals). Control hazards arise when a branch is executed , since it can either change the PC value or leave it unaffected. Even assuming an aggressive implementation which uses two clock cycle for the branch, if the branch is taken, the PC is not updated until the end of the second clock cycle, in the ID stage, after the address to be stored in the PC is actually computed. Thus, the instruction that is located immediately after the branch (at the address PC+4) has already completed the IF phase. Let us consider the following example: LD R1, 0(R4) BNE R0, R1, else DADD R1, R1, R JMP next else: DSUB R1, R1, R next: OR R4, R5, R When the branch decision will be know, the DADD has already completed its IF phase. A simple approach is to carry out the fetch phase of the instruction that follows the branch. At the end of the ID phase of the branch, it is known if the branch will be taken or not. If not, everything is ok and the DADD proceeds in its ID phase. If the branch is taken, the instruction to be issued (da rilasciare) is DSUB, which starts with its IF phase: so, a clock cycle is lost for the IF phase of the DADD. Obviously there is a waste in clock cycles, and the amount lost depends on the frequency of branches in a program and of the success (or fail) of each specific branch. In the example, the waste due to a branch is one clock cycle at most, since we assume that the datapath is able to complete a branch in two clock cycles. More complex branch instructions can require more clock cycles and the waste can be larger. Control hazards involve the management of three different actions: instruction decoding (D), next PC address computation (A) and condition evaluation (C). Modern processors have superscalar pipelines (with up to 14 stages). Some statistics: jump amount to 2%-8% in integer benchmarks, branch amount to 11%-17%. In loops, 90% of branches are taken and in generic IF 53% are taken, of these 75% are forward. A different approach is to make an a-priori prediction on the outcome of the branch. This is the so-called static branch prediction. As an instance, the pipeline hardware might make the following assumptions :

  1. Backward branches are always taken
  2. Forward branches are never taken and continue fetching the instruction following the branch in either case (in ogni caso).

However, if the prediction turns out to be wrong, the instruction issued “by mistake” must be turned into a no-op, and it is necessary to fetch the correct instruction. Obviously, if most predictions are correct, the waste is minor. As an instance, in a loop executed many times, the backward jump is executed most times, and the forward jump is executed only once, when the loop exits. Forward jumps are usually used for exceptions, to transfer control to the associated routine. Hopefully, exceptions should be rare. This kind of prediction best suites (si adatta meglio) the simple if then else construct. Another technique, common in the first RISC architectures, is called delayed branch. It consist of placing, right after the branch, instructions that do useful work , independently of the outcome of the branch. The instructions are executed throughout, and the branch is evaluated and acts according on the PC. This technique requires action on the compiler side, and cannot be easily applied in all cases. The branch delay slot is the set of instructions that are “conditionally” fetched and sent to the pipeline stages. Scheduling the branch delay slot is not easy, and the probability for the compiler to find “good” instructions to be placed in the delay slot rapidly decreases with the slot length. Let us assume that the branch delay slot is 1-instruction wide (ampio). Case (a) is easily handled by the compiler, but as to the others… (b) is possible ONLY if the assignments in the delay slot cause no harm : registers assigned to in the delay slot are not read before they are assigned again. if R1==0 then go to label DSUB R4, R5, R INSTR A (does not read R4) INSTR B (does not read R4) … ADD R4, R7, R8 OK | SUB R5, R6, R4 WRONG The last execution of DSUB is “wrong” but it is wiped out (cancellata) by the ADD. The SUB instead (invece) would read a wrong value. (c) is possible ONLY if the assignments in the delay slot cause no harm : registers assigned to in the delay slot are not read before they are assigned again. OK DSUB R4, R5, R ADD R7, R8, R WRONG DSUB R4, R5, R SUB R8, R7, R Interrupts, traps, faults, other exceptions that alter the flow of instructions make the operation of a pipeline very difficult to manage, since instructions are overlapped

It is possible to concurrently fetch two instructions from Instruction Memory. The two instructions, issued (rilasciate) together, do not conflict in accessing the registers and they do not depend on each other. There will be a further (ulteriore) gain in computation. Of course, even in this architecture, hazards must be minimised either at compile time or at run-time. Pipeline u could execute any instruction, while pipeline v could handle only simple integer- type instructions. Instructions are executed “ in-order ”, that is in the order specified by the program and a few fixed rules establish if the two instructions are “compatible”, so that they can be executed in parallel. If not, only the first instruction is issued, and a coupling is attempted between the second and the third, and so on… Of course, one can think of multiple (> 2) pipelines operating in parallel, but modern architectures have taken a different route, introducing more functional units in the EX stage. Actually, in a CPU executing a fairly (abbastanza) complete set of instructions, some of these have an EX phase much longer than the other phases: add/sub of floating point numbers, multiply/division of integer numbers and multiply/division of floating point numbers. It is possible to carry out these operations in a single, very long clock cycle, but this would slow down uselessly (inutilmente) the other phases, which can do with a much shorter clock cycle. The EX phase can use a short clock when it carries out an integer operation (add/sub), a logical operation (AND, OR, XOR) or a register comparison. The best approach is:

  1. using a short clock cycle, that suites phases IF, ID, MEM, WB and EX as well, when it executes a simple integer instruction
  2. using functional units working with more clock cycles or themselves pipelined for longer operations, that need more time to execute.

This is the pipeline with multiple functional units for the MIPS architecture: The previous drawing depicts fairly well the high level operation of modern architectures. It highlights some properties shared by all modern CPUs:

  1. the length of the pipeline depends on the type of the instruction in execution, with more complex instructions requiring more clock cycles
  2. multiple instructions can be concurrently in their EX phase. In the case just considered, up to 4 floating point sum ops, and 7 integer of FP multiplications, all of them active. Technical remark: in many case, the division functional unit operates in more phases, but it is not pipelined. Pipelining partially overlaps instructions execution, thus leveraging (sfruttando così) on the potential parallelism embedded in the instructions. This type of parallelism is named Instruction Level Parallelism ( ILP ).
  • (^) Static ILP places on the compiler the task of finding instructions that can be “overlapped” - Dynamic ILP places on the hardware all of the effort to extract parallelism from any POE (Plane of Execution). The actual amount of parallelism embedded in the instructions of a program that can be exploited depends on the pipelining issues examined before. There are three types of conflicts: - structural conflicts : due to limited number of available functional units - data conflicts : due to the fact that an instruction has to wait for the outcome of another one, and the two instructions cannot proceed in parallel - control conflicts : due to the fact that as long as the outcome of a branch is unknown, so is the next instruction to be executed. Let us start discussing dynamic ILP by better formalising the notion of dependence among instructions , which is the primary effect in limiting the exploitation (sfruttamento) of the parallelism embedded in the instructions of a program. This discussion will be useful even when we will cover static ILP , where it is the compiler (sw) that has the task of understanding which instructions can be executed in parallel, being independent of one another, and which cannot. In dynamic ILP, is the processor (hw) that must discover possible dependences among instructions, and must be capable of handling them.