[Libre-soc-isa] [Bug 908] indexed remap needs defined behavior for out-of-bounds indexes

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Aug 15 00:50:26 BST 2022


https://bugs.libre-soc.org/show_bug.cgi?id=908

--- Comment #2 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #1)
> (In reply to Jacob Lifshay from comment #0)
> > we need indexed move to have *defined* behavior, imho out-of-bounds being
> > undefined behavior is unacceptable:
> 
> briefly, more tomorrow i lost a reply: yes it is.
> the cost in hardware is too great.
> 
> Indexed REMAP goes literally in the Issue Phase.
> any gates added there can damage performance.

you don't have to do the comparisons in instruction issue...
for reads, they can be done in the alu or register read or operand forwarding
stages, all you need is to and the value with 0/-1 as appropriate for the
index<VL comparison.
for writes, they can be merged into the predicate mask at any stage before
forwarding outputs to succeeding operations or writing to output registers.

also, even if you did do the comparisons in instruction issue, the comparisons
can be done simultaneously to instruction decode/issue, the results aren't
needed to decode the instruction. the comparison results can be ignored if it's
not an indexed op, so the comparison logic can be built to assume it is an
indexed op and the invalid results will be ignored when the assumption is
wrong.

> i specifically designed it so that the implementor
> may cache the Indices then completely ignore normal
> Register Hazards, safe that the programmer knows
> what to expect and what not to do.
> 
> wasm swizxle, good for them, not relevant. swizzle
> is static, this is dynamic.

you missed what I stated, wasm's i8x16.swizzle *is* a *dynamic* shuffle and
requires out-of-bounds accesses to return zero. i8x16.swizzle is how they spell
dynamic 8-bit element-sized shuffle.

they're very likely to not be the only place dynamic shuffles are required to
have defined behavior...

> pwrfectly valid for programmer to set very first
> Index to MAXVL-1.  loop goes round, last one has
> VL<MAXVL, urk, the damn thing breaks expectations,
> the indices get silently maxed??
> 
> no.

no, the out-of-bound index change the register read to explicitly return zero.

> 
> Traps are the worst thing to do as well, those require
> Shadow Matrix Entries.  a hot-loop triggers Traps?

yes, hence why I left that as an alternative rather than my preferred choice.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Libre-SOC-ISA mailing list