🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

176 total messages Page 1 of 4 Started by Robert Finch Sun, 08 Nov 2026 12:39
Page 1 of 4 • 176 total messages
vector length CSR?
#583
Author: Robert Finch
Date: Sun, 08 Nov 2026 12:39
18 lines
1891 bytes
I tried asking the web-browser this and it returned a bunch of links to 
introduction to vectors.

Am I right in thinking that the vector length and element size are 
basically stable throughout an application? If so, they can be stored in 
a config register. Otherwise, if they need to be changeable on a dynamic 
basis they would have to be processed like a GPR with renaming etc. 
Updating a CSR is rather slow as updates do not take place until commit 
time.

ATM the config is just wired directly into the micro-op translate stage 
which would have really poor performance if things need to be modified 
on the fly.

I looked at the RISCV vector extension model and they have it just as a 
CSR. Makes me think that is an acceptable solution.

Re: vector length CSR?
#585
Author: George Neuner
Date: Sun, 08 Nov 2026 14:02
49 lines
2866 bytes
On Sun, 8 Nov 2026 07:39:44 -0500, Robert Finch <robfi680@gmail.com>
wrote:

>I tried asking the web-browser this and it returned a bunch of links to 
>introduction to vectors.
>
>Am I right in thinking that the vector length and element size are 
>basically stable throughout an application? 

Certainly not.

Element width may remain stable across many operations, but you can
expect that different widths may be needed at different times.

Vector lengths, however, often change frequently.


>If so, they can be stored in a config register. 

If you are referring to a separate (Cray style) vector processor, or
to a streaming unit, the width and length would be in setup registers
in any case.


>Otherwise, if they need to be changeable on a dynamic 
>basis they would have to be processed like a GPR with renaming etc. 
>Updating a CSR is rather slow as updates do not take place until commit 
>time.

You can't change the setup while the vector unit is operating anyway.
However, there is no reason changes can't be queued to happen as soon
as the unit is finished.


>ATM the config is just wired directly into the micro-op translate stage 
>which would have really poor performance if things need to be modified 
>on the fly.

"On the fly" meaning what?  You can't change the setup /while/ the
vector unit is in operation.

Needing to frequently change element widths and/or vector lengths is
the domain of the short-vector SIMD many chips now have.


>I looked at the RISCV vector extension model and they have it just as a 
>CSR. Makes me think that is an acceptable solution.

It is for the case where the vector unit is separate and asynchronous.
Re: vector length CSR?
#588
Author: Robert Finch
Date: Sun, 08 Nov 2026 15:03
88 lines
4765 bytes
On 2026-11-08 9:02 a.m., George Neuner wrote:
> On Sun, 8 Nov 2026 07:39:44 -0500, Robert Finch <robfi680@gmail.com>
> wrote:
> 
>> I tried asking the web-browser this and it returned a bunch of links to
>> introduction to vectors.
>>
>> Am I right in thinking that the vector length and element size are
>> basically stable throughout an application?
> 
> Certainly not.
>
Ugh.

> Element width may remain stable across many operations, but you can
> expect that different widths may be needed at different times.
> 
> Vector lengths, however, often change frequently.
> 
> 
>> If so, they can be stored in a config register.
> 
> If you are referring to a separate (Cray style) vector processor, or
> to a streaming unit, the width and length would be in setup registers
> in any case.
> 
> 
>> Otherwise, if they need to be changeable on a dynamic
>> basis they would have to be processed like a GPR with renaming etc.
>> Updating a CSR is rather slow as updates do not take place until commit
>> time.
> 
> You can't change the setup while the vector unit is operating anyway.
> However, there is no reason changes can't be queued to happen as soon
> as the unit is finished.
> 
> 
>> ATM the config is just wired directly into the micro-op translate stage
>> which would have really poor performance if things need to be modified
>> on the fly.
> 
> "On the fly" meaning what?  You can't change the setup /while/ the
> vector unit is in operation.
>


> Needing to frequently change element widths and/or vector lengths is
> the domain of the short-vector SIMD many chips now have.
> 
> 
>> I looked at the RISCV vector extension model and they have it just as a
>> CSR. Makes me think that is an acceptable solution.
> 
> It is for the case where the vector unit is separate and asynchronous.

I did not realize that was the use case for RISCV.


Brain dump design issues. Qupls is not going to have a separate 
asynchronous vector unit. Vectors are supported using the GPR register 
file by hiding the issuing of multiple instructions behind the scenes 
and relying on parallelism in the OoO design.

How vectors are supported in Qupls may need re-thinking. The vector 
length is being used to set the number of 64-bit registers needed to 
represent a vector at the micro-op encoding stage, before the register 
file is read. That cannot be done ff the length has to change 
frequently.  Using a fixed number of registers might be better. For 
frequent changes the config would end up being passed around as another 
operand to vector instructions. Making the core larger = slower.

It is a toss-up I think. Using a fixed number of registers will occupy 
more execution units, mean more micro-ops will be fetched and dispatched 
and slow things down. On the other hand waiting 20 cycles or so for the 
length changes to percolate through the pipeline is not fast either.

May have both static length settings and dynamic length settings then. 
Using the static setting to set a maximum before the app is running and 
using dynamic lengths while executing code. Static length would set the 
number of micro-ops needed per vector instruction. Dynamic length would 
set the vector masking.

Maybe too complex to understand, having two different length settings.

Vector masking could be used to control the vector length dynamically. 
Rather than change the vector length, change the masking.

Re: vector length CSR?
#592
Author: MitchAlsup
Date: Sun, 08 Nov 2026 18:20
33 lines
2147 bytes
Robert Finch <robfi680@gmail.com> posted:

> I tried asking the web-browser this and it returned a bunch of links to 
> introduction to vectors.
> 
> Am I right in thinking that the vector length and element size are 
> basically stable throughout an application?

Consider Gaussian Elimination, the length of the loop goes down 
by 1 every loop.

>                                             If so, they can be stored in 
> a config register. Otherwise, if they need to be changeable on a dynamic 
> basis they would have to be processed like a GPR with renaming etc. 

Get ready to change them every entry to top-of-loop.
Most CRAY-like vector units have a length-this-time register that
is decremented by vector-register-length every vector-iteration.
On the last iteration, it is used to create a mask of elements
that are not going to be calculated.

> Updating a CSR is rather slow as updates do not take place until commit 
> time.
> 
> ATM the config is just wired directly into the micro-op translate stage 
> which would have really poor performance if things need to be modified 
> on the fly.
> 
> I looked at the RISCV vector extension model and they have it just as a 
> CSR. Makes me think that is an acceptable solution.

It can be, so long as it performs decrement-by-vector-length all
by itself ... 
Re: vector length CSR?
#594
Author: Robert Finch
Date: Sun, 08 Nov 2026 18:59
44 lines
3067 bytes
On 2026-11-08 1:20 p.m., MitchAlsup wrote:
> Robert Finch <robfi680@gmail.com> posted:
> 
>> I tried asking the web-browser this and it returned a bunch of links to
>> introduction to vectors.
>>
>> Am I right in thinking that the vector length and element size are
>> basically stable throughout an application?
> 
> Consider Gaussian Elimination, the length of the loop goes down
> by 1 every loop.
>
okay

>>                                              If so, they can be stored in
>> a config register. Otherwise, if they need to be changeable on a dynamic
>> basis they would have to be processed like a GPR with renaming etc.
> 
> Get ready to change them every entry to top-of-loop.
> Most CRAY-like vector units have a length-this-time register that
> is decremented by vector-register-length every vector-iteration.
> On the last iteration, it is used to create a mask of elements
> that are not going to be calculated.
> 
I think this may be okay handled with a mask. The Q+ vector registers 
are not super wide. The max is 512 bits. The length could be 
decremented, then a mask shifted right if the length is less than the 
number of registers in use. There would be basically NOP operations on 
the last iteration. -> could add an instruction to conditionally shift 
right if a < b.

>> Updating a CSR is rather slow as updates do not take place until commit
>> time.
>>
>> ATM the config is just wired directly into the micro-op translate stage
>> which would have really poor performance if things need to be modified
>> on the fly.
>>
>> I looked at the RISCV vector extension model and they have it just as a
>> CSR. Makes me think that is an acceptable solution.
> 
> It can be, so long as it performs decrement-by-vector-length all
> by itself ...
Re: vector length CSR?
#597
Author: EricP
Date: Sun, 08 Nov 2026 20:40
93 lines
5310 bytes
On 2026-Nov-08 10:03, Robert Finch wrote:
> On 2026-11-08 9:02 a.m., George Neuner wrote:
>> On Sun, 8 Nov 2026 07:39:44 -0500, Robert Finch <robfi680@gmail.com>
>> wrote:
>>
>>> I tried asking the web-browser this and it returned a bunch of links to
>>> introduction to vectors.
>>>
>>> Am I right in thinking that the vector length and element size are
>>> basically stable throughout an application?
>>
>> Certainly not.
>>
> Ugh.
> 
>> Element width may remain stable across many operations, but you can
>> expect that different widths may be needed at different times.
>>
>> Vector lengths, however, often change frequently.
>>
>>
>>> If so, they can be stored in a config register.
>>
>> If you are referring to a separate (Cray style) vector processor, or
>> to a streaming unit, the width and length would be in setup registers
>> in any case.
>>
>>
>>> Otherwise, if they need to be changeable on a dynamic
>>> basis they would have to be processed like a GPR with renaming etc.
>>> Updating a CSR is rather slow as updates do not take place until commit
>>> time.
>>
>> You can't change the setup while the vector unit is operating anyway.
>> However, there is no reason changes can't be queued to happen as soon
>> as the unit is finished.
>>
>>
>>> ATM the config is just wired directly into the micro-op translate stage
>>> which would have really poor performance if things need to be modified
>>> on the fly.
>>
>> "On the fly" meaning what?  You can't change the setup /while/ the
>> vector unit is in operation.
>>
> 
> 
>> Needing to frequently change element widths and/or vector lengths is
>> the domain of the short-vector SIMD many chips now have.
>>
>>
>>> I looked at the RISCV vector extension model and they have it just as a
>>> CSR. Makes me think that is an acceptable solution.
>>
>> It is for the case where the vector unit is separate and asynchronous.
> 
> I did not realize that was the use case for RISCV.
> 
> 
> Brain dump design issues. Qupls is not going to have a separate asynchronous vector unit. Vectors are supported using the GPR register file by hiding the issuing of multiple instructions behind the scenes and relying on parallelism in the OoO design.
> 
> How vectors are supported in Qupls may need re-thinking. The vector length is being used to set the number of 64-bit registers needed to represent a vector at the micro-op encoding stage, before the register file is read. That cannot be done ff the length has to change frequently.  Using a fixed number of registers might be better. For frequent changes the config would end up being passed around as another operand to vector instructions. Making the core larger = slower.
> 
> It is a toss-up I think. Using a fixed number of registers will occupy more execution units, mean more micro-ops will be fetched and dispatched and slow things down. On the other hand waiting 20 cycles or so for the length changes to percolate through the pipeline is not fast either.
> 
> May have both static length settings and dynamic length settings then. Using the static setting to set a maximum before the app is running and using dynamic lengths while executing code. Static length would set the number of micro-ops needed per vector instruction. Dynamic length would set the vector masking.
> 
> Maybe too complex to understand, having two different length settings.
> 
> Vector masking could be used to control the vector length dynamically. Rather than change the vector length, change the masking.


I've been looking at some docs on a RV-Vector unit called Saturn
that sounds similar to what you describe - mapping dynamic
vector length and width onto available hardware.

While browsing arxiv the paper on the scheduler that caught my eye as it
sounded similar to Mitch's VVM and I have been backtracking on the topic.
But I haven't read them closely yet so I could be way off.

Anyway here are some PDF links:

The Saturn Microarchitecture Manual, 2024
https://www2.eecs.berkeley.edu/Pubs/TechRpts/2024/EECS-2024-215.html

Design Techniques for Specialized Short-Vector Machines, 2025
https://escholarship.org/uc/item/1tv3m0vb

Instruction Scheduling in the Saturn Vector Unit, 2024
https://arxiv.org/abs/2412.00997


Re: vector length CSR?
#598
Author: George Neuner
Date: Sun, 08 Nov 2026 23:17
172 lines
8567 bytes
On Sun, 8 Nov 2026 10:03:01 -0500, Robert Finch <robfi680@gmail.com>
wrote:

>On 2026-11-08 9:02 a.m., George Neuner wrote:
>> On Sun, 8 Nov 2026 07:39:44 -0500, Robert Finch <robfi680@gmail.com>
>> wrote:
>> 
>>> I tried asking the web-browser this and it returned a bunch of links to
>>> introduction to vectors.
>>>
>>> Am I right in thinking that the vector length and element size are
>>> basically stable throughout an application?
>> 
>> Certainly not.
>>
>Ugh.
>
>> Element width may remain stable across many operations, but you can
>> expect that different widths may be needed at different times.
>> 
>> Vector lengths, however, often change frequently.
>> 
>> 
>>> If so, they can be stored in a config register.
>> 
>> If you are referring to a separate (Cray style) vector processor, or
>> to a streaming unit, the width and length would be in setup registers
>> in any case.
>> 
>> 
>>> Otherwise, if they need to be changeable on a dynamic
>>> basis they would have to be processed like a GPR with renaming etc.
>>> Updating a CSR is rather slow as updates do not take place until commit
>>> time.
>> 
>> You can't change the setup while the vector unit is operating anyway.
>> However, there is no reason changes can't be queued to happen as soon
>> as the unit is finished.
>> 
>> 
>>> ATM the config is just wired directly into the micro-op translate stage
>>> which would have really poor performance if things need to be modified
>>> on the fly.
>> 
>> "On the fly" meaning what?  You can't change the setup /while/ the
>> vector unit is in operation.
>>
>
>
>> Needing to frequently change element widths and/or vector lengths is
>> the domain of the short-vector SIMD many chips now have.
>> 
>> 
>>> I looked at the RISCV vector extension model and they have it just as a
>>> CSR. Makes me think that is an acceptable solution.
>> 
>> It is for the case where the vector unit is separate and asynchronous.
>
>I did not realize that was the use case for RISCV.

I don't know anything about RISCV ... I was speaking generally. 

Any unit might have (hidden) control registers that need to be set for
a particular operation to be performed.  In fact, most do.

The reason to have /visible/ setup registers is to allow for
operations that run asynchronously and automatically. Generally you
need at least to describe the input and what to do if there is an
error ... typically much more information than can be packed into a
CPU instruction.  


E.g., consider a DMA transfer: source address, target address,
transfer width, transfer count.  

Ok, /maybe/ that's a 4 source instruction, but more likely it is 4
mmap registers on your DMA unit that have to be set.

Or if your DMA unit allows chaining, you construct a linked list or
vector of parameter blocks in RAM, then set registers to point the
unit to the head of the chain and (if a vector) to tell it how many
blocks.


>Brain dump design issues. Qupls is not going to have a separate 
>asynchronous vector unit. Vectors are supported using the GPR register 
>file by hiding the issuing of multiple instructions behind the scenes 
>and relying on parallelism in the OoO design.
>
>How vectors are supported in Qupls may need re-thinking. The vector 
>length is being used to set the number of 64-bit registers needed to 
>represent a vector at the micro-op encoding stage, before the register 
>file is read. That cannot be done ff the length has to change 
>frequently.  Using a fixed number of registers might be better. For 
>frequent changes the config would end up being passed around as another 
>operand to vector instructions. Making the core larger = slower.
>
>It is a toss-up I think. Using a fixed number of registers will occupy 
>more execution units, mean more micro-ops will be fetched and dispatched 
>and slow things down. On the other hand waiting 20 cycles or so for the 
>length changes to percolate through the pipeline is not fast either.
>
>May have both static length settings and dynamic length settings then. 
>Using the static setting to set a maximum before the app is running and 
>using dynamic lengths while executing code. Static length would set the 
>number of micro-ops needed per vector instruction. Dynamic length would 
>set the vector masking.
>
>Maybe too complex to understand, having two different length settings.
>
>Vector masking could be used to control the vector length dynamically. 
>Rather than change the vector length, change the masking.

Note that I'm primarily a software person.  And I don't know anything
about your particular design.  My own musings follow. Feel free to
ignore them as I only can consider the problem from the POV of using
the CPU.


I understand that you want to stream vectors through your CPU, using
your general registers to do the processing.  Sounds similar to what
Mitch is trying to achieve with his "My 66000".

Depending on how many sources (args) per instruction, and whether you
have only reg->reg or memory loadops, and whether you have full length
instruction constants, it seems that vector operations are going to
require 1 to 3 registers per element.
[If you can fix the number of registers per element, that will help.]

Regardless of how many registers (or names) you have, undoubtedly
there will be vectors that are too long to handle without looping, and
there will be vectors whose lengths are not integer multiples of
however many elements an iteration can do in parallel.
[You always can fall back on 1 element per iteration.]

The question is how smart you want your CPU to be. 


With vector lengths known at compile time, the compiler can unroll the
loop to figure out how many iterations of N elements, and handle
remaining (< N) elements separately. This requires no vector specific
smarts in your CPU.


If you want to do the moral equivalent of unrolling at runtime ...
well that's another thing altogether.  I confess that I don't fully
understand what Mitch is doing, and from your comments above I get the
idea that you really don't yet know how you want to handle it.

Obviously, you will need to know how many registers are needed for one
element - so unless you have some super loop instruction that
specifies that, you may have to parse the loop body.  And you'll need
to know how many registers are available to use.  You probably don't
want to have to spill things to make room, and you may find you need a
few registers for loop control: e.g., elements per/this iteration,
count of remaining elements, perhaps even a separate iteration count.

I don't really see how you'd use a vector mask.  It would work for a
contiguous vector register file, but since each element is represented
by a /group/ of GPRs that possibly are subject to discontiguous
renames, it seems better to predicate the loop body operations based
on whether they have something to do this iteration.  That argues for
your dispatcher/sequencer to handle each element separately.


BTW: you didn't mention whether you are register renaming. I hope so,
because I can't see how you realistically could do runtime unrolling
without it.


That's all for now. I have to think about it some more.
George
Re: vector length CSR?
#600
Author: Lawrence D’Oliveiro
Date: Mon, 09 Nov 2026 00:01
16 lines
1977 bytes
On Sun, 8 Nov 2026 07:39:44 -0500, Robert Finch wrote:

> I looked at the RISCV vector extension model and they have it just
> as a CSR. Makes me think that is an acceptable solution.

RISC-V is going against the prevailing fashion on this. Most other CPU
architectures in common use implement loads of SIMD instructions with
fixed vector lengths that are typically quite short: e.g. 4 or 8
elements. The reason why you need loads of different instructions is
because you want to cover all the possible combinations of operand
types that a programmer might find useful.

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).
Re: vector length CSR?
#601
Author: BGB
Date: Mon, 09 Nov 2026 01:24
69 lines
4188 bytes
On 11/8/2026 6:01 PM, Lawrence D’Oliveiro wrote:
> On Sun, 8 Nov 2026 07:39:44 -0500, Robert Finch wrote:
> 
>> I looked at the RISCV vector extension model and they have it just
>> as a CSR. Makes me think that is an acceptable solution.
> 
> RISC-V is going against the prevailing fashion on this. Most other CPU
> architectures in common use implement loads of SIMD instructions with
> fixed vector lengths that are typically quite short: e.g. 4 or 8
> elements. The reason why you need loads of different instructions is
> because you want to cover all the possible combinations of operand
> types that a programmer might find useful.
> 
> 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).


I am in the camp though of thinking that, in the use case where you need 
4 or 8 element vectors, needing to update the state whenever changing to 
a new vector format (more so if pipeline latency is involved) is 
basically shooting oneself in the foot.

My own leaning is, admittedly, to go the direction of saying that only 
64 and 128 bit SIMD vectors exist with only 2 or 4 elements. Otherwise, 
the SIMD ISA is treated basically the same as the integer ISA.

But, this is possibly also unpopular...


The design of RV-V could make more sense though where one has a low 
density of operations, and operations that can effectively utilize 
longer vectors.

Just, this doesn't tend to match most of my use-cases.

There are a lot of use cases where one needs a 3 element vector, but 
tradition here is to use a 4 element vector and ignore the last element.

...



Meanwhile... Ironically me writing an AU sci-fi story (imagining a world 
where the IBM PC clone market never happened) had led to me 
experimenting with implementing a Cinepak inspired image/video 
compressor (in the story, the idea is that they mostly use video 
compression technology that evolved out of Cinepak rather than MPEG).

Well, along with a lot of technological divergence; mostly things still 
using a lot more analog and optical media. No Windows exists (was mostly 
subsumed into OS/2); with home users mostly running a descendant of the 
Amiga Workbench OS (on top of PowerPC based computers); with no WWW 
stuff (instead a primarily FTP based internet experience), etc.


Though, to admit, a lot of it is mostly writing down stuff based on 
imagery that is floating around in my head (well, some amount of it 
depicting a world of mostly PowerPC based computers running Workbench 
and people still watching movies and shows off of LaserDisc and similar; 
so I decided to write a story based on this setting...).

( Me, trying to avoid just following a short response with an overly 
long detour... )

...

Re: vector length CSR?
#604
Author: Robert Finch
Date: Mon, 09 Nov 2026 04:00
225 lines
10342 bytes
On 2026-11-08 6:17 p.m., George Neuner wrote:
> On Sun, 8 Nov 2026 10:03:01 -0500, Robert Finch <robfi680@gmail.com>
> wrote:
> 
>> On 2026-11-08 9:02 a.m., George Neuner wrote:
>>> On Sun, 8 Nov 2026 07:39:44 -0500, Robert Finch <robfi680@gmail.com>
>>> wrote:
>>>
>>>> I tried asking the web-browser this and it returned a bunch of links to
>>>> introduction to vectors.
>>>>
>>>> Am I right in thinking that the vector length and element size are
>>>> basically stable throughout an application?
>>>
>>> Certainly not.
>>>
>> Ugh.
>>
>>> Element width may remain stable across many operations, but you can
>>> expect that different widths may be needed at different times.
>>>
>>> Vector lengths, however, often change frequently.
>>>
>>>
>>>> If so, they can be stored in a config register.
>>>
>>> If you are referring to a separate (Cray style) vector processor, or
>>> to a streaming unit, the width and length would be in setup registers
>>> in any case.
>>>
>>>
>>>> Otherwise, if they need to be changeable on a dynamic
>>>> basis they would have to be processed like a GPR with renaming etc.
>>>> Updating a CSR is rather slow as updates do not take place until commit
>>>> time.
>>>
>>> You can't change the setup while the vector unit is operating anyway.
>>> However, there is no reason changes can't be queued to happen as soon
>>> as the unit is finished.
>>>
>>>
>>>> ATM the config is just wired directly into the micro-op translate stage
>>>> which would have really poor performance if things need to be modified
>>>> on the fly.
>>>
>>> "On the fly" meaning what?  You can't change the setup /while/ the
>>> vector unit is in operation.
>>>
>>
>>
>>> Needing to frequently change element widths and/or vector lengths is
>>> the domain of the short-vector SIMD many chips now have.
>>>
>>>
>>>> I looked at the RISCV vector extension model and they have it just as a
>>>> CSR. Makes me think that is an acceptable solution.
>>>
>>> It is for the case where the vector unit is separate and asynchronous.
>>
>> I did not realize that was the use case for RISCV.
> 
> I don't know anything about RISCV ... I was speaking generally.
> 
> Any unit might have (hidden) control registers that need to be set for
> a particular operation to be performed.  In fact, most do.
> 
> The reason to have /visible/ setup registers is to allow for
> operations that run asynchronously and automatically. Generally you
> need at least to describe the input and what to do if there is an
> error ... typically much more information than can be packed into a
> CPU instruction.
> 
> 
> E.g., consider a DMA transfer: source address, target address,
> transfer width, transfer count.
> 
> Ok, /maybe/ that's a 4 source instruction, but more likely it is 4
> mmap registers on your DMA unit that have to be set.
> 
> Or if your DMA unit allows chaining, you construct a linked list or
> vector of parameter blocks in RAM, then set registers to point the
> unit to the head of the chain and (if a vector) to tell it how many
> blocks.
> 
> 
>> Brain dump design issues. Qupls is not going to have a separate
>> asynchronous vector unit. Vectors are supported using the GPR register
>> file by hiding the issuing of multiple instructions behind the scenes
>> and relying on parallelism in the OoO design.
>>
>> How vectors are supported in Qupls may need re-thinking. The vector
>> length is being used to set the number of 64-bit registers needed to
>> represent a vector at the micro-op encoding stage, before the register
>> file is read. That cannot be done ff the length has to change
>> frequently.  Using a fixed number of registers might be better. For
>> frequent changes the config would end up being passed around as another
>> operand to vector instructions. Making the core larger = slower.
>>
>> It is a toss-up I think. Using a fixed number of registers will occupy
>> more execution units, mean more micro-ops will be fetched and dispatched
>> and slow things down. On the other hand waiting 20 cycles or so for the
>> length changes to percolate through the pipeline is not fast either.
>>
>> May have both static length settings and dynamic length settings then.
>> Using the static setting to set a maximum before the app is running and
>> using dynamic lengths while executing code. Static length would set the
>> number of micro-ops needed per vector instruction. Dynamic length would
>> set the vector masking.
>>
>> Maybe too complex to understand, having two different length settings.
>>
>> Vector masking could be used to control the vector length dynamically.
>> Rather than change the vector length, change the masking.
> 
> Note that I'm primarily a software person.  And I don't know anything
> about your particular design.  My own musings follow. Feel free to
> ignore them as I only can consider the problem from the POV of using
> the CPU.
> 
> 
> I understand that you want to stream vectors through your CPU, using
> your general registers to do the processing.  Sounds similar to what
> Mitch is trying to achieve with his "My 66000".
> 
> Depending on how many sources (args) per instruction, and whether you
> have only reg->reg or memory loadops, and whether you have full length
> instruction constants, it seems that vector operations are going to
> require 1 to 3 registers per element.
> [If you can fix the number of registers per element, that will help.]
> 
Maybe a semantic difference here. I call components of a vector elements 
that might also be called lanes. Multiple elements (lanes) fit into a 
single register (between 1 and 8 elements) depending on if the element 
is a byte, wyde, tetra or octa in size. Elements are not allowed to span 
registers.

The CPU is sitting at 6 args to an instructions. 3 read ports 1 write 
port (also read) a hidden arg for dynamic round mode, and I've forgotten 
what the other arg is ATM.

> Regardless of how many registers (or names) you have, undoubtedly
> there will be vectors that are too long to handle without looping, and
> there will be vectors whose lengths are not integer multiples of
> however many elements an iteration can do in parallel.
> [You always can fall back on 1 element per iteration.]
> 
> The question is how smart you want your CPU to be.
> 
> 
> With vector lengths known at compile time, the compiler can unroll the
> loop to figure out how many iterations of N elements, and handle
> remaining (< N) elements separately. This requires no vector specific
> smarts in your CPU.
> 
> 
> If you want to do the moral equivalent of unrolling at runtime ...
> well that's another thing altogether.  I confess that I don't fully
> understand what Mitch is doing, and from your comments above I get the
> idea that you really don't yet know how you want to handle it.
> 
> Obviously, you will need to know how many registers are needed for one
> element - so unless you have some super loop instruction that
> specifies that, you may have to parse the loop body.  And you'll need
> to know how many registers are available to use.  You probably don't
> want to have to spill things to make room, and you may find you need a
> few registers for loop control: e.g., elements per/this iteration,
> count of remaining elements, perhaps even a separate iteration count.
> 
> I don't really see how you'd use a vector mask.  It would work for a
> contiguous vector register file, but since each element is represented
> by a /group/ of GPRs that possibly are subject to discontiguous
> renames, it seems better to predicate the loop body operations based
> on whether they have something to do this iteration.  That argues for
> your dispatcher/sequencer to handle each element separately.
>
Ah, that may have been the other arg. I think this is handled okay. The 
start lane number is recorded for each instruction. The execute unit 
knows how much to shift the mask value. It just looks like another arg.

> 
> BTW: you didn't mention whether you are register renaming. I hope so,
> because I can't see how you realistically could do runtime unrolling
> without it.
>
Yup, it does (limited) register renaming.

One cannot do this without stalling the machine:

	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t1,%t1,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t1,%t1,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t1,%t1,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t1,%t1,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t1,%t1,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t3,%t3,$1
	add %t1,%t1,$1

There would be too many renames on %t3

> 
> That's all for now. I have to think about it some more.
> George
Re: vector length CSR?
#606
Author: Robert Finch
Date: Mon, 09 Nov 2026 04:11
26 lines
2490 bytes
On 2026-11-08 7:01 p.m., Lawrence D’Oliveiro wrote:
> On Sun, 8 Nov 2026 07:39:44 -0500, Robert Finch wrote:
> 
>> I looked at the RISCV vector extension model and they have it just
>> as a CSR. Makes me think that is an acceptable solution.
> 
> RISC-V is going against the prevailing fashion on this. Most other CPU
> architectures in common use implement loads of SIMD instructions with
> fixed vector lengths that are typically quite short: e.g. 4 or 8
> elements. The reason why you need loads of different instructions is
> because you want to cover all the possible combinations of operand
> types that a programmer might find useful.
> 

> 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. There is a ton of instructions in Q+.
One thing that may help is using longer instruction mnemonics.

I seem to recall reading somewhere that once one gets beyond about 400 
mnemonics one cannot remember what they all mean.
Re: vector length CSR?
#605
Author: Lawrence D’Oliveiro
Date: Mon, 09 Nov 2026 04:37
14 lines
1794 bytes
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.
Re: vector length CSR?
#610
Author: Anton Ertl
Date: Mon, 09 Nov 2026 06:13
84 lines
5499 bytes
Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> writes:
>RISC-V is going against the prevailing fashion on this. Most other CPU
>architectures in common use implement loads of SIMD instructions with
>fixed vector lengths that are typically quite short: e.g. 4 or 8
>elements. The reason why you need loads of different instructions is
>because you want to cover all the possible combinations of operand
>types that a programmer might find useful.
>
>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).

Given that Patterson (who coined the term RISC) never gave a
definition of RISC, how can one say that the combinatorial explosion
is right or wrong?

John Mashey gave criteria for determining the RISC-ness of an
intruction set
<https://userpages.umbc.edu/~vijay/mashey.on.risc.html>, and I found
his arguments convincing (although I do not agree fully with all of
his criteria, in particular, not 3a-c, and 5a and consequently 5b).
The number of instructions is not one of the criteria he gave.

In particular, if we look at AVX and AVX-512 instructions,

1) The gather and scatter instructions are against RISC criteria
   (Mashey criterion 4b), and on Skylake are slow, and already have
   resulted in the Downfall vulnerability.

2) The load-and-operate variants of the instructions are against
   Mashey's criterion 4a, and while other criteria (in particular
   3a-3c) are not satisfied by all CPUs that are typically seen as
   RISC, this criterion has been satisfied by all of them.  One can
   see the bad effects of the load-and-operate variants as well as the
   bad effects of making the destination operand one of the sources
   (not a Mashey criterion) in the FMA3 instructions, which come in
   132, 213, and 231 variants depending on which source operand should
   be overwritten and which should be in memory.

3) AVX and AVX-512 are part of AMD64, so naturally they do not satisfy
   criteria 3a and 3b.

If you leave away the gather-and-scatter instructions, and the
load-and-operate variants, and encode the rest to fit in 32 bits (and
leave room for the integer instruction set:-), and reduce the offset
of load/store instructions to make this possible, AVX-512 still has
hundreds, maybe thousands of instructions thanks to the combination of
operations, types, lane (element) sizes, operation width, but
satisfies Masheys criteria.

The RISC-V designers may want to add the number of instructions as
another criterion, but I think they would be wrong.  The advantages of
the RISC principles do not hinge on the number of instructions.

If they want to encode some of the "combinatorial explosion" stuff in
registers that are implicitly used by the SIMD instructions, that's
actually against the trend in at least some of the RISCs, in
particular MIPS (with hi and lo as the exception that proves the rule)
and Alpha, and RISC-V without the vector stuff, to avoid implicit (and
thus single-instance) registers; this rule has shown its value in
particular when OoO was introduced (no need to rename the condition
codes).

One might have several registers containing the type and widths, and
refer to them in the instruction, and this would reduce the problems
of this approach a little.  But a problem remains: Implementors want
to know the registers that the instruction operates on in the renamer,
and the type that they work on when entering the schedulers (not every
microarchitecture has just one scheduler that covers everything), so
these informations need to be provided at the front end, and
instructions that change these registers need to be executed at the
front end, subverting OoO implementations.

There is a reason why we have encoded the instruction type and width
into scalar instructions, and this reason does not go away when it
comes to vector instructions.  And just because this good practice
inreases the instruction count, does not make it a bad practice, even
if the result is a combinatorial explosion.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: vector length CSR?
#607
Author: Robert Finch
Date: Mon, 09 Nov 2026 07:14
26 lines
2264 bytes
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. At least I do not have a 
different instruction for each size. Data type is usually determined by 
the instruction. vadd for vector integer add, vfadd for float add, etc.





Re: vector length CSR?
#608
Author: Robert Finch
Date: Mon, 09 Nov 2026 07:29
43 lines
2841 bytes
; Pedantic (work in progress)
; If the number of GPR registers per vector register is 3.
; The core translates with micro-ops:

	vadd %r1,%r8,%r16

; into
	add %r1,%r8,%r16	; records lane #1 in the instruction
	add %r2,%r9,%r17	; records lane #2 in the instruction
	add %r3,%r10,%r18

; which it can then distribute to three different pipelines
; and execute in parallel. (no dependencies).

; Translating with micro-ops happens in the front-end after
; the instruction is extracted from the cache line.
; Therefore, there are no register values available yet,
; therefore the vector length cannot be set dynamically
; at high speed. It is possible to change the length but
; it takes a lot of clock cycles. Suggested to use mask
; register instead.

	vaddm %r1,%r8,%r16,%r4	; r4 contains mask

; translates into (source arg #3 is always scalar) masked add
	addm %r1,%r8,%r16,%r4	; records lane #1 in the instruction
	addm %r2,%r9,%r17,%r4	; records lane #2 in the instruction
	addm %r3,%r10,%r18,%r4

; if the elements remaining is less than the number of elements
; in a vector register
; the follwoing generates a mask (alias for bitfield set insn)

	vmfill %r4,$0,$ele_remaining

; It is possible to use a simple instruction sequence to
; generate the mask.
; eg 12 elements in 3 regs

	minu %r5,$12,%r6		; where r6 is counting down # ele
	set %r4,$0,$0,%r5,$-1		; vmfill %r4,$0,%r5
	sub %r6,%r6,%r5			; count down # ele
	bne %r5,$0,.loop_again
Re: vector length CSR?
#609
Author: Lawrence D’Oliveiro
Date: Mon, 09 Nov 2026 07:51
14 lines
1838 bytes
On Mon, 09 Nov 2026 06:13:02 GMT, Anton Ertl wrote:

> On Mon, 9 Nov 2026 00:01:09 -0000 (UTC), 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).
>
> Given that Patterson (who coined the term RISC) never gave a
> definition of RISC, how can one say that the combinatorial explosion
> is right or wrong?

It’s in the name: “Reduced Instruction Set Computer”.
Re: vector length CSR?
#611
Author: Anton Ertl
Date: Mon, 09 Nov 2026 08:14
25 lines
2357 bytes
Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> writes:
>On Mon, 09 Nov 2026 06:13:02 GMT, Anton Ertl wrote:
>> Given that Patterson (who coined the term RISC) never gave a
>> definition of RISC, how can one say that the combinatorial explosion
>> is right or wrong?
>
>It's in the name: "Reduced Instruction Set Computer"

Read it as "reduced-instruction set computer", not as "reduced
instruction-set computer".  The relevance is that the instruction
complexity is reduced, even at the cost of increasing the number of
instructions.

E.g., MIPS and RISC-V have an instruction called LUI, which would be
unnecessary if ADDIU just supported full-width immediate operands,
like VAX.  So by the instruction-counting criteria MIPS and RISC-V are
less reduced than the variants MY MIPS' and MY RISC-V (as in MY 66000)
that have a full-width immediate operand and no LUI.  But by John
Mashey's criteria, the MY variants are less RISC, because they have
more instruction widths.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: vector length CSR?
#612
Author: Robert Finch
Date: Mon, 09 Nov 2026 12:03
91 lines
6175 bytes
On 2026-11-09 1:13 a.m., Anton Ertl wrote:
> Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> writes:
>> RISC-V is going against the prevailing fashion on this. Most other CPU
>> architectures in common use implement loads of SIMD instructions with
>> fixed vector lengths that are typically quite short: e.g. 4 or 8
>> elements. The reason why you need loads of different instructions is
>> because you want to cover all the possible combinations of operand
>> types that a programmer might find useful.
>>
>> 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).
> 
> Given that Patterson (who coined the term RISC) never gave a
> definition of RISC, how can one say that the combinatorial explosion
> is right or wrong?
> 
> John Mashey gave criteria for determining the RISC-ness of an
> intruction set
> <https://userpages.umbc.edu/~vijay/mashey.on.risc.html>, and I found
> his arguments convincing (although I do not agree fully with all of
> his criteria, in particular, not 3a-c, and 5a and consequently 5b).
> The number of instructions is not one of the criteria he gave.
> 
> In particular, if we look at AVX and AVX-512 instructions,
> 
> 1) The gather and scatter instructions are against RISC criteria
>     (Mashey criterion 4b), and on Skylake are slow, and already have
>     resulted in the Downfall vulnerability.
> 
> 2) The load-and-operate variants of the instructions are against
>     Mashey's criterion 4a, and while other criteria (in particular
>     3a-3c) are not satisfied by all CPUs that are typically seen as
>     RISC, this criterion has been satisfied by all of them.  One can
>     see the bad effects of the load-and-operate variants as well as the
>     bad effects of making the destination operand one of the sources
>     (not a Mashey criterion) in the FMA3 instructions, which come in
>     132, 213, and 231 variants depending on which source operand should
>     be overwritten and which should be in memory.
> 
> 3) AVX and AVX-512 are part of AMD64, so naturally they do not satisfy
>     criteria 3a and 3b.
> 
> If you leave away the gather-and-scatter instructions, and the
> load-and-operate variants, and encode the rest to fit in 32 bits (and
> leave room for the integer instruction set:-), and reduce the offset
> of load/store instructions to make this possible, AVX-512 still has
> hundreds, maybe thousands of instructions thanks to the combination of
> operations, types, lane (element) sizes, operation width, but
> satisfies Masheys criteria.
> 
> The RISC-V designers may want to add the number of instructions as
> another criterion, but I think they would be wrong.  The advantages of
> the RISC principles do not hinge on the number of instructions.
> 
> If they want to encode some of the "combinatorial explosion" stuff in
> registers that are implicitly used by the SIMD instructions, that's
> actually against the trend in at least some of the RISCs, in
> particular MIPS (with hi and lo as the exception that proves the rule)
> and Alpha, and RISC-V without the vector stuff, to avoid implicit (and
> thus single-instance) registers; this rule has shown its value in
> particular when OoO was introduced (no need to rename the condition
> codes).
> 
> One might have several registers containing the type and widths, and
> refer to them in the instruction, and this would reduce the problems
> of this approach a little.  But a problem remains: Implementors want
> to know the registers that the instruction operates on in the renamer,
> and the type that they work on when entering the schedulers (not every
> microarchitecture has just one scheduler that covers everything), so
> these informations need to be provided at the front end, and
> instructions that change these registers need to be executed at the
> front end, subverting OoO implementations.
> 
> There is a reason why we have encoded the instruction type and width
> into scalar instructions, and this reason does not go away when it
> comes to vector instructions.  And just because this good practice
> inreases the instruction count, does not make it a bad practice, even
> if the result is a combinatorial explosion.
> 
> - anton

Thanks, John Mashey's criteria is somewhat biblical. It looks like I 
start working on the next version of Qupls as the current version has 
some flaws. The operand size should be spec'd as part of the 
instruction. Got to avoid a level of indirection by using registers to 
specify things. It would be going a bit backwards to an earlier version 
that had just 32 visible regs, but also 32 vector regs.

Re: vector length CSR?
#616
Author: Scott Lurndal
Date: Mon, 09 Nov 2026 15:52
39 lines
2498 bytes
George Neuner <gneuner2@comcast.net> writes:
>On Sun, 8 Nov 2026 10:03:01 -0500, Robert Finch <robfi680@gmail.com>
>wrote:

>>>> I looked at the RISCV vector extension model and they have it just as a
>>>> CSR. Makes me think that is an acceptable solution.
>>> 
>>> It is for the case where the vector unit is separate and asynchronous.
>>
>>I did not realize that was the use case for RISCV.
>
>I don't know anything about RISCV ... I was speaking generally. 
>
>Any unit might have (hidden) control registers that need to be set for
>a particular operation to be performed.  In fact, most do.
>
>The reason to have /visible/ setup registers is to allow for
>operations that run asynchronously and automatically. Generally you
>need at least to describe the input and what to do if there is an
>error ... typically much more information than can be packed into a
>CPU instruction.  
>
>
>E.g., consider a DMA transfer: source address, target address,
>transfer width, transfer count.  
>
>Ok, /maybe/ that's a 4 source instruction, but more likely it is 4
>mmap registers on your DMA unit that have to be set.

For the most part, a "DMA unit" has been obsolete for three
decades.  For modern devices (e.g. PCI Express devices), DMA is handled
by the device itself by simply sending a Memory Write TLP
from the device to the host.    The host may have a mapping
unit (IOMMU/SMMU) in the path that will translate the address
in the TLP before it reaches the host interconnect structures
(mesh, crossbar switch, et alia) leading to memory (or in some
cases to host CSRs).

Re: vector length CSR?
#613
Author: Stephen Fuld
Date: Mon, 09 Nov 2026 17:08
118 lines
6220 bytes
On 11/8/2026 3:17 PM, George Neuner wrote:
> On Sun, 8 Nov 2026 10:03:01 -0500, Robert Finch <robfi680@gmail.com>
> wrote:

Big snip

>> Vectors are supported using the GPR register
>> file by hiding the issuing of multiple instructions behind the scenes
>> and relying on parallelism in the OoO design.

Good.

>> How vectors are supported in Qupls may need re-thinking. 

Agreed.

big snip


> Note that I'm primarily a software person.  And I don't know anything
> about your particular design.  My own musings follow. Feel free to
> ignore them as I only can consider the problem from the POV of using
> the CPU.

I am in the same position.

> I understand that you want to stream vectors through your CPU, using
> your general registers to do the processing.  Sounds similar to what
> Mitch is trying to achieve with his "My 66000".
Yes, although he is talking about various "configuration" registers for 
things like vector length, element size, etc. which My 66000's VVM 
doesn't need.


> Depending on how many sources (args) per instruction, and whether you
> have only reg->reg or memory loadops, and whether you have full length
> instruction constants, it seems that vector operations are going to
> require 1 to 3 registers per element.
> [If you can fix the number of registers per element, that will help.]
> 
> Regardless of how many registers (or names) you have, undoubtedly
> there will be vectors that are too long to handle without looping, and
> there will be vectors whose lengths are not integer multiples of
> however many elements an iteration can do in parallel.
> [You always can fall back on 1 element per iteration.]

All issues that simply go away with VVM.  Or at least "go away" for the 
programmer.  The hardware must still handle them, though.


> The question is how smart you want your CPU to be.

Yes.  I don't know how much "smarts" VVM requires in the hardware.



> With vector lengths known at compile time, the compiler can unroll the
> loop to figure out how many iterations of N elements, and handle
> remaining (< N) elements separately. This requires no vector specific
> smarts in your CPU.
> 
> 
> If you want to do the moral equivalent of unrolling at runtime ...
> well that's another thing altogether.  I confess that I don't fully
> understand what Mitch is doing, and from your comments above I get the
> idea that you really don't yet know how you want to handle it.


While I don't understand the details or how complex the hardware is 
behind the scenes, but from a programmer's point of view, VVM is very 
simple, in fact I would argue simpler than than all those SIMD 
instructions, extra reconfiguration registers, etc.

The steps in writing code for VVM which would replace a sequence of SIMD 
instructions are ISTM, the following:

	Pretend you have no "special" instructions and are going to write a 
"traditional" loop to process whatever vectors you have in the way you 
need to to solve your problem.

	Write a sequence of "ordinary" scalar instructions to essentially 
process one element of the vectors you are dealing with. This is the 
"guts" of the processing that is conceptually in the innermost loop over 
the vectors you are processing and would replace the sequence of SIMD 
instructions.  There are a few restrictions to what instructions you can 
use, e.g. no jumps, but you can use predicated instructions, a limit on 
the number of instructions.

	Put a LOOP instruction after the last instruction you wrote above. 
This includes the loop termination conditions.

	Lastly, and this includes the only part that is has something 
conceptually different from a simple scaler loop, add a VEC instruction 
at the beginning of the sequence.  The different part is that this 
instruction includes information about which registers are needed to be 
"correct" after the loop terminates.


The hardware does it magic.  No need for you, the programmer, to worry 
about special length registers, element packing (just load bytes, half 
words, words or double words as required) how to break down processing 
into "chunks" the size of SIMD registers, no mask registers, etc.

 From a programmer's  POV, once you "get it", it is much simpler than 
the SIMD approach (no new instructions to learn, a lot less to have to 
think about), and has the advantage of not requiring rethinking the code 
for the next iteration of SIMD instructions.

I can't speak to the hardware complexity of the implementation.  Perhaps 
that is a limiting factor.  But barring that, and the mental effort 
required to "reorient" your thinking, I don't see why any new clean 
sheet design would use SIMD instructions.  Perhaps someone can explain 
why it should.


-- 
  - Stephen Fuld
(e-mail address disguised to prevent spam)
Re: vector length CSR?
#614
Author: Anton Ertl
Date: Mon, 09 Nov 2026 22:01
21 lines
2232 bytes
Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
>I can't speak to the hardware complexity of the implementation.  Perhaps 
>that is a limiting factor.  But barring that, and the mental effort 
>required to "reorient" your thinking, I don't see why any new clean 
>sheet design would use SIMD instructions.  Perhaps someone can explain 
>why it should.

There used to be memory-to-memory vector machines, and there used to
be vector machines with vector registers, like the Cray-1.  The
advantage of the vector registers was that they could be used several
or even many times for each time they are loaded, as is common in
matrix multiplication implementations.

My impression is that VVM can only do what memory-to-memory vector
machines could do, but does not have a good story for those tasks
where the vector/SIMD registers are used several times.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: vector length CSR?
#615
Author: Lawrence D’Oliveiro
Date: Mon, 09 Nov 2026 22:38
28 lines
2362 bytes
On Mon, 09 Nov 2026 08:14:04 GMT, Anton Ertl wrote:

> On Mon, 9 Nov 2026 07:51:10 -0000 (UTC), Lawrence D’Oliveiro wrote:
>
>> It's in the name: "Reduced Instruction Set Computer"
>
> Read it as "reduced-instruction set computer", not as "reduced
> instruction-set computer".

So what exactly is a “set computer”?

Why not “reduced-instruction set-computer”? If it’s good to put in
hyphens, why not put in more of them? “Reduced-instruction-set
computer”?

Yours is an example of a “circular argument” -- you are choosing a
particular reading (and a particularly awkward one at that) just on
the basis that it agrees with your argument, not for any other reason.

> The relevance is that the instruction complexity is reduced, even at
> the cost of increasing the number of instructions.
>
> E.g., MIPS and RISC-V have an instruction called LUI, which would be
> unnecessary if ADDIU just supported full-width immediate operands,
> like VAX.

So you see a shift-and-load instruction is being somehow *less*
complex than a straight load?
Re: vector length CSR?
#617
Author: EricP
Date: Mon, 09 Nov 2026 23:39
68 lines
3726 bytes
On 2026-Nov-09 02:29, Robert Finch wrote:
> ; Pedantic (work in progress)
> ; If the number of GPR registers per vector register is 3.
> ; The core translates with micro-ops:
> 
>      vadd %r1,%r8,%r16
> 
> ; into
>      add %r1,%r8,%r16    ; records lane #1 in the instruction
>      add %r2,%r9,%r17    ; records lane #2 in the instruction
>      add %r3,%r10,%r18
> 
> ; which it can then distribute to three different pipelines
> ; and execute in parallel. (no dependencies).
> 
> ; Translating with micro-ops happens in the front-end after
> ; the instruction is extracted from the cache line.
> ; Therefore, there are no register values available yet,
> ; therefore the vector length cannot be set dynamically
> ; at high speed. It is possible to change the length but
> ; it takes a lot of clock cycles. Suggested to use mask
> ; register instead.
> 
>      vaddm %r1,%r8,%r16,%r4    ; r4 contains mask
> 
> ; translates into (source arg #3 is always scalar) masked add
>      addm %r1,%r8,%r16,%r4    ; records lane #1 in the instruction
>      addm %r2,%r9,%r17,%r4    ; records lane #2 in the instruction
>      addm %r3,%r10,%r18,%r4
> 
> ; if the elements remaining is less than the number of elements
> ; in a vector register
> ; the follwoing generates a mask (alias for bitfield set insn)
> 
>      vmfill %r4,$0,$ele_remaining
> 
> ; It is possible to use a simple instruction sequence to
> ; generate the mask.
> ; eg 12 elements in 3 regs
> 
>      minu %r5,$12,%r6        ; where r6 is counting down # ele
>      set %r4,$0,$0,%r5,$-1        ; vmfill %r4,$0,%r5
>      sub %r6,%r6,%r5            ; count down # ele
>      bne %r5,$0,.loop_again

I'm not sure what I'm thinking as this idea is very un-baked
but maybe the Mill's belt concept could be useful.

Instead of treating the register file as 32 32-byte SIMD registers,
what if it was a 1024 byte belt. A variable byte length LDV Load Vector
copies a memory vector onto the belt such that element[0] lands in belt[0].
Source operands use a 10 bit belt byte offset,
and dynamic vector length of up to 32 bytes.

Internally its implemented as a circular buffer,
with byte alignment shifters to right-align (little endian)
the source operands as they are read for each operation.

There is no renaming because the belt output inherently
rotates the the whole belt. Internally that would just be
an byte vector alignment shifter applied to the destination.

Like I said, very unbaked. But it makes all the dynamic
length adjustments handled by alignment shifters
in the register file read and write pathways.


Re: vector length CSR?
#618
Author: Anton Ertl
Date: Tue, 10 Nov 2026 07:41
76 lines
4768 bytes
Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> writes:
>On Mon, 09 Nov 2026 08:14:04 GMT, Anton Ertl wrote:
>> Read it as "reduced-instruction set computer", not as "reduced
>> instruction-set computer".
>
>So what exactly is a "set computer"?

You obviously need even more help in how the words belong together.
It's

{{reduced instruction} set} computer

>> The relevance is that the instruction complexity is reduced, even at
>> the cost of increasing the number of instructions.
>>
>> E.g., MIPS and RISC-V have an instruction called LUI, which would be
>> unnecessary if ADDIU just supported full-width immediate operands,
>> like VAX.
>
>So you see a shift-and-load instruction is being somehow *less*
>complex than a straight load?

There is no shift-and-load involved anywhere.  See
<https://instructionsets.com/risc-v/lui/> about what LUI does on
RISC-V.  If you look at the binary layout, you see that the imm20 is
in the same bit positions in the instruction as in the destination
register.

What is less complex is that MIPS amd RISC-V implementations do not
need to deal with instructions that have more than 32 bits in length.
Without their compressed extensions, they only need to deal with one
instruction length: 32 bits.  Which means that you can fetch the
instruction directly into the decoder, without needing an instruction
buffer nor a shifter for shifting the bytes around in that buffer.

Concerning circularity: John Mashey's arguments are based on observing
architectures that have been generally considered RISC (such as Power,
ARM A32, and RISC-V) vs. architectures that have not (e.g., PDP-11,
VAX, and i386).

You may consider that circular: Derive criteria from a pre-existing
classification, and then use the criteria to classify new
architectures.  That's what you get if you don't have a definition to
start with.  BTW, while Patterson himself did not give a definition in
the paper where he coined the term RISC, but in 1985 observed
commonalities between IBM 801, Berkeley RISC-II and Stanford MIPS and
listed them, preceeding John Mashey's more detailed analysis.

Mashey (and IIRC also Patterson) also discuss the technical background
behind the commonalities in RISCs, so while you may consider the way
that the criteria were derived to be circular, they are not
accidental.

Instruction count is not among these criteria that Patterson observed, and not among the criteria that Mashey uses, either.

Instruction count would also be hard to measure; e.g.,
<https://instructionsets.com/x86/add/> lists 19 forms of instruction
with the mnemonic ADD.  Are they 19 different instructions with the
same name, or just one?  What about variants with the same encoding,
like the one with the opcode 05H (listed separately), where the
meaning depends on the value of a flag?  What about other differences
in behaviour influenced by a flag?

Mashey used (wrongly IMO) the number of addressing modes as a
criterion, and had difficulty counting them.  And, e.g., Power lists
auto-incrementing loads as separate instructions where auto-increment
is considered to be an addressing mode by ARM.

If you consider an instruction set RISC if it has, say, 64
instructions or less, does it become CISC when FP instructions are
added?  What about adding 64-bit instructions?

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: vector length CSR?
#619
Author: Anton Ertl
Date: Tue, 10 Nov 2026 09:03
31 lines
2702 bytes
EricP <ThatWouldBeTelling@thevillage.com> writes:
>I'm not sure what I'm thinking as this idea is very un-baked
>but maybe the Mill's belt concept could be useful.
>
>Instead of treating the register file as 32 32-byte SIMD registers,
>what if it was a 1024 byte belt. A variable byte length LDV Load Vector
>copies a memory vector onto the belt such that element[0] lands in belt[0].
>Source operands use a 10 bit belt byte offset,
>and dynamic vector length of up to 32 bytes.
>
>Internally its implemented as a circular buffer,
>with byte alignment shifters to right-align (little endian)
>the source operands as they are read for each operation.
>
>There is no renaming because the belt output inherently
>rotates the the whole belt. Internally that would just be
>an byte vector alignment shifter applied to the destination.

The disadvantage of a belt is that stuff vanishes from the belt (or
you have to preserve it by regularly copying from the end of the belt
to the beginning, so you do not get the advantage of a vector
register, that you can reuse its content as often as you like without
additional costs (useful, e.g., in matrix multiplication).

IIRC there are vector instruction sets (maybe even RVV?) that
can have more shorter or fewer longer vector registers.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: vector length CSR?
#620
Author: David Brown
Date: Tue, 10 Nov 2026 09:31
69 lines
4113 bytes
On 09/11/2026 23:38, Lawrence D’Oliveiro wrote:
> On Mon, 09 Nov 2026 08:14:04 GMT, Anton Ertl wrote:
> 
>> On Mon, 9 Nov 2026 07:51:10 -0000 (UTC), Lawrence D’Oliveiro wrote:
>>
>>> It's in the name: "Reduced Instruction Set Computer"
>>
>> Read it as "reduced-instruction set computer", not as "reduced
>> instruction-set computer".

Exactly.

It is also, I think, helpful to consider RISC as the "opposite" of CISC 
- and Complex Instruction Set Computer cannot really be interpreted as 
meaning anything other than that the instructions are "complex".  By 
comparison, with RISC the /instructions/ are "reduced".

> 
> So what exactly is a “set computer”?
> 
> Why not “reduced-instruction set-computer”? If it’s good to put in
> hyphens, why not put in more of them? “Reduced-instruction-set
> computer”?

Try parentheses rather than hyphens :

	((Reduced Instruction) Set) Computer

rather than

	(Reduced (Instruction Set)) Computer

RISC means the computer has a set of reduced instructions.

> 
> Yours is an example of a “circular argument” -- you are choosing a
> particular reading (and a particularly awkward one at that) just on
> the basis that it agrees with your argument, not for any other reason.
> 

No, he is choosing the reading that fits best, and I think is the most 
used interpretation amongst people familiar with a range of processor 
architectures.  It is certainly not uncommon to think of "RISC" as 
meaning that there are relatively few instructions, but once you start 
looking at a major RISC architecture you see that is not the case.  (For 
me, that revelation came when I first used a PowerPC microcontroller.)

>> The relevance is that the instruction complexity is reduced, even at
>> the cost of increasing the number of instructions.
>>
>> E.g., MIPS and RISC-V have an instruction called LUI, which would be
>> unnecessary if ADDIU just supported full-width immediate operands,
>> like VAX.
> 
> So you see a shift-and-load instruction is being somehow *less*
> complex than a straight load?

Anton will say what /he/ thinks, but to me a load-with-shift is 
obviously more complex than a load /without/ a shift.  However, it is 
not complex - it is done as single operation, without additional 
hardware states, delays or latencies, without scheduling executional 
units (other than a load or load/store unit for the load).  This is very 
different from an operation that combines a load with an addition using 
an ALU execution unit.  The point of RISC is not so much that 
instructions should not do fancy things, but that they should normally 
only use one execution unit for one operation.


Re: vector length CSR?
#621
Author: Anton Ertl
Date: Tue, 10 Nov 2026 12:06
36 lines
3223 bytes
David Brown <david.brown@hesbynett.no> writes:
>It is also, I think, helpful to consider RISC as the "opposite" of CISC 
>- and Complex Instruction Set Computer cannot really be interpreted as 
>meaning anything other than that the instructions are "complex".  By 
>comparison, with RISC the /instructions/ are "reduced".

Patterson certainly gave CISC as a contrast for RISC, and his example
CISC architecture is the VAX.  But while RISCs are relatively similar,
non-RISC architectures are all over the place, from VAX, Eclipse
MV/8000, S/370, Burroughs B5500 through CDC-6600 and Cray-1 to stuff
like the Novix NC4016 and its descendent Harris RTX2000, which is not
really complex, but is still not a RISC.

But I guess that Patterson had CPUs for mainframes and superminis of
1980 in mind, with MMU, virtual memory and big memory subsystems, not
microprocessors or microcontrollers of the time.  And he probably also
had an implementation-oriented, not just architecture-oriented view,
having worked on VAX microcode just before starting the RISC-I
project. But of course the architects of the day also had the
implementation-oriented view, and added complex instructions to the
relatively minimal Nova as more hardware became available, until they
arrived at the Eclipse MV/8000; and we have a nice book about the
difficulties of implementing that architecture ("The Soul of a new
Machine").

So despite the differences between the architectures that Patterson
thought about when he coined the term CISC, I guess there is a common
subtext among them: architectures that have been designed to make use
of the possibilities of microcode; maybe not at the start (AFAIK the
original Nova was pretty minimal), but certainly in their evolution
towards larger systems.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: vector length CSR?
#632
Author: Stefan Monnier
Date: Tue, 10 Nov 2026 14:02
8 lines
1743 bytes
> My impression is that VVM can only do what memory-to-memory vector
> machines could do, but does not have a good story for those tasks
> where the vector/SIMD registers are used several times.

Presumably caches could be used to get comparable results.


=== Stefan
Re: vector length CSR?
#622
Author: Stephen Fuld
Date: Tue, 10 Nov 2026 15:22
37 lines
3320 bytes
On 11/9/2026 2:01 PM, Anton Ertl wrote:
> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
>> I can't speak to the hardware complexity of the implementation.  Perhaps
>> that is a limiting factor.  But barring that, and the mental effort
>> required to "reorient" your thinking, I don't see why any new clean
>> sheet design would use SIMD instructions.  Perhaps someone can explain
>> why it should.
> 
> There used to be memory-to-memory vector machines, and there used to
> be vector machines with vector registers, like the Cray-1.  The
> advantage of the vector registers was that they could be used several
> or even many times for each time they are loaded, as is common in
> matrix multiplication implementations.
> 
> My impression is that VVM can only do what memory-to-memory vector
> machines could do, but does not have a good story for those tasks
> where the vector/SIMD registers are used several times.

That is an interesting, and thought provoking, response.  It seems the 
advantage of an SIMD approach is the large set of addressable registers 
that can be used to keep data readily available for future use.  Of 
course, both systems can keep a modest amount of data in the non SIMD 
registers, and VVM has streaming buffers, which dedicate memory within 
the CPU for other purposes.

I don't know if, when doing things like matrix multiplication, the 
streaming buffers can be used to keep data around as well as their role 
in anticipating future use. And, for matmul in particular, perhaps you 
could break the operation down into small enough blocks that the 
non-SIMD registers would be enough.  This all requires more thought.

I respect Mitch's abilities such that I can't believe he hasn't thought 
about how VVM would handle such a common operation as matrix multiplication.

-- 
  - Stephen Fuld
(e-mail address disguised to prevent spam)
CISC are not "unreduced" (was: vector length CSR?)
#631
Author: Stefan Monnier
Date: Tue, 10 Nov 2026 17:08
14 lines
2088 bytes
David Brown [2026-11-10 10:31:47] wrote:
> It is also, I think, helpful to consider RISC as the "opposite" of
> CISC - and Complex Instruction Set Computer cannot really be
> interpreted as meaning anything other than that the instructions are
> "complex".  By comparison, with RISC the /instructions/ are "reduced".

Indeed.  And one of the motivations behind the CISC evolution was the
famed "semantic gap", which pushed towards rather fewer instructions
that are more flexible, regular, and powerful.

The million instructions of AES don't feel very CISCy to me.


=== Stefan
Re: vector length CSR?
#623
Author: MitchAlsup
Date: Tue, 10 Nov 2026 19:14
23 lines
1936 bytes
Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> posted:

> On Sun, 8 Nov 2026 07:39:44 -0500, Robert Finch wrote:
> 
> > I looked at the RISCV vector extension model and they have it just
> > as a CSR. Makes me think that is an acceptable solution.
> 
> RISC-V is going against the prevailing fashion on this. Most other CPU
> architectures in common use implement loads of SIMD instructions with
> fixed vector lengths that are typically quite short: e.g. 4 or 8
> elements. The reason why you need loads of different instructions is
> because you want to cover all the possible combinations of operand
> types that a programmer might find useful.
> 
> 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).

And then they (RISC-V designers) go out and create a different
combinatorial-explosion of instructions (about DIV-4 of the SIMD
kind:: 300 instead of 1300). And both require a "crap load of bits"
in another register file.
Re: vector length CSR?
#625
Author: MitchAlsup
Date: Tue, 10 Nov 2026 19:27
28 lines
2070 bytes
Robert Finch <robfi680@gmail.com> posted:

> On 2026-11-08 6:17 p.m., George Neuner wrote:
------------merciful snip--------------

> > I understand that you want to stream vectors through your CPU, using
> > your general registers to do the processing.  Sounds similar to what
> > Mitch is trying to achieve with his "My 66000".
> > 
> > Depending on how many sources (args) per instruction, and whether you
> > have only reg->reg or memory loadops, and whether you have full length
> > instruction constants, it seems that vector operations are going to
> > require 1 to 3 registers per element.
> > [If you can fix the number of registers per element, that will help.]
> > 
> Maybe a semantic difference here. I call components of a vector elements 
> that might also be called lanes. Multiple elements (lanes) fit into a 
> single register (between 1 and 8 elements) depending on if the element 
> is a byte, wyde, tetra or octa in size. Elements are not allowed to span 
> registers.

Standard (CRAY) terminology is 
a) length 64-elements
b) Lanes {1,2,4,8}
c) beats = Length/Lanes

CRAY-1.. beats = 64
CRAY-YMP beats = 16
Re: vector length CSR?
#626
Author: MitchAlsup
Date: Tue, 10 Nov 2026 19:32
39 lines
2116 bytes
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];
      }

???

>                                            At least I do not have a 
> different instruction for each size. Data type is usually determined by 
> the instruction. vadd for vector integer add, vfadd for float add, etc.
> 
> 
> 
> 
> 
> 
Re: vector length CSR?
#627
Author: MitchAlsup
Date: Tue, 10 Nov 2026 19:43
78 lines
3712 bytes
Stephen Fuld <sfuld@alumni.cmu.edu.invalid> posted:

> On 11/8/2026 3:17 PM, George Neuner wrote:
> > On Sun, 8 Nov 2026 10:03:01 -0500, Robert Finch <robfi680@gmail.com>
> > wrote:
> 
> Big snip
> 
> >> Vectors are supported using the GPR register
> >> file by hiding the issuing of multiple instructions behind the scenes
> >> and relying on parallelism in the OoO design.
> 
> Good.
> 
> >> How vectors are supported in Qupls may need re-thinking. 
> 
> Agreed.
> 
> big snip
> 
> 
> > Note that I'm primarily a software person.  And I don't know anything
> > about your particular design.  My own musings follow. Feel free to
> > ignore them as I only can consider the problem from the POV of using
> > the CPU.
> 
> I am in the same position.
> 
> > I understand that you want to stream vectors through your CPU, using
> > your general registers to do the processing.  Sounds similar to what
> > Mitch is trying to achieve with his "My 66000".

> Yes, although he is talking about various "configuration" registers for 
> things like vector length, element size, etc. which My 66000's VVM 
> doesn't need.

The LOOP instruction deals with the looping characteristics
{iteration scheduling}.
The VEC. instruction deals with the boundary of the loop 
{entering and exiting}
There are no <SW visible> machine control registers involved. 

> > Depending on how many sources (args) per instruction, and whether you
> > have only reg->reg or memory loadops, and whether you have full length
> > instruction constants, it seems that vector operations are going to
> > require 1 to 3 registers per element.
> > [If you can fix the number of registers per element, that will help.]
> > 
> > Regardless of how many registers (or names) you have, undoubtedly
> > there will be vectors that are too long to handle without looping, and
> > there will be vectors whose lengths are not integer multiples of
> > however many elements an iteration can do in parallel.
> > [You always can fall back on 1 element per iteration.]
> 
> All issues that simply go away with VVM.  Or at least "go away" for the 
> programmer.  The hardware must still handle them, though.

And the compiler. If compiler can find:

label:
        inst1
        inst2
        ...
        ADD
        CMP
        BC    CND,label

with no CALLs in the loop, then compiler can vectorize the loop--
even in the face of memory aliasing, loop carried dependencies, ...
No exotic vectorization analysis needed.
 
> > The question is how smart you want your CPU to be.
> 
> Yes.  I don't know how much "smarts" VVM requires in the hardware.

An installation sequencer that looks for certain patterns and
setup a 2D rename process {1D is typical, 2D is iteration}.
Re: vector length CSR?
#628
Author: MitchAlsup
Date: Tue, 10 Nov 2026 19:57
93 lines
5114 bytes
anton@mips.complang.tuwien.ac.at (Anton Ertl) posted:

> Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> writes:
> >On Mon, 09 Nov 2026 08:14:04 GMT, Anton Ertl wrote:
> >> Read it as "reduced-instruction set computer", not as "reduced
> >> instruction-set computer".
> >
> >So what exactly is a "set computer"?
> 
> You obviously need even more help in how the words belong together.
> It's
> 
> {{reduced instruction} set} computer
> 
> >> The relevance is that the instruction complexity is reduced, even at
> >> the cost of increasing the number of instructions.
> >>
> >> E.g., MIPS and RISC-V have an instruction called LUI, which would be
> >> unnecessary if ADDIU just supported full-width immediate operands,
> >> like VAX.
> >
> >So you see a shift-and-load instruction is being somehow *less*
> >complex than a straight load?
> 
> There is no shift-and-load involved anywhere.  See
> <https://instructionsets.com/risc-v/lui/> about what LUI does on
> RISC-V.  If you look at the binary layout, you see that the imm20 is
> in the same bit positions in the instruction as in the destination
> register.
> 
> What is less complex is that MIPS amd RISC-V implementations do not
> need to deal with instructions that have more than 32 bits in length.

RISC-V:C has 16-bit instructions, too, so the shifter is there anyway.

> Without their compressed extensions, they only need to deal with one
> instruction length: 32 bits.  Which means that you can fetch the
> instruction directly into the decoder, without needing an instruction
> buffer nor a shifter for shifting the bytes around in that buffer.

One can put the IB in a place where set-hit overlaps its flip-flops.
{meaning the IB is just part of ICache FETCH}
 
> Concerning circularity: John Mashey's arguments are based on observing
> architectures that have been generally considered RISC (such as Power,
> ARM A32, and RISC-V) vs. architectures that have not (e.g., PDP-11,
> VAX, and i386).
> 
> You may consider that circular: Derive criteria from a pre-existing
> classification, and then use the criteria to classify new
> architectures.  That's what you get if you don't have a definition to
> start with.  BTW, while Patterson himself did not give a definition in
> the paper where he coined the term RISC, but in 1985 observed
> commonalities between IBM 801, Berkeley RISC-II and Stanford MIPS and
> listed them, preceeding John Mashey's more detailed analysis.
> 
> Mashey (and IIRC also Patterson) also discuss the technical background
> behind the commonalities in RISCs, so while you may consider the way
> that the criteria were derived to be circular, they are not
> accidental.

Don't leave out Mark Horowitz
 
> Instruction count is not among these criteria that Patterson observed, and not among the criteria that Mashey uses, either.
> 
> Instruction count would also be hard to measure; e.g.,
> <https://instructionsets.com/x86/add/> lists 19 forms of instruction
> with the mnemonic ADD.  Are they 19 different instructions with the
> same name, or just one?  What about variants with the same encoding,
> like the one with the opcode 05H (listed separately), where the
> meaning depends on the value of a flag?  What about other differences
> in behaviour influenced by a flag?

Given {signed, Unsigned}×{Byte, halfword, word, doubleword} one has
8 integer ADDs, and generally an AGEN ADD on the more CISCy machines.

One can argue whether that is enough or insufficient--independently.
 
> Mashey used (wrongly IMO) the number of addressing modes as a
> criterion, and had difficulty counting them.

{Gomer Pyle}
Surprise, surprise, surprise...

>                                               And, e.g., Power lists
> auto-incrementing loads as separate instructions where auto-increment
> is considered to be an addressing mode by ARM.
> 
> If you consider an instruction set RISC if it has, say, 64
> instructions or less, does it become CISC when FP instructions are
> added?  What about adding 64-bit instructions?
> 
> - anton
Re: vector length CSR?
#629
Author: MitchAlsup
Date: Tue, 10 Nov 2026 20:00
37 lines
2985 bytes
Stephen Fuld <sfuld@alumni.cmu.edu.invalid> posted:

> On 11/9/2026 2:01 PM, Anton Ertl wrote:
> > Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
> >> I can't speak to the hardware complexity of the implementation.  Perhaps
> >> that is a limiting factor.  But barring that, and the mental effort
> >> required to "reorient" your thinking, I don't see why any new clean
> >> sheet design would use SIMD instructions.  Perhaps someone can explain
> >> why it should.
> > 
> > There used to be memory-to-memory vector machines, and there used to
> > be vector machines with vector registers, like the Cray-1.  The
> > advantage of the vector registers was that they could be used several
> > or even many times for each time they are loaded, as is common in
> > matrix multiplication implementations.
> > 
> > My impression is that VVM can only do what memory-to-memory vector
> > machines could do, but does not have a good story for those tasks
> > where the vector/SIMD registers are used several times.
> 
> That is an interesting, and thought provoking, response.  It seems the 
> advantage of an SIMD approach is the large set of addressable registers 
> that can be used to keep data readily available for future use.  Of 
> course, both systems can keep a modest amount of data in the non SIMD 
> registers, and VVM has streaming buffers, which dedicate memory within 
> the CPU for other purposes.
> 
> I don't know if, when doing things like matrix multiplication, the 
> streaming buffers can be used to keep data around as well as their role 
> in anticipating future use. And, for matmul in particular, perhaps you 
> could break the operation down into small enough blocks that the 
> non-SIMD registers would be enough.  This all requires more thought.
> 
> I respect Mitch's abilities such that I can't believe he hasn't thought 
> about how VVM would handle such a common operation as matrix multiplication.

Blocking in the DCache.
Re: vector length CSR?
#633
Author: Anton Ertl
Date: Tue, 10 Nov 2026 21:15
39 lines
3128 bytes
MitchAlsup <user5857@newsgrouper.org.invalid> writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) posted:
>> Mashey (and IIRC also Patterson) also discuss the technical background
>> behind the commonalities in RISCs, so while you may consider the way
>> that the criteria were derived to be circular, they are not
>> accidental.
>
>Don't leave out Mark Horowitz

Duckduckgo does not give me any papers, or web pages about RISC
definition when I ask it for "Mark Horowitz RISC", unlike for "John
Mashey RISC".  Do you have a specific paper or web page in mind?

>Given {signed, Unsigned}×{Byte, halfword, word, doubleword} one has
>8 integer ADDs,

SPARC and Power have only one add instruction.  With a load-store
architecture, you need only one, the full-width one.  Only with
load-and-add instructions, you need to specify the width in the
addition, and whether you want the loaded value to be sign-extended or
zero-extended (although I think most have only one variant of every
length).  You also then have to ask yourself if you want to perform
the addition to the full width of the register, or just the width of
the loaded value, and sign- or zero-extend the result.  I see no good
reason to add only to the width of the loaded value, but that's how
AMD64 works.

The nice thing about load/store architectures is that you can separate
these concerns.

Have all 7 variants of loads (lbu lbs lsu lss lmu lms ll), four
variants of store (sb ss sm sl), do addition at full width, and have
various zero- and sign-extending instructions in the cases where they
are needed (usually not in connection with addition).

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: vector length CSR?
#630
Author: Terje Mathisen
Date: Tue, 10 Nov 2026 21:44
73 lines
3400 bytes
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.

After all inputs have been expanded into the final DW element size, do 
the muls and adds.

With a total of ~20 size expansion operations, they might well end up as 
a very significant part of the total runtime.

If the architecture has doubling parallel MULs, then that would save 
quite a few operations.

Terje




-- 
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"
Re: vector length CSR?
#634
Author: John Levine
Date: Tue, 10 Nov 2026 22:02
15 lines
1825 bytes
It appears that Anton Ertl <anton@mips.complang.tuwien.ac.at> said:
>There used to be memory-to-memory vector machines, and there used to
>be vector machines with vector registers, like the Cray-1. 

There still are.  zSeries has 16 vector registers and an impressively
overimplemented set of vector ops including integers, IEEE floats,
strings, and packed decimal.

It's not clear who this is for, but presumably there are customers
that wanted them enough to add them.

-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly
Re: vector length CSR?
#635
Author: MitchAlsup
Date: Wed, 11 Nov 2026 00:34
57 lines
3624 bytes
anton@mips.complang.tuwien.ac.at (Anton Ertl) posted:

> /ERROR "unexpected byte sequence starting at index 590: '\xC3'" while decoding/:
> 
> MitchAlsup <user5857@newsgrouper.org.invalid> writes:
> >anton@mips.complang.tuwien.ac.at (Anton Ertl) posted:
> >> Mashey (and IIRC also Patterson) also discuss the technical background
> >> behind the commonalities in RISCs, so while you may consider the way
> >> that the criteria were derived to be circular, they are not
> >> accidental.
> >
> >Don't leave out Mark Horowitz
> 
> Duckduckgo does not give me any papers, or web pages about RISC
> definition when I ask it for "Mark Horowitz RISC", unlike for "John
> Mashey RISC".  Do you have a specific paper or web page in mind?

"Architectural Tradeoffs in the Design of MIPS-X" Horowitz and Chow
 
> >Given {signed, Unsigned}×{Byte, halfword, word, doubleword} one has
> >8 integer ADDs,
> 
> SPARC and Power have only one add instruction.  With a load-store
> architecture, you need only one, the full-width one.

If you like LLVM compilers having to constrain ADD results with
SEXT/ZEXT, sure, and you also don't get integer overflow performed
properly (assuming you want it done at all).

LLVM takes the (somewhat convoluted) vision that a result in a
register is range limited to the exact value-set as one stored
in memory.

>                                                       Only with
> load-and-add instructions, you need to specify the width in the
> addition, and whether you want the loaded value to be sign-extended or
> zero-extended (although I think most have only one variant of every
> length).  You also then have to ask yourself if you want to perform
> the addition to the full width of the register, or just the width of
> the loaded value, and sign- or zero-extend the result.  I see no good
> reason to add only to the width of the loaded value, but that's how
> AMD64 works.

Any language that requires the register-allocated variable to be range
constrained exactly like those residing in memory has that property.
 
> The nice thing about load/store architectures is that you can separate
> these concerns.

There are side effects wrt HLLs that are not addresses with that view point.
 
> Have all 7 variants of loads (lbu lbs lsu lss lmu lms ll), four
> variants of store (sb ss sm sl), do addition at full width, and have
> various zero- and sign-extending instructions in the cases where they
> are needed (usually not in connection with addition).
> 
> - anton
Re: vector length CSR?
#636
Author: MitchAlsup
Date: Wed, 11 Nov 2026 00:36
75 lines
3061 bytes
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.

Now constrain i to the range{1..14} and try again.
 
> After all inputs have been expanded into the final DW element size, do 
> the muls and adds.
> 
> With a total of ~20 size expansion operations, they might well end up as 
> a very significant part of the total runtime.
> 
> If the architecture has doubling parallel MULs, then that would save 
> quite a few operations.
> 
> Terje
> 
> 
> 
> 
Re: vector length CSR?
#637
Author: MitchAlsup
Date: Wed, 11 Nov 2026 00:37
14 lines
1518 bytes
John Levine <johnl@taugh.com> posted:

> It appears that Anton Ertl <anton@mips.complang.tuwien.ac.at> said:
> >There used to be memory-to-memory vector machines, and there used to
> >be vector machines with vector registers, like the Cray-1. 
> 
> There still are.  zSeries has 16 vector registers and an impressively
> overimplemented set of vector ops including integers, IEEE floats,
> strings, and packed decimal.
> 
> It's not clear who this is for, but presumably there are customers
> that wanted them enough to add them.
>
At the cost of a Zseries, the vector unit is essentially free. 
Re: CISC are not "unreduced" (was: vector length CSR?)
#638
Author: MitchAlsup
Date: Wed, 11 Nov 2026 00:38
18 lines
1799 bytes
Stefan Monnier <monnier@iro.umontreal.ca> posted:

> David Brown [2026-11-10 10:31:47] wrote:
> > It is also, I think, helpful to consider RISC as the "opposite" of
> > CISC - and Complex Instruction Set Computer cannot really be
> > interpreted as meaning anything other than that the instructions are
> > "complex".  By comparison, with RISC the /instructions/ are "reduced".
> 
> Indeed.  And one of the motivations behind the CISC evolution was the
> famed "semantic gap", which pushed towards rather fewer instructions
> that are more flexible, regular, and powerful.
> 
> The million instructions of AES don't feel very CISCy to me.

Nor does a million instructions of AES feel very RISCy to me.
 
> 
> === Stefan
Re: vector length CSR?
#639
Author: Stephen Fuld
Date: Wed, 11 Nov 2026 00:52
46 lines
3654 bytes
On 11/10/2026 12:00 PM, MitchAlsup wrote:
> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> posted:
> 
>> On 11/9/2026 2:01 PM, Anton Ertl wrote:
>>> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
>>>> I can't speak to the hardware complexity of the implementation.  Perhaps
>>>> that is a limiting factor.  But barring that, and the mental effort
>>>> required to "reorient" your thinking, I don't see why any new clean
>>>> sheet design would use SIMD instructions.  Perhaps someone can explain
>>>> why it should.
>>>
>>> There used to be memory-to-memory vector machines, and there used to
>>> be vector machines with vector registers, like the Cray-1.  The
>>> advantage of the vector registers was that they could be used several
>>> or even many times for each time they are loaded, as is common in
>>> matrix multiplication implementations.
>>>
>>> My impression is that VVM can only do what memory-to-memory vector
>>> machines could do, but does not have a good story for those tasks
>>> where the vector/SIMD registers are used several times.
>>
>> That is an interesting, and thought provoking, response.  It seems the
>> advantage of an SIMD approach is the large set of addressable registers
>> that can be used to keep data readily available for future use.  Of
>> course, both systems can keep a modest amount of data in the non SIMD
>> registers, and VVM has streaming buffers, which dedicate memory within
>> the CPU for other purposes.
>>
>> I don't know if, when doing things like matrix multiplication, the
>> streaming buffers can be used to keep data around as well as their role
>> in anticipating future use. And, for matmul in particular, perhaps you
>> could break the operation down into small enough blocks that the
>> non-SIMD registers would be enough.  This all requires more thought.
>>
>> I respect Mitch's abilities such that I can't believe he hasn't thought
>> about how VVM would handle such a common operation as matrix multiplication.
> 
> Blocking in the DCache.

So how well does that perform compared to a "typical" SIMD approach?



-- 
  - Stephen Fuld
(e-mail address disguised to prevent spam)
Re: vector length CSR?
#641
Author: Robert Finch
Date: Wed, 11 Nov 2026 07:15
48 lines
2959 bytes
On 2026-11-10 2:32 p.m., 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];
>        }
> 
> ???
> 
I been busy. The operand size and number of registers are now encoded in 
the instruction.

For the above, the values would need to be extended to the largest 
operand size and it is really ugly to do ATM. Basically have to extract 
the elements of the vector and insert them into a new temp one.

>>                                             At least I do not have a
>> different instruction for each size. Data type is usually determined by
>> the instruction. vadd for vector integer add, vfadd for float add, etc.
>>
>>
>>
>>
>>
>>
Re: vector length CSR?
#642
Author: Robert Finch
Date: Wed, 11 Nov 2026 09:10
94 lines
4243 bytes
On 2026-11-10 4:44 p.m., Terje Mathisen wrote:
> 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.
> 
> After all inputs have been expanded into the final DW element size, do 
> the muls and adds.
> 
> With a total of ~20 size expansion operations, they might well end up as 
> a very significant part of the total runtime.
> 
> If the architecture has doubling parallel MULs, then that would save 
> quite a few operations.
> 
> Terje
> 
> 
> 
>
; Qupls code (in theory)
not as bad as I thought because the vectors are accessible in chunks
it’s about 36 instructions assuming a max vector length of eigth regs.

;       LOOP on i
;       {
;            DoubleWord[i] = WORD[i] × HalfWord[i] + Byte[i+2];
;       }
; four double words in DoubleWord = {r25…r18}
; four words in WORD = {r11...r8}
; four half word in HalfWord = {r7,r6}
; four bytes in Byte[i+2] = lower half of {r5}
; temp = {r4,r3}
; temp double word = {r35…r28}

MOVSXT r28,r6,$tetra0   ; r28 = sign extend (halfword[i])
MUL %r3,%r28,%r8
MULH %r4,%r28,%r8   ; {r4,r3} = word[i] * halfword[i]
MOVSXB %r28,%r5         ;
ASR %r29,%r28,$64          ; {r29,r28} = byte[i+2]
ADD %r18,%r3,%r28     ; add low half
ADD_GCY %r2,%r3,%r28
ADD %r19,%r4,%r29,%r2 ; {r19,18} = result
; unroll three more times
Re: vector length CSR?
#643
Author: Anton Ertl
Date: Wed, 11 Nov 2026 09:37
33 lines
2933 bytes
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> My impression is that VVM can only do what memory-to-memory vector
>> machines could do, but does not have a good story for those tasks
>> where the vector/SIMD registers are used several times.
>
>Presumably caches could be used to get comparable results.

Let's take Zen6 (because its capabilities have just been reported on
<https://chipsandcheese.com/p/amds-zen-6-family-feeding-the-beast>):

It can do 2 512-bit FMAs per cycle, each consuming 3 512-bit inputs
and generating 1 512-bit output, and, e.g. matrix multiplication can
get a good utilization from these units.

So in the worst case, if you need all the inputs from caches and
outputs to caches, you would need to be able to perform 6 512-bit
loads and 2 512-bit stores per cycle.  The actual Zen6 can perform 2
512-bit loads and (?) 1 512-bit store per cycle (and it's unclear from
the graphics whether the 2 loads and 1 store can happen in the same
cycle).

It may be possible to reduce the number of needed load or store ports
a little for matrix multiplication in VVM, e.g., by computing the sum
of several multiplications before storing, and/or by performing
multiplications of a vector with a scalar (SAXPY-style).  Fortunately,
matrix multiplication provides lots of freedoms in rearranging the
computation.  Nevertheless, I would be surprised if one could achieve
the same FPU/LSU ratio with VVM as one can achieve with AVX-512.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: CISC are not "unreduced" (was: vector length CSR?)
#644
Author: Anton Ertl
Date: Wed, 11 Nov 2026 09:57
32 lines
2974 bytes
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>The million instructions of AES don't feel very CISCy to me.

Not sure what you mean by that.

Intel's AES instruction set has 6 instructions
<https://en.wikipedia.org/wiki/AES-NI> and later they added 4 AVX-512
variants <https://en.wikipedia.org/wiki/AVX-512#VAES>.  As usual for
SSE (AES-NI) and AVX-512 instructions, one operand can be either in a
register or in memory.  So that's not RISC.  If you only do these
instructions with register operands, they look RISCy to me.  If you
mean the dynamic use of the instructions, you need to use AESENC 9
times and then call AESENCLAST omc to perform an AES-128 computation;
you need to prepare the key in 10 XMM/ZMM registers first.  in this
respect it is RISCy, rather than the CISCy approach of doing the full
computation in one instruction.

A more borderline issue is some crypto instruction (or several?) in
ARM A64, that uses IIRC 8 registers for its work.  IIRC the registers
are implicit in the instruction (unusual for RISC, but given the
number of registers involved...), and the instruction does so many
dependent operations that I think of a microcode engine for
implementing it, so it has a certain CISCy feeing.  But OTOH, the
instruction only accesses registers, so it avoids the usual
complications of CISCs, such as possibly having a page fault in the
middle of the computation.  Unfortunately, I don't remember further
details.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: vector length CSR?
#645
Author: 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"
Re: vector length CSR?
#646
Author: Terje Mathisen
Date: Wed, 11 Nov 2026 14:04
34 lines
2933 bytes
Stephen Fuld wrote:
> On 11/10/2026 12:00 PM, MitchAlsup wrote:
>> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> posted:
>>> I respect Mitch's abilities such that I can't believe he hasn't thought
>>> about how VVM would handle such a common operation as matrix 
>>> multiplication.
>>
>> Blocking in the DCache.
> 
> So how well does that perform compared to a "typical" SIMD approach?
> 

My guess would be "quite well".

A decade or two ago AMD published benchmark code for a relatively simple 
kernel where the final version ran about 3 x faster than the naive version:

 From memory, they started by prefetching 4KB of data, by actually 
loading and discarding the first byte of each 64-byte cache line (this 
was significatnly faster than using the PREFETCH hint operations), then 
they used load-and-operate on this 4 KB of input data (together with 
some other either local memory or register data), storing the results 
back to a local (cache-resident) 4 KB buffer, before the third and final 
iteration stored the 4KB to the final target, using Non-Temporal stores 
that would bypass the caches since this was data which would not be 
reused shortly.

Omitting/bypassing any of these "extra" steps made the code run slower.

Terje

-- 
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"
Re: CISC are not "unreduced"
#647
Author: BGB
Date: Wed, 11 Nov 2026 20:37
105 lines
5536 bytes
On 11/10/2026 11:08 AM, Stefan Monnier wrote:
> David Brown [2026-11-10 10:31:47] wrote:
>> It is also, I think, helpful to consider RISC as the "opposite" of
>> CISC - and Complex Instruction Set Computer cannot really be
>> interpreted as meaning anything other than that the instructions are
>> "complex".  By comparison, with RISC the /instructions/ are "reduced".
> 
> Indeed.  And one of the motivations behind the CISC evolution was the
> famed "semantic gap", which pushed towards rather fewer instructions
> that are more flexible, regular, and powerful.
> 

I can note that one goal I pushed for in my ISA design was to reduce 
executed instruction counts without raising the level of abstraction or 
having complex logic.

Though, this mostly ends up creating a pressure towards a larger GPR 
space and having the ability to encode larger immediate and displacement 
fields and similar for the cases where spills were common.


Also the LUI+ADDI scheme used by RISC-V, while very effective as a 
fallback case for a 32-bit machine, falls on its face for 64-bit 
machines. Also the design of the ISA starts to fall on its face the 
moment one has a struct or similar that is larger than 2K.

So:
   LUI+ADD+LW/SW => Sucks...
Well, and:
   SLL+ADD+LW/SW => Also sucks.
...

And people keep over-relying on optimizing designs for the SPEC 
benchmark, rather than across larger and more varied codebases (that 
would ideally not cost money to access).

Like, using a specific set of standardized benchmarks to drive feature 
and optimization decisions is equivalent to "teaching for the test" in 
education settings, which, while it does increase test-scores, is none 
the less an anti-pattern.


Better to find a range of codebases, and try to find codebases and 
scenarios for which things suck, and then try to make them "suck less". 
When the amount of "suck" can reduced, then typically everything gets 
better in a more indirect way.


But, what you don't necessarily want, is a bunch of overly specialized 
widgets that only happen in certain benchmarks...

Well, with some exceptions, like my ISA did end up with some amount of 
instructions that are a bit specialized towards graphics processing 
tasks and similar.



And, like, if one were doing a lot of work with JPEG or similar, a case 
could be made for things like YUV -> RGB converters and similar. 
Nevermind the specific version of YUV.

Some of my stuff used an approximation, say:
   Y=(4*G+3*R+B)/8; U=(B-Y)/2+128; V=(R-Y)/2+128;

Which while not an exact match for the standard color spaces, is "close 
enough". If mashing the result into RGB555 it may not really matter. 
Could be realized relatively affordably in a hardware implementation.

Well, and say:
   Y=(9*G+5*R+2*B)/16;
   ...
Would be more accurate, but slightly less cheap to convert back to RGB 
(even if, yes, these factors still allow the multiplications to be done 
via a LEA instruction or similar; it results in the reverse-side Green 
conversion no longer being a plain shift).

Say:
   G=(8*Y-3*R-B)>>2;
Vs:
   G=((16*Y-5*R-2*B)*57)>>9;


Note, although the standard math is a bit different, it more or less 
amounts to subtracting Y for forming U and V (not exactly, but doing it 
more accurately would make the conversion back to RGB more expensive).

As can be noted, within an RGB555 target space, the error from going 
mix/match with YCbCr / BT.601 is mostly small enough that (apart from 
high saturation colors) mostly falls below the level of RGB555 rounding 
error (and, with high saturation, still mostly +/- 1 for points within 
the gamut).


There is also RCT which I use a lot as well, but this is pros/cons (and 
if one goes mix and match between RCT and YCbCr, the visual result of a 
mismatch is a lot more obvious).

Well, and GDbDr, which while the cheapest option, is also the least good.


> The million instructions of AES don't feel very CISCy to me.
> 
> 
> === Stefan
Page 1 of 4 • 176 total messages
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads