Article View: comp.arch
Article #598Re: vector length CSR?
From: George Neuner
Date: Sun, 08 Nov 2026 23:17
Date: Sun, 08 Nov 2026 23:17
172 lines
8567 bytes
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
Technical Details
Message-ID:
<8jk1fl182pskj3fsmp4ju6qf420pgl0htg@4ax.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11cpqih$acf5$1@dont-email.me> <sgu0flpndaqltpdbft40fghmi7vk78q2hs@4ax.com> <11cq2v7$dh5b$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: George Neuner <gneuner2@comcast.net> Newsgroups: comp.arch Subject: Re: vector length CSR? Date: Sun, 08 Nov 2026 18:17:42 -0500 Organization: A noiseless patient Spider Lines: 172 Message-ID: <8jk1fl182pskj3fsmp4ju6qf420pgl0htg@4ax.com> References: <11cpqih$acf5$1@dont-email.me> <sgu0flpndaqltpdbft40fghmi7vk78q2hs@4ax.com> <11cq2v7$dh5b$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Date: Sun, 08 Nov 2026 23:17:45 +0000 (UTC) Injection-Info: dont-email.me; logging-data="844287"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/RmK3oDXx51QK7OHlVDJn0IhgIebzNk9w="; posting-host="4cbe7cdac90406cd8f1a90f70e7a2560" User-Agent: ForteAgent/8.00.32.1272 Cancel-Lock: sha1:Q3+u9gm8iPGNLyr4inz3sqdR98c= sha256:+DYIv0YtL3r5+LnOwG+aWuZDW56Fg4dUig37zssuCJw= sha1:HP4ctsMS9ldz8vLHn7uP6S4uQeI= sha256:ize/GhCMJUDIgTqhnuN27nKPuc/mCSq4B9bxbZVd2Fs=