Article View: comp.arch
Article #684Re: CISC are not "unreduced"
From: BGB
Date: Fri, 13 Nov 2026 11:28
Date: Fri, 13 Nov 2026 11:28
359 lines
15002 bytes
15002 bytes
On 11/11/2026 8:32 PM, MitchAlsup wrote:
> BGB <cr88192@gmail.com> posted:
>
>> 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.
>
> For my part, My 66000 was restricted to not add more than 1 gate of delay
> per cycle to any stage of the pipeline.
>
OK.
There are some things that could be done, but yeah, latency is a pain.
It is like the issue of early on, I mostly gave up on things like
1-cycle ALU ops.
Granted, 1-cycle AND/OR/XOR and 32-bit ADD would be possible, but:
AND/OR/XOR: Not really the heaviest used;
32-bit ADD OK, but still kinda tight.
Carry-select helps, but ironically it seems like carry-select is better
at allowing a 2-cycle 128-bit adder than giving a 64-bit result within
the same clock-cycle (or, at least when the ALU result needs to reach
the register forwarding).
Well, say:
16-bit: Carry-chain is faster;
32-bit: Nearly break-even;
64-bit: Carry select helps, but modestly;
128-bit: Carry select pays off a lot more.
For things like PC-increment and Branches, ended up doing a little
trickery. Originally, they would have had an implicit 4GB "do-not-cross"
boundary, but I figured out a workaround:
Branch predictor skips branches if they would cross a boundary;
Falls back to a slow-branch, which uses a full AGU;
Crossing a boundary can insert a pipeline stall or similar;
Inconsistent state stalls so carry can propagate.
The actual ADD takes place within a single cycle, but is 2-cycle mostly
for sake of forwarding the result.
I didn't see a big difference here between 6R and 4R, and early on it
was looking like only really 32-bit designs could easily hit a 100 MHz goal.
In a few cases, had pushed things to 75 MHz, but usually this required
more extreme corner-cutting that hurt performance:
Small caches;
Penalties for memory RAW and WAW scenarios;
Penalizing misaligned access;
...
Some FPGA soft-processors had also gained more clock speed by doing
things that would more drastically impact actual performance, like
faking 32 or 64 bit operations with multi-stage 16-bit ALUs.
Apparently people had also implemented a few 200 MHz bit-serial
processors. But...
A 200 MHz CPU that performs more like the 6502 in a NES isn't quite so
useful. And, any more than a few levels, and logic doesn't pass timing
at 200 MHz.
Some other people went the other way and instead targeted 25 and 33 MHz.
Seemingly, areas that tend to fail timing at times:
L1 D$ stuff;
Register-Forwarding path;
Instruction decoder path;
...
The ring-bus is at least easy on timing, one just sort of has to be
generous with forwarding cycles and not try to have too many shortcut
paths to allow things to spread out on the FPGA.
I mostly got tired of battling with a lot of this though.
In theory, a more efficient CPU design could be possible, but would need
to be more carefully engineered.
Had noted that while I could have an mode that simply drops some older
functionality off the CPU (say, a mode that only runs XG3 and RISC-V),
but itself this doesn't save all that much in terms of resource costs.
Can note that a CPU core that only runs RV64GC but is otherwise similar,
wont actually save much in terms of resource cost over still having XG3
(well, because mostly both need essentially the same stuff in the EX
stages and similar).
Well, and if one wants a small core, it also means no hardware FPU or
SIMD. Etc...
Comparably, the amount and variability of stuff attached to the EX
stages effects cost more than the exact size of the listing.
Listing size by itself matters less than things like instruction layout
variability and similar.
Most of the "cost" of adding instructions being not in the cost of
having them in the listing, but rather having any unique EX-side logic.
So, a "new" instruction is cheap if it is just plugging inputs into the
existing logic in a slightly different way; but not so cheap if it means
new logic or new paths.
>> 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.
>
> I did not find that, given that I waste no registers for immediates or
> displacements.
>
Big issue was mostly functions that have large numbers of live variables.
Seemingly, my own code seems more prone to run into cases of heavy
variable use, but then heavy variable use is often the path to better
performance.
Well, and a lot of C code that ends up almost more structured like ASM code.
>> 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 the only thing that always works is:
>
> MEM Rd,[Rbase,Rindex<<scale,#displacement{32 or 64}]
>
> You can access anything anywhere in a 64-bit VAS in 1 instruction--
> including transferring control through GOT.
>
That is a heavy-hitter, though usually "good enough" in practice to
treat index and displacement as two mutually exclusive scenarios and
require a LEA or similar to do both.
Getting a 64-bit 3-way addition to happen within a single clock-cycle
seems like a big ask though.
I mostly went with a more modest:
48 + 33 << (0..3)
Had some Disp64 cases, but decided to get clever and for Disp64 the
displacement and base register swap places; so the Disp64 functions like
an Abs64 with a register index, Which, is maybe jank, but worked...
Can note:
Base48 + Index48 << Sc:
Experimented with, worked, but a little harder for timing.
Experimental Addr64/Addr96 modes:
Avoids timing penalty as the addressing was split.
So, no carry propagation from low to high to worry about;
Was mostly just pulling a trick over the existing 48b addressing.
> -------------------
>> 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;
>
> My point on all of this is to find a way to avoid approximations and
> get the well defined math done cheaply.
>
Possibly, but the proper YCbCr math requires a lot of fixed-point
multiply and similar.
Could use SIMD, but then one is effectively needing to do a matrix-multiply.
And, then one still needs to range-clamp the output and similar.
...
So, TBD if there is a way to make it cheap.
Even with a crappy approximation, in a Cinepak style codec the YUV->RGB
is the bulk of the CPU time.
Though, did manage to get my recent experimental codec in this area to
have decode speeds of 350-500 megapixels/second on my Xen+ (with a
single-threaded decoder).
So, say:
UPIC as a video codec : ~ 90 Mpix/sec
BT6A (Cinepak-like) : ~ 350- 500 Mpix/sec
BT5C (vaguely CRAM like): ~ 700- 900 Mpix/sec
MS-CRAM : ~ 1000-1200 Mpix/sec
MS-CRAM:
Fastest, but terrible Q/bpp, more prone to become IO bound;
Proper CRAM also has 8-color blocks, but better off not used.
The add huge bulk, for not much gain in quality.
BT5C:
Much better Q/bpp, but best case quality is still CRAM-like
Neither BT5C nor CRAM can get particularly high image quality.
Well, like, the RGB555 and 1-bit selectors are a bit of a damper.
Was intended to try to get CRAM-like speeds, but fell short.
BT6A:
Theoretically can achieve better image quality;
YUV 4:2:0 with an 8-bit / channel;
Fiddling has managed to get promising Q/bpp;
Managed to get moderately fast decode speeds.
However, work is ongoing to make the encoder fast enough.
Not going to work if videos have implausible encode times.
Idea was to try for "kinda like Cinepak but compresses better".
UPIC:
Design is sorta like T.81 JPEG but with different transforms:
8x8 BHT in place of 8x8 DCT
RCT in place of YCbCr
STF+AdRice (or now STF+AdSkew) in place of Huffman
...
Added motion vectors and skip/delta blocks for video, like H.261;
Could mostly manage 360p at 1 Mbps.
Trying to to 720p and it totally falls on its face.
Seemingly needs ~ 5 Mbps for semi-passable 720p.
Should have been 4, but needs an extra 1 Mbps here.
Theoretically, UPIC's Q/bpp could be helped with an in-loop deblocking
filter and sub-pixel steps; but, these would (relatively speaking) tank
the decode speeds. Could in theory have a multithreaded decoder, but
multithreading here is a cheap trick to make slow code look faster.
UPIC was originally more intended as a plain image format though, and
does better in this role. It can partly take on PNG and JPEG use-cases
(while being a little faster than either).
For images, UPIC naturally supports a lossless mode by way of using
reversible transforms.
Meanwhile, BT6A needs a computationally demanding encoder to give
acceptable compression. Could maybe do a quick-and-dirty encoder for
lower compression, but then it is basically just dumping YUV with extra
steps.
The big expensive thing mostly has to deal with "codebooks", eg:
2x2 pixels, stored as delta-coded Y,Y,Y,Y,U,V
4x4 pixels, stored as four 2x2 codebook indices;
Or, 2x2 block zoomed to 4x4.
8x8 pixels, stored as four 4x4 indices;
Or, 2x2 zoomed to 8x8;
16x16 pixels, stored as four 8x8 indices;
Or, 2x2 zoomed to 16x16.
Basically, it operating on 16x16 blocks and recursively subdividing them
quad-tree style to decide how to best encode them; building a running
set of codebooks and then searching these codebooks to find indices to
build the desired blocks (and track block lifetime and simulating the
running state of the decoder at each step). This process leading to a
relatively computationally-intensive encoding process.
Also, for better or worse, makes significant use of the properties of
Hilbert curves. Nevermind if putting all the pixels for a 16x16 block
into Hilbert order may seem needlessly convoluted.
However, with a lot of fiddling, was able to push the encoder into an
area where it sorta overlaps with JPEG (BT6A still obviously inferior on
Q/bpp though).
Still seems like something, as BT6A lacks an entropy coder.
Though, for better or worse, post-compression does very little for BT6A
in this case. Despite being a byte-based format, there is seemingly not
much entropy for an entropy coder to extract.
Have been able to push images below 1.0 bpp with tolerable quality,
which is maybe still notable for a format without an entropy coder...
Still not a particularly "simple" format code-wise.
Though, checking, its decoder is still a little shorter than the BT5C or
UPIC decoders, so at least it is not unreasonable.
Note:
Neither 5C nor 6A being intended to try to deal with the same use-cases
as H.264 or similar though...
Well, 6A was more just to test out a design that I had thought up within
the context of a sci-fi story though. Got it working acceptably, so the
depiction in the story (of its general features and its artifacts)
basically matches up.
Nevermind if my description of artifacts was mostly based on describing
the artifacts visible in Cinepak, with slight artistic license.
Nevermind whether or not this sort of stuff makes for "gripping sci-fi"
(and it is debatable if the story is even sci-fi when most of the
in-universe tech is kinda inferior to what we have now).
...
Technical Details
Message-ID:
<11d6s8e$oqin$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11cpqih$acf5$1@dont-email.me> <11cr2g5$q796$2@dont-email.me> <2026Nov9.071302@mips.complang.tuwien.ac.at> <11cru1e$11qpi$1@dont-email.me> <2026Nov9.091404@mips.complang.tuwien.ac.at> <11cti0c$1lilf$4@dont-email.me> <11cuoa4$21279$1@dont-email.me> <jwvcxscsjsa.fsf-monnier+comp.arch@gnu.org> <11d2jle$3cijo$1@dont-email.me> <1794450754-5857@newsgrouper.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: BGB <cr88192@gmail.com> Newsgroups: comp.arch Subject: Re: CISC are not "unreduced" Date: Fri, 13 Nov 2026 05:28:14 -0600 Organization: A noiseless patient Spider Lines: 359 Message-ID: <11d6s8e$oqin$1@dont-email.me> References: <11cpqih$acf5$1@dont-email.me> <11cr2g5$q796$2@dont-email.me> <2026Nov9.071302@mips.complang.tuwien.ac.at> <11cru1e$11qpi$1@dont-email.me> <2026Nov9.091404@mips.complang.tuwien.ac.at> <11cti0c$1lilf$4@dont-email.me> <11cuoa4$21279$1@dont-email.me> <jwvcxscsjsa.fsf-monnier+comp.arch@gnu.org> <11d2jle$3cijo$1@dont-email.me> <1794450754-5857@newsgrouper.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 13 Nov 2026 11:28:15 +0000 (UTC) Injection-Info: dont-email.me; logging-data="813655"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qrYWCYlYUY31xAxLTnOnL0ZgHUDPHP0E="; posting-host="31e799b15a89ad0e63da3475fa0f1057" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:pXhJI2ginZfhcj7Yc0H0y2nTWKA= sha256:9j4BpyysQzaK4+S7ZNWsmajkgncsfUtks11MnSj8kt8= sha1:BUSTgRq1KzkigfceWTBaPSr+uE0= sha256:8Nhpk7elRkWI1OUpgmCieG5c9MyI4SS8yaEl9C3Bs/E= In-Reply-To: <1794450754-5857@newsgrouper.org> Content-Language: en-US