🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #846

Re: Very Depressing Video

#846
From: BGB
Date: Sat, 21 Nov 2026 00:26
321 lines
14296 bytes
On 11/19/2026 6:38 PM, John Savard wrote:
> This YouTube video
> https://www.youtube.com/watch?v=1565YYsFmd4
> is about the HiFive Premier 550.
> 
> Apparently it's the fastest RISC-V board yet made available to
> enthusiasts and hobbyists.
> The good news was that the software situation for RISC-V... has
> improved, though it's still less than perfect.
> The bad news... although it's the fastest RISC-V currently generally
> available, it's far slower than modern commodity hardware using
> popular architectures like x86 and ARM.
> 

It is pros/cons:

Need to convince the RISC-V ISA people to address the most obvious 
deficiencies in the ISA, and not just try to keep kicking the can down 
the road.

In cases where "you don't really want this on a microcontroller" or 
similar, just not put it on a microcontroller.


And maybe convince the hardware people that stuff like having the chips 
use trap-and-emulate whenever they encounter a misaligned memory address 
is not an acceptable option for the performance.

Or, that chasing stuff like RV-V, without addressing some of the more 
fundamental issues, is a fool's game. Or, "We have V, so let's drop F/D 
and just use V instead!" is profoundly stupid.


One can argue maybe my leaning toawrds using traps for TLB miss handling 
is bad, but IMO it is still less bad than using traps for misaligned 
handling or for FPU.

Well, since TLB misses can tend to stabilize towards a steady-state and 
then sharply drop-off to a fairly low-level provided the TLB is big 
enough to cover the working set (and one doesn't do a full TLB flush on 
context switches, ...).

Contrast for misaligned, which happens every time a misaligned access 
happens:
   Best case, it is rare, so no big issue;
   Less good case: performance tanks.


Likewise, V-only is also stupid for general use, more so when code is 
already being built against RV64GC which includes F/D, so dropping them 
in favor of V just means performance will be awful, and one will lack a 
good way to do scalar floating point, except maybe Zfinx/Zdinx, but, 
then they made them effectively mutually exclusive, and code that is 
compiled against RV64GC wont work on Zdinx or vice-versa.

Well, absent the expectation that the compiler is smart enough to 
auto-detect and-or do mutually-exclusive register allocation in the face 
of "who knows whether it is the same register or different registers". 
Which, compilers don't really do, and it would be kinda stupid to expect 
them to do so "just in case" as this necessarily increases effective 
register pressure for no real gain on either side of the balance.


Well, unless the idea is that basically everyone is going to rely on 
hot-patching.

...


Also maybe ask people to tune things for general effectiveness, not just 
to maximize scores on specific benchmarks. One could argue that my use 
of 90s era games and similar could hardly be considered more general, 
but IMO, this is missing the point.


Like, if someone thinks that they need a "carryless multiply" 
instruction more than they need a non-terrible way to load elements from 
arrays, or a good way to implement 32-bit zero-extension, they are 
optimizing too much for the benchmarks.


...




But, then again, I can note that some people seem to approach ISA design 
more like I approached image/video codecs, which itself ended up as a 
bit of a jungle.


BTICxx:
   1x: Mostly designs evolving from the RPZA approach.
     Basically ended at 1H.
   2x: JPEG/MPEG inspired designs.
     Mostly ended up as UPIC, which mostly carries of the same patterns,
       but diverged from the naming scheme.
     Not strongly pursued as speed is difficult.
       Similar mainstream codecs rely on special hardware acceleration.
         Eg: H.26x, etc...
         Hard otherwise to make it fast enough for 1080p/2160p.
   3x: Quickly died, attempts to combine 1x and 2x.
   4x: Like 1x (1H) but using 8x8 blocks rather than 4x4.
     Going to larger blocks was detrimental from a complexity POV.
     Can't just make the color-cell block bigger and expect good results.
   5x: Another partial reboot of 1x, but with more MS-CRAM influence.
   6x: A newer experiment involving a Cinepak inspired approach.
     Initially looked poor, but has quickly gained effectiveness.
     High encoder complexity, but reasonably fast to decode.
       Can do 4K with a single-threaded decoder.


6A:
Current experiment, is fast enough to play 4K video on my PC with a 
single threaded decoder; which for 30 fps video has a minimum decoder 
speed of around 250 megapixels/second. In some of the FMV tests it can 
reach around 500-700 to RGBA32, pushing against some of my color-cell 
based designs.


Did debate how to best add transparency support to this:
   An alpha layer would add cost/complexity;
   The endpoint-ordering trick (used in the 5x line) does not apply;
   ...
Decided to go with an approach I had once used to glue transparency 
support onto a tweaked version of the Xiph Theora codec:
   Encode transparency mostly using out-of-gamut colors.
     Large fully-transparent block: "Super Magenta" (Y=0, U/V=255);
     Partial Block: adjust U/V such that Y=0 is out of gamut;
       Use Y=0 for transparent, Y>=20 for non-transparent.
   Hooks onto the normal out-of-gamut clamp handling path;
     So, in-gamut colors are "safe" and pay no extra penalty here.


Did end up going and adding some tricks to try to skip memory copying 
for "double plain skip" blocks, and to skim pixels off of copying rows 
of blocks to client memory when it detects the client is using 
single/double buffering.

Partly as it seems the codec is operating in a realm where intermediate 
memory copying costs are eating into throughput (memcpy starts showing 
up a fair bit in the profiler results in this case; where memcpy can 
move RGBA32 pixel data at ~ 925 Mpix/sec; vs ~ 1850 for RGB555). It can 
be moderately faster to detect the non-changed block status and skip 
copying than to naively "just copy all the memory to the client" on P-Frame.


well, also can't really make the codebooks much larger as this 
negatively effects speed.

Well, 4K entries for the 2x2 codebook is pushing it, but the gains in 
compression were mostly enough to justify the modest speed cost 
(1K/2K/4K is still small enough that bigger codebooks improve 
compression, without the major performance tank that starts to happen 
with an 8K or 16K codebook).

Although ATM the codebooks are too big to fit in the L1 cache, I suspect 
the distant entries are being used infrequently enough as to not wreck 
performance. Would mostly need to use a 1K codebook to keep things more 
comfortably in the L1 cache though.


TBD how much of a "free lunch" effect there is due to the Xen having 
associative caches though, so it could be that there would be a need to 
drop back to 1K or 2K entry codebooks for a direct-mapped cache 
(assuming the codec still works OK on my CPU core; and I probably will 
need to add a special RGB555 fast-path in this case).

Well, say:
    4K for 2x2  : ~ 24K cost (6B/entry)
    2K for 4x4  : ~ 16K cost (8B/entry)
   512 for 8x8  : ~  4K cost (also 8B)
   256 for 16x16: ~  2K cost (also 8B)
So, say, this is 46K, well exceeding 32K of L1 cache.

Initial plan was more like:
  1024 for 2x2  : ~ 6K cost (6B/entry)
   512 for 4x4  : ~ 4K cost (8B/entry)
   256 for 8x8  : ~ 2K cost (also 8B)
   128 for 16x16: ~ 1K cost (also 8B)

Or, 13K, which while faster, does come at a noticeable Q/bpp penalty.
The smaller-sized codebooks are larger because they see a lot more 
traffic and also tend to be longer-lived (whereas entries in the 8x8 or 
16x16 codebooks tend to not live very long before the backing entries in 
the smaller codebooks expire; and because they also "hit" less often).

Well, with each larger entry consisting of 4x 16-bit indices to the next 
size down (vs the bottom level holding YYYYUV vectors).


Output pushes the YUV -> RGB stage pretty hard, but a fair bit of this 
is memory-output and pointer-address twiddling rather than purely about 
the transform.

It is possible I could make the final 4x4 transform stage a little 
faster by flattening it out and maybe changing how the final 4x4 Hilbert 
curve is handled.

...



Not much ISA design stuff from me as of late.
Having mostly run into a "seems like it is mostly good enough" wall.

And, main forward path is mostly continuing to try to debug/polish BGBCC 
or to make TestKern into a more solid OS, which personally I am not 
finding as interesting at the moment.

Though, the last time I started running into this wall, ended up 
creating XG3, which did create a bit more activity for a while.


Compiled some stuff, noted BGBCC was crashing, then ended up dealing 
with more broken edge cases in BGBCC's handling of C.

Though, in the process, now my "reducer" stage can evaluate stuff like:
   (int)(&(((Foo *)0)->bar))
As a constant expression...

Well, along with finding a few more bugs in my compilers' handling of 
the reachability graph (it was failing to traverse some expressions, 
potentially resulting in reachable code/data not being reached until 
after it was already marked as culled).


But, yeah, everything seems good sometimes, until more bugs show up.



Otherwise, the TestKern GUI subsystem is basically stalled, and I am 
left debating whether I had been taking the wrong approach to the GUI 
and Window Manager stuff.

Had sort of ended up thus far bolting the WM directly onto the kernel 
and low/level drawing code. Debating if it would be better for this 
stuff to be split up.


Or, say:
   Application -> TKGDI (API)
   TKGDI ?-> Window Manager
   Window Manager -> Drawing-API (another TKGDI context?)

Maybe the TKGDI API remains as-is when used in the context of 
interfacing with the display hardware interface, but some functionality 
is folded off and "spring-boards" to the WM's API.

Other sub-goals:
   Maybe try to get GUI stuff out of the TestKern kernel proper;
   Also get TKRA-GL out of the kernel proper;
     Maybe still hangs out with the WM in kernel space though.

Maybe rework the architecture enough that I can host/debug the WM code 
natively on Windows (without direct dependency on Testkern kernel stuff).

Also would be nice to have some sort of desktop UI beyond just summoning 
a shell/terminal window to be used to launch other stuff.

Also TODO:
   Figure out better ways to generalize fonts and text-rendering;
   Some sort of VfW style API and mechanism for loadable codec modules;
     Will also need to address still-image decoding;
   Implement a file browser and proper desktop (with icons and stuff);
   ...

Like, ideally, you don't want every program to necessarily need to 
supply its own text-rendering and image-loading and video codec stuff 
(even if in practice this stuff often ends up being duplicated across 
nearly every program that deals with it; or use OS level APIs and 
instantly become non-portable).

In an ideal case, the same fundamental APIs could be made portable 
between targets and implementations, even if not necessarily as "clean" 
as a purely native API.


In this case, a lot of this isn't so much about the code to do these 
things, rather more about the structure and contents of the relevant 
VTable objects.

Well, or do like older Windows style drivers and use a DriverProc 
"do-everything function-pointer" based interfaces, but, this would kinda 
suck. But, alas, it is where to draw the lines for things. The 
DriverProc approach offers a for more general "what are you and what do 
you do?" probing interface for drivers/etc.

Whereas, for VTables, kinda already need to know what the thing is. And, 
function pointers can arguably allow for a "GETINTERFACE" style message 
when it is necessary to switch to objects (or, alternatively, can use as 
a wrapper to implement a "GetProcAddress" style mechanism as well, 
rather than depending on ability to query DLL exports directly).

Or, ye olde:
UINT (*DriverProcFn)(HANDLE hInst, UINT uMsg,
   LPVOID lpParm1, LPVOID lpParm2);

Though, if things are done well, the same modules code could be usable 
both for running in TestKern and for debugging on Windows, since DLL 
exports don't really care. More just the driver module needs a way to 
call back into TestKern.

TDB: Could be lazy and just sort of scavenge parts of the VFW and ACM 
interfaces and similar as-is for the driver level parts, but, TBD, this 
is a gray area (well, beyond having already borrowed things like 
BITMAPINFOHEADER and WAVEFORMATEX and similar...).


Well, this stuff being the "not particularly fun" parts of OS design.


Not sure if there are any useful insights to gain from historical 
systems here.

Or, if there is really any point...


> John Savard

Technical Details
Message-ID: <11dqof9$3m0uk$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <6aff95fd.2756312@news.eternal-september.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.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: Very Depressing Video
Date: Fri, 20 Nov 2026 18:26:16 -0600
Organization: A noiseless patient Spider
Lines: 321
Message-ID: <11dqof9$3m0uk$1@dont-email.me>
References: <6aff95fd.2756312@news.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 21 Nov 2026 00:26:18 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3867604"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+xs1B1SjKRj+w/e++JjfccfU6dz6T2fQM="; posting-host="5c5d812a6c30b0a455a3fb7981b3d820"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:lAPwjs5vxpsOowUiWjbrPnM/kYw= sha256:S0HiOaZa4qW9m2aEZZY18db6Lj3I0OUomkPfxqhgFOg=
	sha1:jO+ISOfY/BObr/+cc0FthVkPuzQ= sha256:Zz2/RBtHdLl7Zo7PMZWhzI3vAURVDhjHkjXqizaXv90=
In-Reply-To: <6aff95fd.2756312@news.eternal-september.org>
Content-Language: en-US