🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #645

Re: vector length CSR?

#645
From: Terje Mathisen
Date: Wed, 11 Nov 2026 13:56
96 lines
4253 bytes
MitchAlsup wrote:
> Terje Mathisen <terje.mathisen@tmsw.no> posted:
> 
>> MitchAlsup wrote:
>>> Robert Finch <robfi680@gmail.com> posted:
>>>
>>>> On 2026-11-08 11:37 p.m., Lawrence D’Oliveiro wrote:
>>>>> On Sun, 8 Nov 2026 23:11:46 -0500, Robert Finch wrote:
>>>>>
>>>>>> On 2026-11-08 7:01 p.m., Lawrence D’Oliveiro wrote:
>>>>>>>
>>>>>>> The RISC-V designers quite rightly criticize this combinatorial
>>>>>>> explosion of instruction variants as going completely against the
>>>>>>> whole idea of a *reduced* instruction set computer (which is what
>>>>>>> “RISC” is supposed to stand for).
>>>>>>
>>>>>> It is partly a representation issue. IDK how it would be avoided,
>>>>>> scratched my head over this one.
>>>>>
>>>>> I think they do it by specifying the data type of the operands in
>>>>> another control register.
>>>>
>>>> I went with the hoards of instructions approach. But the size of the
>>>> operand is specified in a config register.
>>>
>>> How would you vectorize:
>>>
>>>         LOOP on i
>>>         {
>>>              DoubleWord[i] = WORD[i] × HalfWord[i] + Byte[i+2];
>>>         }
>>>
>>
>> Relatively easy:
>>
>>
>> Unroll by 16:
>>
>>      load 4 W entries into ymm0
>>      load 4 W entries into ymm1
>>      load 4 W entries into ymm2
>>      load 4 W entries into ymm3
>>
>>      load 8 HW entries into ymm4
>>      load 8 HW entries into ymm5
>>
>>      load 16 B entries into ymm6
>>
>> //
>>      expand low half of ymm4 into ymm7
>>      expand high half of ymm4 in place
>>
>> // Ditto for ymm5/ymm8
>>
>> //
>> //   expand ymm6 into ymm9, ymm6, then both of these into two more regs.
> 
> 
> See you did get my point--at least part of it.

Oh, I most certainly "got" it. :-)

When the data inputs don't fit inside the "one size fits everything", 
then SIMD becomes much more convoluted.

> 
> Now constrain i to the range{1..14} and try again.

If we only have 14 operations, then it becomes like the final iteration 
of a 16-wide unrolled loop where you have to play some tricks to avoid 
accessing invalid memory addresses, mask away the unused slots and use a 
masked write to store the results back. This is of course even more 
convoluted than the regular iteration!

OTOH, with just 14 iterations, this is by definition not a time-critical 
operation.

Instead, it is almost tailor-made for Mill with masked operations, None 
elements that don't get stored etc.

Terje

-- 
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"
Technical Details
Message-ID: <11d1s60$3309s$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11cpqih$acf5$1@dont-email.me> <11cr2g5$q796$2@dont-email.me> <11crh64$ug0s$1@dont-email.me> <11crili$ur2d$1@dont-email.me> <11crrs5$118ll$1@dont-email.me> <1794339152-5857@newsgrouper.org> <11d037b$2hgkl$1@dont-email.me> <1794357377-5857@newsgrouper.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Terje Mathisen <terje.mathisen@tmsw.no>
Newsgroups: comp.arch
Subject: Re: vector length CSR?
Date: Wed, 11 Nov 2026 14:56:17 +0100
Organization: A noiseless patient Spider
Lines: 96
Message-ID: <11d1s60$3309s$1@dont-email.me>
References: <11cpqih$acf5$1@dont-email.me> <11cr2g5$q796$2@dont-email.me>
 <11crh64$ug0s$1@dont-email.me> <11crili$ur2d$1@dont-email.me>
 <11crrs5$118ll$1@dont-email.me> <1794339152-5857@newsgrouper.org>
 <11d037b$2hgkl$1@dont-email.me> <1794357377-5857@newsgrouper.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Date: Wed, 11 Nov 2026 13:56:17 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3244348"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/A1eGbE637+fHitBm0+h7Bja7qhCB661aP/EIx91Q3Rw=="; posting-host="44ebd6016bcf3ecf1773b41602864f91"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101
 Firefox/140.0 SeaMonkey/2.53.24
Cancel-Lock: sha1:PhuKS1J6Sh4A8oznOr4fEs05VIs= sha256:iy+S+c3HJIl7194+tsRtgQ9z9FUt2nNkySTIJz/UWw8=
	sha1:zf8S+nV2F6DhrzTw03uufGjG4oc= sha256:dUjFBa4P3qSmmcnQRm7kd2aoOZPC1c5WNUDRQB8cD9o=
In-Reply-To: <1794357377-5857@newsgrouper.org>