3 ms·
> fetch an entire cacheline of instructions at once And how many instructions fit into it? Are you going to feed an 8-wide decoder with a single 64B cacheline
by dmitrygr 4y ago
> fetch an entire cacheline of instructions at once
And how many instructions fit into it? Are you going to feed an 8-wide decoder with a single 64B cacheline? Especially with no promises that any instruction starts or ends on that boundary?
> It's actually hard to come up with x86 instructions that are 15 bytes long.
Something as simple and trivial as loading a 64-bit immediate into a register is a 10-byte instruction in x86...
So for you to feed an 8-wide decoder even with such simple things as that, you're already at TWO cache lines ingested per cycle (80 bytes)... good luck with that...
I hear intel is hiring. Their current top of the line decoder is IIRC 5-wide. I am sure they’d like to hear your ideas as to how easy it is to decode x86 8-way
- jcranmer 4y ago> Something as simple and trivial as loading a 64-bit immediate into a register is a 10-byte instruction in x86... It will only take a 10 byte instruction if you can't zero- or sign-extend from a 32-bit immediate. Of course, if you were on ARM or most RISC processors, such an immediate likely requires at least two instructions anyways. From paging through an objdump output of a large program, I'd hazard that average instruction size is about 4 bytes, maybe a touch shy of that. After all, instructions like "add rax, rbx" is going to be 3 bytes (two if you're only using 32-bit registers!). > Their current top of the line decoder is IIRC 5-wide. Looking at wikichip for the block diagram [1], that's 5 instructions per 16-byte window. [1] https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(client) https://en.wikichip.org/wiki/intel/microarchitectures/skylak...
- dmitrygr 4y agoDid you even read what you linked to? This is atrocious decoding performance compared to arbitrarily wide aarch64 “ As with previous microarchitectures, the pre-decoder has a throughput of 6 macro-ops per cycle or until all 16 bytes are consumed, whichever happens first. Note that the predecoder will not load a new 16-byte block until the previous block has been fully exhausted. For example, suppose a new chunk was loaded, resulting in 7 instructions. In the first cycle, 6 instructions will be processed and a whole second cycle will be wasted for that last instruction. This will produce the much lower throughput of 3.5 instructions per cycle which is considerably less than optimal. Likewise, if the 16-byte block resulted in just 4 instructions with 1 byte of the 5th instruction received, the first 4 instructions will be processed in the first cycle and a second cycle will be required for the last instruction. This will produce an average throughput of 2.5 instructions per cycle. “