Liste des Groupes | Revenir à c arch |
On 9/19/24 11:07 AM, EricP wrote:I guess it might be interesting if one made a bigger multiplier out of 4-bit multipliers, in a way similar to a 4-bit shift-add.
[snip]If the multiplier is pipelined with a latency of 5 and throughput of 1,I do not remember how multipliers are actually implemented — and
then MULL takes 5 cycles and MULL,MULH takes 6.
>
But those two multiplies still are tossing away 50% of their work.
am not motivated to refresh my memory at the moment — but I
thought a multiply low would not need to generate the upper bits,
so I do not understand where your "50% of their work" is coming
from.
The high result needs the low result carry-out but not the rest of
the result. (An approximate multiply high for multiply by
reciprocal might be useful, avoiding the low result work. There
might also be ways that a multiplier could be configured to also
provide bit mixing similar to middle result for generating a
hash?)
I seem to recall a PowerPC implementation did semi-pipelined 32-On an FPGA, one could almost argue for doing everything with an unsigned 16*16->32 bit multiplier and some helper instructions.
bit multiplication 16-bits at a time. This presumably saved area
and power while also facilitating early out for small
multiplicands, at the cost of some latency and substantial
throughput compared to a fully pipelined multiplication. If I
remember correctly, this produced a result for 16-bit by 32-bit
multiplication, which is different from generating a low or high
result.
Yes, it would be preferable.And if it does fuse them then the internal uArch cost is the same as ifNeither is increasing the number of opcodes or providing extender
you had designed it optimally from the start, except now you have
to pay for a fuser.
>
<sound of soap box being dragged out>
This idea that macro-op fusion is some magic solution is bullshit.
1) It's not free.
prefixes. If one wants binary compatibility, non-fusing
implementations would work.
(I tend to favor providing a translation layer between software
distribution format and instruction cache format, which reduces
the binary compatibility constraint.)
Yeah...2) It only works where Decode can see *all* the required lookaheadMost fusion is for two adjacent instructions, which significantly
instructions, which means you have to pay for an N-lane decoder
but only get 1 lane.
limits the complexity. The fusable patterns are also a subset of
all pairs of two instructions, so complete two-way decoding may
not be needed.
There may also be optimization opportunities from looking ahead.
Mitch Alsup proposed such for branch handling in a scalar
implementation. Apart from fusion, there might be advantages for
avoiding bank conflicts in a banked register file. I.e., the cost
of lookahead might be shared by multiple techniques/optimizations.
I tend to agree that fusion tends to be a workaround for sub-
optimal instruction encoding, but it seems that encoding involves
a lot of tradeoffs.
Superscalar is easier, as here one merely needs to categorize the instruction with feature flags (such as which lanes it is allowed in), and check for register dependencies.3) It's probabilistic as it depends on how the fetch buffers get loaded.This is also somewhat true for variable length encodings that cross fetch boundaries. In general a boundary-crossing instruction
Eg if the fetch buffer contains a valid instruction but does not have
a next instruction, do you stall Decode to see if a fuser might arrive
or dispatch it anyway.
would probably stall even if such was not strictly necessary
(e.g., if the missing information is opcode refinement — not
related to instruction routing — or an immediate or even a
register source identifier specifying a value that can have
delayed use (e.g., value of a store, addend of a FMADD).
This does seem a weakness, but fusion is not entirely negative
factors.
4) It gets exponentially expensive if you start doing multiple instructionThis is also a factor in mere superscalar decode/execute.
lanes because decode has to deal with all the permutations of
fusion possibilities.
Detecting that an instruction is dependent on another would
normally stall the execution of that instruction.
(I feel that encoding some of the dependency information could
be useful to avoid some of this work. In theory, common
dependency detection could also be more broadly useful; e.g.,
operand availability detection and execution/operand routing.)
IMHO:5) Any fused instructions leave (multiple) bubbles that should beEven with reduced operations per cycle, fusion could still provide
compacted out or there wasn't much point to doing the fusion.
a net energy benefit.
In my opinion it is better to have an ISA that is optimal by designFusion is mostly presented for "patching up", but there are also
rather than being patched up by fusion later.
considerations of diverse microarchitectures. With pre-fused
instructions, an implementation might need to crack some of those
instructions. Software optimized for such an implementation might
also prefer more flexible compile-time scheduling of pre-cracked
operations.
A load-op instruction is perhaps particularly difficult because
one needs frequent stalls, a skewed (or second chance) pipeline to
hide the load latency, out-of-order execution, or some other stall
avoidance mechanism.
There are also constraints in encoding granularity.
Some of this inefficiency is caused by clinging to now 40 year oldFMADD seems to have mostly killed the 2-source limit. AArch64's
risc design *guidelines* (ie not even rules) that:
- instructions have at most 1 dest and 2 source registers
paired load removes the 2 destination limit. (Paired destinations
were common for early double precision implementations.)
- register specifier fields are either source or dest, never bothThis seems mostly a code density consideration. I think using a
single name for both a source and a destination is not so
horrible, but I am not a hardware guy.
- instructions should take at most 1 clock (they never did)That was clearly overconstraining.
These self imposed design restrictions cause ISA designers to missI very much doubt a compiler would generate such outside of some
some possible more optimal solutions. The result is things like
RISC-V's memory reference linkage structures taking 6 instructions
to build a 64-bit PC-relative address. And I'm pretty sure we won't
see any 6 instruction fusers for quite some time.
real-time application where the time constancy might justify the
code bloat.
<sound of soap box being dragged back to cupboard>I do not mean my response to be heckling. Your points are very
true. However, I think fusion is a technique — like cracking —
that is a natural part of an architect's toolbox.
Les messages affichés proviennent d'usenet.