Thinking about Schematics vs. Code. [This began as...
# thinking-together
g
Thinking about Schematics vs. Code. [This began as a short reply to @Stefan regarding my take on electronics schematics in another thread.] https://open.substack.com/pub/programmingsimplicity/p/2024-07-17-thinking-about-the-game?r=1egdky&utm_campaign=post&utm_medium=web&showWelcomeOnShare=true
đź‘€ 1
k
Thanks @guitarvydas for this detailed explanation with a nice example! There's one aspect I find missing from the discussion: CPUs. Early CPUs, the ones for which our languages, compilers, etc. were designed, have no accessible parallelism (and the very early ones no parallelism at all). There's a single instruction stream. In that universe, function-based programming did not any additional synchronicity constraint. Today, all CPUs and GPUs have some level of parallelism, but it's not under the control of the software. If I have a four-core processor, I can run up to four independent threads. That's a pretty severe constraint on asynchronicity in software as well. So I wonder how we could possibly get to your dream situation of "as many asynchronously working subsystems as our design requires" with today's processors and no software layer for multithreading on top of them.
g
The issue of CPUs is addressed, but, maybe not with enough brutality There’s approximately 60+ truly-asynchronous processes on the 1972 Pong schematic, but no CPU. The design employs massive parallelism and real internal asynchronousity. In 2024, we consider 8-ish cores to be a marvel. The cores share memory, so they cannot even be truly asynchronous. That’s some 50 years later. Something is wrong with this picture. A CPU was originally meant to be a simple sequencer circuit that was not reentrant. There is no reason to make CPU’s multi-threaded, other than co$t. In 1950, it was too expensive to own more than one CPU, so human brain-power was wasted on inventing and adding software to make CPUs multi-threaded. Today, we have access to very cheap hardware actors - Arduinos, Rasberry Pis, etc. (cheaper yet, if you discard Linux and reclaim internal chip space). N.B. “central” is a bad word these days. We probably want DPUs (distributed processing units). I previously tried to write about hardware actors in https://guitarvydas.github.io/2024/02/17/Hardware-Actors.html. So, one might imagine a reprogrammable electronic machine (avoid the use of the word “compute-er”) to be a collection of 1,000s of cheap hardware actors on-a-chip, where only one of them is a big honking Linux blob for running existing bloatware and for backwards compatibility. @Konrad Hinsen
k
Thanks @guitarvydas, that confirms my suspicion. Are you aware of any projects to create such massively asynchronous devices? All I remember having seen in this space is the MIT Connection Machine.
g
I am aware of, but, haven’t deeply explored… Chuck Moore’s GA144 (https://www.greenarraychips.com), LLMs, internet, Dave Ackley’s T2 Tile project, the human body, blockchain, transputers (https://en.wikipedia.org/wiki/Transputer), quantum computing, neural nets (and Bart Kosko?). LLMs are based on simple synchronous technology, but, to my understanding the real secret sauce is the zillions of weights derived from access to the New Library of Alexandria and a massively parallel version of the game of Plinko. @Konrad Hinsen
b
Interesting case study! (I heard about Pong circuits but haven't seen them) I wonder what you'd say about Scratch/Snap!'s programming model — it's a bit closer to circuits by running many small loops in parallel, each belonging to a single sprite. E.g. here is someone's 1-player pong. The UI doesn't offer "everything on one page" view, you have to click specific sprites (Ball, Paddle, ...) in bottom right, but for the most part that helps understanding. (There is 🗋->Export summary... but it loses the spatial organization)
But I feel Pong has unusually good fit for a circuit. It'd be harder to do say a word processor on circuit, and very tempting to base around a CPU, no? Even simple tweaks to the game, like having a variable number of balls in flight, become harder to do in pure HW, or at least harder to keep nice isomorphism between circuit parts and problem parts. I suppose I'd put the ball positions in addressable RAM, and make the ball logic iterate over them in a loop (with a counter). Sequencing such things quite quickly starts tempting to add a micro-controller... [However, much of our instincts that SW is easier than HW is rooted in the ease of changing SW. That's the root of the "soft-" vs. "hard-" words after all! But if you take schematics as inspiration for visual programming, that's irrelevant.]
Also, I find it hard to share your enthusiasm for async parallelism. Again, it might fit some problems, but I've seen too many concurrency bugs to see it as a "pro"... However it's curious that Functional Reactive Programming claims to avoid many concurrency glitches, yet connects together pieces of code quite similarly to circuits 🤔 Maybe it's less about sync/async and more about styles of composition?
🤔 1
k
@guitarvydas I prefer to stay in the realm of digital computation, so I accept neither the human body nor quantum computing. But the other examples are worth exploring! I agree that LLMs deserve much better adapted hardware than today's GPUs, but I suspect that everyone is so busy training their LLM to beat their competitors' LLM that nobody has any time to think about the fundamentals.
g
@Beni Cherniavsky-Paskin Interesting thoughts. “… but I've seen too many concurrency bugs …” I’ve come to the conclusion that a lot of concurrency bugs are due to self-flagellation cause by the use of the wrong notation / paradigm. FTR, I emphasize async because I perceive it to be underemphasized, but, I think that a hybrid of async+sync is the goal. To me, async enhances composition. …more mulling-over required…
@Konrad Hinsen I would guess that many of the items on my list don’t fit your expectations for usable massive parallelism. I am peripherally interested in these items because they all smack of parallelism in some way, and, I’m interested in ideas. The objective of T2 is different from my interests, but, it appears to use massive parallelism anyway. I forgot to mention Ceptre. I mention the human body, since I meet monthly with someone who is into robotics and my overwhelming thought is “but, but, this is just a combination of 500 little stepper motors”. I, also, forgot to mention a commercial effort for heath monitoring and drug testing race horses (ugh, I can’t remember the name at this moment, it’s buried in my email archive somewhere). The guy strapped 36-ish little rPis/Arduinos running micro-Python onto each horse and networked the electronics together. He was hoping to use blockchain to store unalterable health records. He was monitoring horse health and creating notifications if any irregular health symptoms were detected in the middle of the night.