[ back to Tom 7 Radar ]

p
e
r
s
o
n
a
l
From now on, the title of the post is allowed to just be "January 2024" (only when it is January 2024, however) (31 Jan at 22:08)
Hello again,

This month I've been plugging away on the project I mentioned in the previous post which involves among other things a PDF generator and now an implementation of ML (as in Standard ML, but also the other one). This is probably the 10th "compiler" I've written in my life, and it's kind of fun to revisit these problems that you've done many times and try out different approaches, although this time one of the approaches is "Use C++" (for reasons of making good on a joke, but also for reasons of mlton doesn't work on my computer any more). And although C++ is a fine tool for many applications, it does have some deficiencies for the task of writing a compiler (one of the most irritating: a very modest limit on the stack depth? Like my computer has 256 Gigabytes of RAM and 2^64 virtual addresses and somehow it can only manage 1 megabyte for the stack and there's no standard way to increase it? Get off my lawn). But then you can also experience new ways of struggling with C++, like: A middle of the night power failure wrecked my computer's GPT (as in GUID Partition Table, but also the other one) and I was deep in the depths of taking the computer apart to reset its parts, its BIOS (its Basic In/Out System, which is where it stores its biography) and its hard drives were everywhere on the floor, and it could not be saved, and this after I already broke my computer this year by trying to put the world's biggest video card in it, too hard. And I could not merely perform recovery because of Unknown Error, so I had to begin anew again and restore from backups. But when you restore from backup and you're in the mood of "why is this so complicated and I don't understand how computers work any more?" it occurs to you (me) to also change your underlying development environment instead of reinstalling the devil you know. So I ended my friendship with Cygwin64 and switched to new best friend MSYS2. Both of these things are different ways of wishing that you were using Linux while you're using Windows. The main reason I tried this new way of struggling is that Cygwin is very behind on its version of x86_64 clang (C++ compiler), which I wanted to try because it supports AddressSanitizer and clangd on Windows, and I wanted to give LSP in emacs a shot (it's finally good!). There were a few growing pains, but I think MSYS2 is what I would recommend now. One of the nice things they did was create multiple different environments depending on what you want to do (e.g. "I want to use clang to compile x86_64 code" or "I want to do 32-bit cross compilation for ARM") and in that environment, you just say "g++" and it invokes the compiler you want, instead of the weird contortions I've been doing for years with manually invoking x86_64-w64-mingw32-g++. I was also able to get clblast working before being too filled with rage to continue, so that is nice for the ML inference on the world's biggest graphics card. I made these graphics to help me tune the correct settings of GPU layers (y axis) and number of threads (x axis):

tune-single
tune-single
tune-batch
tune-batch


In some sense the results are obvious (more threads and more layers is faster) but it was interesting to me how the cliff of performance drops off at a different number of layers for single and batch mode (I guess because the batch needs some memory itself?) and how it's clearly better to use fewer threads than cores for batch as well. I was not surprised to see performance drop off for >32 threads (everybody knows that hyper-threads kinda suck) but I was very surprised to see performance pick up again when it gets back up to 64? And only for single mode? I wish I understood that better. But mostly I'm a sucker for the custom visualizations.

Right but when writing this compiler I realized that I wanted to use some Greek letters, and I can't handle it when some characters are in a different font in my source code, so I finally made some space for those in my programming font FixederSys. These certainly still need some tweaks, but it's already better than just being in some other weird font:

{{{caption}}}
{{{caption}}}


You can also see that I have been adding some "useful" emoji at the top. It is an interesting puzzle to try to make these things recognizable (especially for the 1x version, whose charboxes are 8x16 pixels). I am pretty sure I will not try to do all of the emoji (like, the flags are totally hopeless at 8x16), but it is tempting to round out the Unicode support somewhat. Like I was trying to make a ¯\_(ツ)_/¯ today and had to settle for ~\_( :) )_/~ which is pretty much (ノಠ益ಠ)ノ彡┻━┻.

Also: Adam revived our old game jam game Headcat, which I described in post 927, now over 16 years ago. You can play it online at Headcat.org. It is harder than I remember, perhaps explaining why it did not reach #1 on the One Appstore Per Child charts.

Also: I started and finished (true ending, but just with one character) Slay the Spire. Good game, but you don't need me to tell you that. Same for Alwa's Legacy, which is the sequel to Alwa's Awakening. Both of these are very true-to-form "8-bit" and "16-bit" platformers that I enjoyed and would recommend for genre fans, though I did not try to 100% them. The graphics are the highlight and I thought it was very cute how these could easily have been a pair of games from the NES and SNES. The good old days. And speaking of good-old days, I am now playing Katamari Damacy, which I had played at a friend's house many years ago, and always wanted to spend more time with. It totally holds up (aside from stuff like: You have to play through the tutorial and first level before you can access the menus at all, like to make the game fullscreen?) and it's honestly inspiring how unhinged the game design and writing are, and how fun it manages to be. What an accomplishment!
c
o
m
m
e
n
t
Austin (173.75.31.235) – 02.01.24 13:06:43
Have you experimented with WSL? I found it to be a really great way of doing Linux on Windows, but I imagine you have some very weird and specific needs that "run it in a VM that happens to be well-integrated into the OS" doesn't satisfy.
c
o
m
m
e
n
t
JonathanEvans (98.100.125.23) – 02.01.24 14:36:15
I can second WSL as a good "I just want a ding-dang C++ compiler on my windows PC". Especially now with WSL2 having an x11 compatibility layer so you see plots and visualizations.

But having been in the same boat, I'd just bite the bullet and dual bit with a Linux distro. In the long run it has ended up as less headache than wrestling with all the little nuances of these tools on windows
c
o
m
m
e
n
t
Adam (104.132.224.100) – 02.01.24 15:08:43
There is definitely a SIGBOVIK opportunity for Chat GUID Partition Table.
c
o
m
m
e
n
t
Tom 7 (146.70.72.173) – 02.02.24 10:01:41
Thanks guys. I love that they built WSL, but it's probably not for me since I also want to be able to make native code that works on other people's computers (for example, our destroyfx.org plugins, which are DLLs). I could just give up and use MSVC for those, and for native game development (which I don't do that much these days anyway), but 25 years ago MSVC would crash when I used C++ templates a little too hard and I never forgave it. The "cross-compilation" is actually great for me, except when I'm trying to use someone else's software that wants like "libxml2" and that doesn't have packages for windows.

I do use virtualbox to run Ubuntu and frequently have that up for development tasks that work better on Linux. That's a pretty good setup, especially since it makes it easy to do some sandboxed experiments without worrying about messing up my "real" computer, and it's easy to reason about what's happening. I had been using it recently for whenever I needed AddressSanitizer help on a head-scratcher, which was part of the impetus to try to get that working on windows.
c
o
m
m
e
n
t
eekee (86.31.101.5) – 02.17.24 14:16:33
I've had trouble with MSYS2 when compiling both POSIX and Windows programs. Or rather, one program, PForth -- Phil Burke's Portable Forth -- with separate POSIX and Win32 IO code. Compiling the POSIX code, the MSYS2 compiler errored out on some printf syntax. Compiling the Windows code failed due to a missing header. I ended up using a different MINGW distribution designed for compiling Windows programs with llvm. It lacks a shell and commands such as rm which makefiles need, so I use it by prepending it to my path in MSYS2. There are many MINGW distros; perhaps you can find one with a compiler which suits you and perhaps run it with MSYS2 as I do. I can't remember what mine is called beyond the dirname, llvm-mingw-20220906-msvcrt-x86_64 and I'm too lazy to upgrade it.
c
o
m
m
e
n
t
team fight tactics lover (71.59.7.248) – 02.27.24 00:04:28
You should give team fight tactics a try!
c
o
m
m
e
n
t
KCloudz (136.226.12.199) – 02.29.24 13:42:06
Glad you liked Slay the Spire, it was so successful that I feel a lot of new indi games just try to copy it. I think it's the level of balance and refinement that makes it as good.
p
o
s
t

a

c
o
m
m
e
n
t
Please enter the code, unless you are spammer!!
[ Tom 7 Radar  •  Tom 7 on Google+  •  on Twitter  •  on Facebook ]