[Libre-soc-dev] SimdSignal scalar/vector switching and SimdShape.width
Jacob Lifshay
programmerjake at gmail.com
Thu Oct 28 04:26:12 BST 2021
Lkcl, in:
https://libre-soc.org/3d_gpu/architecture/dynamic_simd/shape/
you wrote:
> An alternative proposal to redefine "width" to be in terms of the
multiple options, i.e.
> context-dependent on the partition setting, is unworkable as it prevents
downcasting
> to e.g. Signal
That apparent unworkability is the result of still conflating two unrelated
things that coincidentally have the same value: overall simd width, and the
width of an element for elwid=64. In actuality, it works just fine for
SimdShape.width to be multi-valued, all that happens is the Signal
scalar/vector dispatch function is:
class SimdScope:
def Signal(self, shape=1, ...):
if self.scalar:
# scalar, so we use the element shape for elwid=64,
# *not* the full simd width
elwid = IntElWid.I64
s64 = SimdMap.extract_value(elwid, shape)
assert s64 is not None, f"shape has no value for elwid=64:
{shape}"
return Signal(s64, ...)
return SimdSignal(shape, ...)
We may need a different function than SimdMap.extract_value if SimdShape
doesn't work with it, but you get the idea, I hope.
Jacob
More information about the Libre-soc-dev
mailing list