From: Shawn Rutledge <lists@ecloud.org>
To: 9front@9front.org
Subject: Re: [9front] Thoughts on Wayland?
Date: Mon, 5 Aug 2024 13:05:06 +0200 [thread overview]
Message-ID: <20240805110501.asula7k52eo5gdld@black> (raw)
In-Reply-To: <7003a121-ae98-4a24-b0dc-778c3b086310@sirjofri.de>
On Mon, Aug 05, 2024 at 10:52:58AM +0200, sirjofri wrote:
> 05.08.2024 10:34:45 ori@eigenstate.org:
> > shared memory just isn't a very good model for distributed systems.
> > devdraw is more or less what you get if you make a slimmed down cairo
> > the native drawing model, and talk to it over a pipe for rpcs, but your
> > musings are gradually reinventing devdraw :)
>
> That's what I like about GPUs: they have dedicated memory and you have
> to upload manually. No synchronization issues, just what you upload is
> there. It's basically a different machine.
>
> Also, the design is extremely similar to devdraw, just that you can
> upload programs and arbitrary data. Imagine all your graphics routines
> are executed on the devdraw server side, and you just kick off those
> programs from the client. That would mean fluent animations with many
> frames, and the cpu that runs the client application can just relax.
Dedicated GPUs are like that, so portable APIs need to support working
that way. But often on integrated graphics, GPU memory is just a chunk
of system memory, which makes the "upload" trivial in practice. Perhaps
it can even be zero-copy sometimes, if there's a way to just map a chunk
into GPU-managed space after it's populated?
It's very useful for AI applications when there's a lot of system memory
and the boundary for "dedicated" GPU memory is fully flexible, as on
Apple's unified memory. (For example I found that I can run a fully
offline LLM with ollama on a modern mac; and after that, I stay away
from all the online LLMs... I don't trust them, they are ultimately
greedy, and if something is "free" it must be that we're helping them
train it better by using their throttled interfaces.) So I'm not sure,
but maybe we can expect that kind of architecture to be more common in
the future.
And it would be nice to have a way to avoid spending system memory at
all for GPU resources, to be able to stream directly from the original
source (e.g. a file) to GPU memory. This is an issue in Qt (my day
job)... we have caching features in multiple places, we try to avoid
reading files and remote resources more than once; but if you're playing
an animation, and the desired end result is to have the frames as GPU
textures, and you have enough GPU memory, then it should be ok to lose
the CPU-side cache. Especially if the cache was not already in
GPU-texture form. Decoding simple formats like png and gif is fast
enough that it doesn't even matter if you need to do it multiple times:
not worth caching frames from them, IMO, unless the cache is on the GPU
side. But I think the tradeoffs are different for different sizes. In
some cases, an animated gif can be very compact and yet a full set of
decoded frames can be enormous, so it doesn't make sense to cache it
anywhere. Decoding one frame at a time is the cheapest. Even if you
had to keep re-reading the file, doesn't the OS cache the file contents
in RAM anyway? (A controversial position, I'm sure.) So how and whether
to decide at runtime what to cache how and where, or leave it up to the
application developer by exposing all the suitable APIs, is Qt's
problem... sorry for the digression, my point is just that
upload-and-forget is not the only way that a GPU needs to be used.
Likewise large games are often streaming assets and geometry to the GPU
more or less continuously, from what I've heard: depends which assets
they can reasonably expect to be reused and to have enough GPU memory to
retain them, I suppose?
It's also my daydream to get the GPU to take care of UI rendering more
completely, even for simple 2D stuff, and free up the CPU. It's one
thing I'm hoping to achieve with my 9p scenegraph project (which is
a slow-moving side project, not a Qt project). But in general, there
might also be a backlash against excessive GPU usage coming, if people
expect to use the GPU mainly for "hard problems" or embarrassingly-
parallel algorithms like AI and 3D graphics, and not load it down with
simple stuff that the CPU can just as well do for itself. And battery
consumption might be a concern sometimes too. My attitude towards old
CPU-based paint engines like draw and QPainter has been kindof negative
since I started at Qt, because we've been trying to sell the idea that
you have a GPU, so you might as well use it to get nice AA on all your
graphics, animations "for free", alpha blending, and stuff like that. I
still think AA is really a killer feature though. Just about makes
2D-on-the-gpu worthwhile all on its own. But Plan 9's draw could not
have AA on everything, could it?
So while _I'm_ still interested in 2D on the GPU, I admit that you might
be onto something with your gpufs proposal, to focus on treating it more
like a computing resource than a fundamental piece of the graphics
pipeline. But I think we should have both options. ;-)
> With complex applications with hungry code and hungry graphics (many primitive draws)
Many draw calls are the enemy of performance when it comes to GPU
graphics. This is the main reason for needing a scene graph: first get
the whole collection of everything that needs to go to the screen
together into one pile, in an efficient form that is quick to traverse,
and then traverse it and figure out how to combine the draw calls.
(There is an impedance mismatch between any turtle-graphics or
paint-engine API, and the GPU. You can solve it if you can intercept the
draw calls and have them only populate the scene graph instead. Never do
any drawing immediately on-demand. Or, give up on the imperative API
altogether: be declarative.) This is the thing that Qt Quick is good at.
The interesting question for me now is how best to map that idea to a
filesystem.
Are you trying to have gpufs as an endpoint for uploading assets that
could be invoked via draw calls too? Or just as a way to invoke the GPU
to do embarrassingly-parallel computation at whatever stage one wants to
use it for? (Why not make it possible to use it both ways, eventually?)
But I would expect that this fs will have a close-to-the-hardware
design, right?
next prev parent reply other threads:[~2024-08-05 11:09 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-04 19:26 Willow Liquorice
2024-08-04 19:44 ` Stuart Morrow
2024-08-04 19:49 ` Willow Liquorice
2024-08-04 19:54 ` Eli Cohen
2024-08-04 19:59 ` Eli Cohen
2024-08-04 20:04 ` Eli Cohen
2024-08-04 20:05 ` Eli Cohen
2024-08-04 20:09 ` Willow Liquorice
2024-08-04 20:29 ` Eli Cohen
2024-08-04 21:23 ` ori
2024-08-04 21:43 ` ori
2024-08-04 22:00 ` David Leimbach
2024-08-04 22:22 ` ori
2024-08-04 22:42 ` David Leimbach
2024-08-04 22:57 ` ori
2024-08-04 21:10 ` Willow Liquorice
2024-08-04 21:24 ` ori
2024-08-04 21:25 ` Eli Cohen
2024-08-05 8:13 ` Willow Liquorice
2024-08-05 8:29 ` ori
2024-08-05 8:52 ` sirjofri
2024-08-05 8:57 ` Noam Preil
2024-08-05 9:12 ` sirjofri
2024-08-05 11:51 ` hiro
2024-08-05 9:03 ` Willow Liquorice
2024-08-05 11:05 ` Shawn Rutledge [this message]
2024-08-05 12:01 ` hiro
2024-08-05 12:26 ` sirjofri
2024-08-05 11:15 ` David Arnold
2024-08-05 11:47 ` hiro
2024-08-05 12:35 ` sirjofri
2024-08-04 20:01 ` Willow Liquorice
2024-08-04 21:23 ` sirjofri
2024-08-04 20:08 ` mkf9
2024-08-04 20:35 ` Willow Liquorice
2024-08-04 20:32 ` Pavel Renev
2024-08-04 21:31 ` ori
2024-08-05 6:09 ` Noam Preil
2024-08-05 8:02 ` hiro
2024-08-05 11:51 ` Shawn Rutledge
2024-08-06 16:37 ` hiro
2024-08-06 17:57 ` sirjofri
2024-08-07 9:27 ` Steve simon
2024-08-07 11:47 ` hiro
2024-08-05 12:54 ` Willow Liquorice
2024-08-05 13:13 ` [9front] Fortune worthy Steve simon
2024-08-05 20:06 ` [9front] Thoughts on Wayland? Jon Sharp
2024-08-06 0:07 ` Eli Cohen
2024-08-06 0:09 ` Eli Cohen
2024-08-06 1:57 ` Michael Misch
2024-08-06 13:01 ` Emil Tomczyk
2024-08-04 22:27 ` Dave MacFarlane
2024-08-05 6:10 ` Noam Preil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240805110501.asula7k52eo5gdld@black \
--to=lists@ecloud.org \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).