Daniel Fairchild

2.6K posts

Daniel Fairchild banner
Daniel Fairchild

Daniel Fairchild

@dfchil

Likes near-metal programming, with python as my guilty pleasure, I do javascript for the WAT! Previously co-founder and CTO of https://t.co/iwjY6ioJKr

Copenhagen Katılım Aralık 2011
135 Takip Edilen255 Takipçiler
Sabitlenmiş Tweet
Daniel Fairchild
Daniel Fairchild@dfchil·
22+ years ago I made a small multiplayer game on the Dreamcast. The younger me had big plans for what the game should be. Plans that were first postponed, then forgotten. I was recently reminded of and got the opportunity to begin realising those plans:
English
12
42
301
17.5K
Falco Girgis
Falco Girgis@falco_girgis·
OoOoooO my GOD, YEEEES!!! I've waited for C++26's static reflection to make it into GCC for sooooo long... and here she is: running on a freaking Sega Dreamcast!!! This crazy abomination of a constrained constexpr function template, enum_to_string(), takes the value of an enumeration then reflects back upon its type at compile-time, returning the string identifier name that corresponds to the given value... providing us with a mechanism for automatic stringification of compile-time enumeration values! I'm most excited to explore what static reflection has to offer in C++26 for the sake of auto-generating Lua bindings and wrappers to other languages, reflectively... ...If nothing else, it's totally worth it to master these features to freak out and morally offend my C programmer colleagues. 🤣
Falco Girgis tweet media
English
25
35
595
101.4K
Daniel Fairchild
Daniel Fairchild@dfchil·
@ninjadynamics A support-package is on the way (a BBA, a bitfunc modern PSU and some CDR's), I look forwards to seeing what you make with it.
Daniel Fairchild tweet media
English
1
0
1
32
🇵🇹 Ninja Dynamics
🇵🇹 Ninja Dynamics@ninjadynamics·
I already have a Dreamcast on the way, but I still need to buy a broadband adapter from Japan. This is a very important piece of hardware, because it can help me debug the game in real-time. It goes for around ~200 USD with import fees and shipping. Every contribution matters: Ko-fi.com/ninjadynamics 🙏
🇵🇹 Ninja Dynamics tweet media
English
3
5
33
5.4K
Donald Tusk
Donald Tusk@donaldtusk·
In 1989 and 2023, Poles said the exact same thing Hungarians did a few weeks ago: freedom always wins.
Donald Tusk tweet media
English
1.6K
2.8K
14.6K
549.7K
Daniel Fairchild retweetledi
The Exploding Heads
The Exploding Heads@Exploding_Heads·
Every single AI product
English
3
95
426
30.6K
Daniel Fairchild
Daniel Fairchild@dfchil·
@BohuslavskaKate @michaeldweiss I’m so sorry. But also glad that Ukraine is so much less dependent on fickle supply of foreign weapon systems now and calls the shots without asking for permission.
English
0
0
5
223
Kate from Kharkiv
Kate from Kharkiv@BohuslavskaKate·
I remember when Kharkiv was bombarded by dozens of missiles daily, striking seconds after launch. We were forbidden from hitting the launchers just 40 km across the border, held hostage by threats to halt future weapon supplies. People died every day due to fears of escalation. It hurts. Still hurts so much.
English
11
80
427
5.2K
Michael Weiss
Michael Weiss@michaeldweiss·
First it was the insistence that Ukraine would be conquered swiftly and the best we could hope for was partisan warfare. Then it was fear of escalation. Recall Sullivan's comment, in response to the ATACMS question at the Munich Security Conference in 2022, about "heading down the road towards a third world war." Then it was DoD making four excuses for denying four critical platforms, all of which were eventually provided to Kyiv: ATACMS, Patriots, F-16s and Abrams. Excuse one: We don't have enough. Excuse two: They don't need them. Excuse three: They won't know how to use them. Excuse four: They may not even work properly. (Some ATACMS technically expired in 1994!) I heard this refrain after the Patriot was already in service in Ukraine, shooting down anything the Russians launched, including the state-of-the-art Kinzhal. Then it was fear of escalation -- again. Recall the decision-making crisis over whether to allow Ukraine to fire GMLRS into Russian territory when Moscow was making another play for Kharkiv. This agonized debate occurred after Ukraine had long been striking deep into Russian territory with homemade munitions and conducting regular cross-border raids into Kursk with U.S.-made kit such as MaxxPro MRAPs. Neither of these phenomena were exactly mysteries to the Kremlin. But American missile debris being recovered in Belgorod was seen as too provocative to many in the Biden NSC. And when they finally got to "yes," Ukraine had to be given a strictly delimited radius of operations -- something the Russians are of course not bound by. Where we are now? Today, Ukraine makes ample use of all of four of the critical systems the U.S. was reluctant to provide, although Russia had more time to adapt and diminish the effectiveness of these systems. Ukraine's homemade munitions are more plentiful, powerful, innovative, and longer-range and the U.S. even provides targeting assistance for strikes well inside Russian territory. Finally, Putin has to beg Trump to pressure Zelensky not to bomb Red Square on Victory Day. Panetta is correct.
Kate from Kharkiv@BohuslavskaKate

Former Defense Secretary and CIA Director Leon Panetta: Biden should have been much tougher in providing the weapons that Ukraine needed. Frankly, we should have given them much more sophisticated weaponry that they were asking for in order to be able to go after Russia.

English
79
781
2.9K
265.8K
Pede B
Pede B@PedeB1984·
Gin & Cocio's 10-års-jubilæum markeres med en limiteret hættetrøje, som KUN kan bestilles i dag og i morgen (9. og 10. maj). Den findes i blå og grå, og vi trykker KUN det antal, der bestilles, så du skal bestille nu, hvis du vil have én i dit skab. pede-b.dk ✌️
Pede B tweet mediaPede B tweet mediaPede B tweet mediaPede B tweet media
Dansk
1
0
1
144
Daniel Fairchild
Daniel Fairchild@dfchil·
@falco_girgis And I know you got of on solving the technical challenge as well. That is such a rush =) Well done my friend.
English
0
0
1
19
Falco Girgis
Falco Girgis@falco_girgis·
@dfchil I said that for months too... until I caved to peer pressure!
English
1
0
2
241
Falco Girgis
Falco Girgis@falco_girgis·
Ughghghgh... I swore I would never do this to myself, but... after an entire night of going to town on the codebase, I finally got the software back-end of my C23 and C++23-based accelerated linear algebra and math API for the Sega Dreamcast building with the Microsoft Visual C++ compiler under Windows 11. So now your cross-platform game engine can be hand-optimized to take full advantage of the Sega Dreamcast's SH4 FPU for massive gainz on the console, while simultaneously still building and emulating the FPU with a platform-independent SW back-end that will run anywhere, and very soon an accelerated back-end will be added for the Gamecube's Gekko PPC CPU, once its new KallistiOS back-end gets upstreamed. Now... what did it take to get this codebase which was 100% tied-at-the-hip to GNUC/GCC/Clang compilers to build under MSVC? ... a lot of hell, but actually nowhere near what I had thought... now that they FINALLY are supporting most of the modern C standards. 1) First order of business was to add a compiler-detection mechanism to my top-level header file, which I could use within preprocessor directives to implement different logic or define macros differently depending on the compiler that gets detected at build-time. 2) While MSVC supports C99's compound literals *in C code*, it does NOT support them in C++ code... Which is a HUGE problem for a big-ass library like this which targets both C and C++ where half of the code is inlined within the header files for performance. I had to create a SHZ_INIT() macro which, depending on the language we're building with, will either resolve to a compound literal from C or a braced initializer from C++. 3) I had to create a set of mirror defines for low-level compiler attributes that I used from GCC, to use their equivalents with MSVC: force inlining, alignment/packed attributes, C's "restrict" keyword from C++, soft and hard memory barriers, prefetching, etc. 4) I had to #ifdef away all of my compile-time constexpr evaluation checks that would opt to use GCC's __builtin_() routines when the API gets passed a compile-time constant, so that it doesn't wind up becoming a runtime cost due to black-box inline ASM getting called. Unsure if there's even an equivalent feature in MSVC? 5) Detecting the C++ language version to allow my API to optionally offer extra features and methods for C++23 was... ridiculous. By default, MSVC doesn't even update the __cplusplus standard define to contain the current C++ version and instead uses an extra, vendor-specific macro, unless you enable some weird compiler option to make it behave. WTF? 6) I had to fix a bunch of "reserved word" clashes and macro pollution of the global namespace that happens on Windows with MSVC that was interfering with my own code... "near" and "far" cannot be used as identifiers on Windows, cuz they're some ancient legacy keywords for some exotic Intel segmented memory model of the past... OH, then IN and OUT--which I didn't even use directly, I was just passing to a macro which was concatenating them into a larger identifier--are defined to NOTHING in , so that completely screwed up my build. ...and after going through all that, praise the lord, everything built and ran perfectly fine... and as much as it was a living hell, I actually didn't have to change a single line of user-facing API or interface code, so there's no API breakages that will impact my users with MSVC support getting added!
Falco Girgis tweet media
English
11
31
483
27.9K
Donald Tusk
Donald Tusk@donaldtusk·
European Council meeting. For the first time in years there are no Russians in the room. Huge relief.
English
4K
9K
66.3K
2.3M
Daniel Fairchild
Daniel Fairchild@dfchil·
@falco_girgis Not to stir shit up, but to remind everyone to temper themselves (ie. you don't have to be the guy on the right):
Daniel Fairchild tweet media
English
0
0
1
98
Falco Girgis
Falco Girgis@falco_girgis·
It seems that my favorite person--only account I have ever blocked in all my time on X--is attempting to belittle jnmartin and downplay the significance of his upcoming Sonic R port to the Sega Dreamcast, due to his usage of AI tools to aid in the decompilation process. Not only that, but the Dreamcast community is being accused of being full of “AI slop” in the comments section, with people even asking whether I’m just an AI vibe coder… which is hilarious given how half of the time I’m writing SH4 assembly in a notebook by hand. 🤣   It's true, though, jmnmartin is using Claude to decompile the PC version of Sonic R—something he has never once denied. For this port, there exists no source material, and doing it by hand would take years. AI is the only reason people are about to be playing this banger of a game on their Sega Dreamcasts, and I can only assume that most people will be too busy having a good time on their DC's to really give two shits how the game was decompiled.   Love AI or hate AI, the fact that jnmartin is using it for Sonic R's decompilation does not somehow negate the fact that he's one of the most talented, prolific developers I have ever met, who has worked to bring Mario 64, Mario Kart 64, Doom 64, Star Fox 64, Ocarina of TIme, WipeOut, and Sonic Mania to our Sega Dreamcasts, doing all porting of the source C codebases by hand and all for free... and no amount of anti AI hatred somehow negates his talent and skill.   Now... what does this mean about the quality of the upcoming Sonic R decomp from a technical perspective? Shit, I don't personally know, as I'm not really an AI user…but this is an enormous undertaking, and I'm not really sure that there exists any similar endeavor within the community to serve as our basis for comparison. Will the codebase be of the same quality as if it were written by hand? 🤔 Well... We're all about to find out, as we bear witness to this grand spectacle of science and engineering, I guess! But I will say, from my first-hand experience joining in on some of the N64-to-DC ports, that some of the codebases (which I will not call out by name) are still shittily-written, UB-ridden C code, despite being done by hand. 😂

But hey, maybe my BFF, "Cosmic Eternity," here is right, and we should all take this opportunity to be as butthurt as possible that we're about to get this absolute banger of a Sega Saturn and PC game ported to the finest game console that ever existed for free, potentially with online play? No idea... DISCUSS!
Falco Girgis tweet media
English
68
38
381
47.3K
Falco Girgis
Falco Girgis@falco_girgis·
I don’t honestly think it’s my place to tell other people what kinds of tools they should be using to do their job. In jnmartins mind, his job is porting the codebase to the Dreamcast while the decompilation process is just something that’s a menial chore to him… But yeah, like… The main fuck up and regret that I have from AI splicing that image isn’t that I think I did anything wrong by using AI… but as several people pointed out, I missed a golden opportunity to promote GIMP by using their tools… genuine regret.
English
1
0
1
119
🌟 ᴄᴏꜱᴍɪᴄ ᴇᴛᴇʀɴɪᴛʏ 🌟
You ai generated an image of the Dreamcast Logo and the GIMP logo together. Something that can be done in literal Paint in less than 5 minutes. You have no excuse.
Falco Girgis@falco_girgis

It seems that my favorite person--only account I have ever blocked in all my time on X--is attempting to belittle jnmartin and downplay the significance of his upcoming Sonic R port to the Sega Dreamcast, due to his usage of AI tools to aid in the decompilation process. Not only that, but the Dreamcast community is being accused of being full of “AI slop” in the comments section, with people even asking whether I’m just an AI vibe coder… which is hilarious given how half of the time I’m writing SH4 assembly in a notebook by hand. 🤣   It's true, though, jmnmartin is using Claude to decompile the PC version of Sonic R—something he has never once denied. For this port, there exists no source material, and doing it by hand would take years. AI is the only reason people are about to be playing this banger of a game on their Sega Dreamcasts, and I can only assume that most people will be too busy having a good time on their DC's to really give two shits how the game was decompiled.   Love AI or hate AI, the fact that jnmartin is using it for Sonic R's decompilation does not somehow negate the fact that he's one of the most talented, prolific developers I have ever met, who has worked to bring Mario 64, Mario Kart 64, Doom 64, Star Fox 64, Ocarina of TIme, WipeOut, and Sonic Mania to our Sega Dreamcasts, doing all porting of the source C codebases by hand and all for free... and no amount of anti AI hatred somehow negates his talent and skill.   Now... what does this mean about the quality of the upcoming Sonic R decomp from a technical perspective? Shit, I don't personally know, as I'm not really an AI user…but this is an enormous undertaking, and I'm not really sure that there exists any similar endeavor within the community to serve as our basis for comparison. Will the codebase be of the same quality as if it were written by hand? 🤔 Well... We're all about to find out, as we bear witness to this grand spectacle of science and engineering, I guess! But I will say, from my first-hand experience joining in on some of the N64-to-DC ports, that some of the codebases (which I will not call out by name) are still shittily-written, UB-ridden C code, despite being done by hand. 😂

But hey, maybe my BFF, "Cosmic Eternity," here is right, and we should all take this opportunity to be as butthurt as possible that we're about to get this absolute banger of a Sega Saturn and PC game ported to the finest game console that ever existed for free, potentially with online play? No idea... DISCUSS!

English
17
60
364
23.1K
Daniel Fairchild
Daniel Fairchild@dfchil·
@falco_girgis What is this? Have you’ve had the privilege to meet Jnmartin in person? I’d love to do that some day. He seems like a really cool and talented dude.
English
0
0
4
1K
Daniel Fairchild
Daniel Fairchild@dfchil·
@JoelTheDane Jeg synes at man bør tage sig af ham og tilbyde en stilling i staten der ikke kræver YDERST HEMMELIGT, indtil Rusland har tabt.
Dansk
0
0
0
12
Falco Girgis
Falco Girgis@falco_girgis·
SWEET MOTHER OF GOD. I tweaked the approach a bit more to just let the compiler handle preserving ALL of the FP regs that could potentially get clobbered on the front bank, so there's no more stack management fuckery, and W T F, up to 250% perf?!?!?! Lesson to be learned here, sometimes it's better to let the compiler handle some shit. You don't know for sure what it does or does not need to preserve between function calls within your inline ASM block, while it does. It's fine to be one of the guys who wants to beat the compiler's C/C++ code in your 1337 ASM, but sometimes the biggest gainz against high level languages come from working in harmony with the compiler, not against it.
Falco Girgis tweet media
English
4
6
116
2.7K
Falco Girgis
Falco Girgis@falco_girgis·
HOLY SHIT, I just achieved MASSIVE GAINZ on multiplying and accumulating a 4x4 matrix held within memory onto the "active matrix" held within the 4x4 FP register back-bank of the SH4 FPU in my accelerated math library for the Sega Dreamcast! After an extremely tense two hour-long session of playing inline assembly Tetris by meticulously hand-scheduling and reorganizing SH4 instructions, I am finally SPANKING the legacy mat_apply() routine from KallistiOS rather than barely winning against it with my SH4ZAM library of accelerated math routines targeting the Dreamcast's SH4. What you see in the top left pane is the original out-of-line ASM implementation of math_apply(), which is offered by KOS's minimalist matrix.h API. What you see in the top right pane is my inline ASM implementation which is part of SH4ZAM's XMTRX API. The bottom left pane is the unit tests which benchmarks the two implementations against each other, and the bottom right pane is the output after I ran the test suite on my physical HW, using the cycle-accurate SH4 performance counters to measure timing... The results? When the matrix which gets passed to the routines as an argument is not already resident within the cache, I get about an 83% performance improvement. When the operand matrix is already resident within the cache, I get about a 21% perf improvement... which is ASTRONOMICAL GAINZ for a routine this hot!!! So what the hell did I do to achieve this? 1) First of all, I worked WITH the compiler instead of against it. Rather than implementing my routine as a black-box out-of-line ASM routine which has to pay the cost of a full function call, saving and restoring certain registers and managing the stack frame according to the C ABI, I opted to implement mine as a forcibly inlined routine implemented within inline ASM. By doing this, I'm able to tell the compiler precisely which registers I'm using and clobbering, which allows the compiler to not have to save and restore as much shit potentially as a full C ABI call and instead to only do it for the registers it actually gives a shit about preserving across the call. 2) Smarter stack management for when I need to push and pop values to and from the stack within the routine itself. Rather than using fmov.s to load and store single FP values to and from the stack, I align the stack up to 8 bytes, which allows me to swap to pairwise FMOV mode and use FMOV.D to load or store TWO floats for the exact same cycle cost as one. 3) Strategic prefetching. Since I know exactly what data I'm going to be operating on (the source matrix) and in what order, I can manually preload the data into the cache before I actually attempt to load it from memory, while I'm doing other stuff with the CPU. I'm prefetching the first cache line of the matrix while I'm dicking around with aligning the stack, so that when I start loading the first values right afterwards, it's already there. Then the second cache line gets prefetched while the first cache line being used, so by the time I get done with the first cache line, the second is also filled. 4) Grouping instructions by pairs in a manner that maximizes superscalar dual dispatch on the SH4. This one's tricky. Not all instructions can be executed 2-at-a-time. Only instruction pairs in certain compatible groups can be run in parallel, so I had to be very careful to group work so that I'm pairing integer work with floating point work or integer work with loading/storing, for example, which can both use different areas of the CPU, while doing something like pairing two loads together will result in only single instruction dispatch, as the two would compete for resources. 5) Reducing vector instruction pipeline stalls. So it turns out there's an undocumented bit of bullshit with how the pipeline forwarding works when loading operands into FP regs then attempting to use them with vector instructions, like the FTRV instruction you see there. Unlike regular FP instructions, the circuitry which allows for the result of a load to get forwarded on to an arithmetic FP instruction needing it as input before the load instruction is fully retired is evidently not connected to the vector unit, so there's an extra amount of cycles one must wait between loading operands into FP regs and trying to use them with vector instructions, or else you'll stall the pipeline. The only way we even know this is from rigorous measurements using the SH4 performance counters... and since I did know it, I was able to Tetris a few extra instructions of work between FMOV.D loading the operands into regs and FTRV trying to operate on them. Anyway... stoked AF that after two hours of getting my ass kicked by the SH4, I made HUGE wins!
Falco Girgis tweet media
English
20
50
534
18.2K
Daniel Fairchild
Daniel Fairchild@dfchil·
@falco_girgis Double digit percentage increase on such a hot path? This is going to matter a lot for people like me and my little DC projects :-) (I’m just about ready to start up again now after landing a comfy reasonably well paying gig).
English
1
0
6
441
breanna 🇺🇸🇩🇪
breanna 🇺🇸🇩🇪@txgermanbre·
Marcel doesn’t know the answer so I’m asking you all. Can Swedes, Danes, Norwegians understand each other
English
538
6
238
52.7K
Haavard F. Pettersen
Haavard F. Pettersen@haavardfp·
@svegfinne @txgermanbre Norwegians from around Oslo speak normal Scandinavian. Swedish a variety of it that sounds stuck up and pretentious and offended «(besvijken»). Danes sounds mumbly and blurry like they have a potato stuck in their throat, turning «gate» (gah-teh) to geewwwdhdd
English
2
0
8
425