How to Generate C++ Docs Straight from Clang with MrDocs🎥C++ AllianceWelcome to SwedenCpp
Latest blogs, videos, podcasts and releases in one stream
Wednesday, December 2, 2026
How to Generate C++ Docs Straight from Clang with MrDocs🎥C++ Alliance
Beyond the Scheduler: Designing Predictable Embedded Systems in Modern C++ - Elbert Dockery - CppCon🎥CppCon
Distributed programming with coroutines and asynchronous communication framework - J. Vanslembrouk🎥MeetingCpp
From Async I/O to Senders and Receivers :: Pavel Šimerda🎥CoreCpp
Moogスタイルラダーフィルターのアナログ的特性をいかに評価するか? - 1ドルクラスのマイクロコントローラー上での検証 - Hiroyuki Oyama - ADC Japan 2026🎥audiodevcon
Advent of μarchitecture Day 2: Pre-decode🎥Matt Godbolt
Why don't NGLAI Bros use AI?🎥Zed A. ShawIf this page is useful, please consider donating a coffee
Tuesday, December 1, 2026
Terrible tips for a C++ developer: 2026 edition, Part 2We're introducing an updated edition of the terrible tips for a C++ developer book. We'll be posting it on our blog in parts. The book includes a total of 60 tips.📝from pvs-studio.com
Addressing AI’s Greatest RisksEven those of us who have spent decades researching AI can be surprised by the capabilities of today's most sophisticated models and the accelerating pace of AI development. These advancements create tremendous opportunities across industries, but they also introduce alarming new threat vectors that are unprecedented in human history. AI models are now so advanced that it seems virtually impossible to predict and control AI behavior, particularly in critical applications.📝Kitware Inc
OpenGL/C++ No-AI, LSP, or Debugger: Ep28 -- Make Thing Anyway🎥Zed A. Shaw
Kitware at the 2026 Beneficial Fire SummitAt this year’s Beneficial Fire Summit, Kitware will connect with prescribed fire practitioners and agencies to discuss how software can support burn documentation and reporting alongside the tools teams already use. The summit brings together people working in prescribed fire, cultural fire, and managed wildfire across California and the West.📝Kitware Inc
Lightning Talk: Building Presentations in slidev - Matt Kulukundis - C++Now 2026🎥CppNow
This C++ IDE feature changes everything #cppcon #technology🎥CppCon
Introducing the Qt Widget to Qt Quick Skill: Automating 80% of PortingMoving an existing Qt Widgets user interface to Qt Quick is a big investment. Every screen, dialog, menu and toolbar has to be rebuilt. Every custom-drawn element has to be redesigned. The application logic that sits tangled up with the screens has to be separated out, the project setup has to be reworked, and the result has to be compared with the original screen by screen to make sure nothing was lost. For applications that want a modern, fluid, touch-friendly interface, this adds up to weeks and months of repetitive work that few teams have room for.📝Qt Blog
Processor Design and C++ Memory Models :: Ofek Shilon🎥CoreCpp
Advent of μarchitecture Day 1: Fetch🎥Matt Godbolt
const Integers are special in C++Built-in types are special as they are usable without including anything in C++ or C. In today's post, I like to put the spotlight on int and explore how special an integer is. What's a constant Let me start with this short example: 1 2 3 4 5 6 7 …📝AndreasFertig.com
The Personalized Algorithmic Feed fundamentally changed the WebLet’s discuss: Content-delivery via (1) personalized (2) algorithmic (3) push-based feeds was the most important shift the internet experienced over the past twenty years. Personalized Algorithmic Feeds were a fundamental shift to how the web works. They are so prevalent that the age of forums is well and truly over, outside of specialized niche communities. I think of the modern centralized feedscroller web as a “Web 3.0” 1 . Most users love the personalized algorithmic feed, and that’s part of the problem. Any modern social media platform needs to ask itself what its model of content delivery is going to look like. Most of the time (especially when serving a diverse audience) this means a high-quality algorithmic feed. Without a high-quality feed (algorithmic or personalized or otherwise) there’s no zero-effort content discovery, and people leave the platform. Providing such a feed is difficult for a variety of reasons (high-quality data analysis, enough content, centralization). This is what I call ’the feed problem'. In this article I’ll write down some observations on algorithmic feeds, while largely postponing the social discussion (e.g. feedscroller addiction). What are Feedscrollers? You already know what feedscrollers are. Feedscrollers are what came after the Web 2.0 era of forums and discussion boards. After Something Awful, “old Reddit”, Hacker News, or 4chan. Feedscrollers are all-inclusive apps whose sole purpose is to suck you into an algorithmic feed that ingests your data, shows you personalized content, and tries to maximize your engagement. Web 2.0 is seeking out specific subreddits and sorting by “latest”. Web 3.0 is locking into the Reddit homepage and scrolling past personalized content from subreddits you don’t even recognize. Feedscrollers are hyper-optimized for your engagement; the algorithm knows better than you and should have full control over everything you see. Let it absorb every micro-pattern in scrolling behavior to identify what to show you next. Examples of tech companies trying to deprioritize chronological feeds in favor of a deeply personalized algorithmic one are everywhere. Try to notice when it happens. Recognizing how deeply personalized or push-based a given platform is helps preserve your sanity, and makes interacting with the web much less frustrating. Example: Twitter’s algorithmic feed X dot com join the conversation If you use Twitter / X, you probably heard that there were at least two attempts to deprioritize the “Latest Tweets / Following” tab in favor of a personalized “For You” feed. For example, the “For You” ranked timeline became the default on the iPhone app every time you opened the app. (The morally correct behavior is to preserve the user selection.) Why? How does X benefit from this? Look, there are still ads either way . What’s the point here? Are ads on the personalized algorithmic feed more valuable? Is it a power/control thing? Program managers trying to be bold and simplify? Who knows. For the record, I missed most of that drama! My X account is brand new, and I only made it begrudgingly. So far the chronological feed prevails, and I hope it does for the rest of time. (Of course, this is entirely out of the hands of the users, and the better the algorithm gets, the weaker the justification for keeping the chronological feed around. Just a heads-up.) Fwiw, my experience on X has been good! The Algorithm works , that’s what makes it so annoying. “Oh, just never use platforms with any algorithmic feeds at all” is not a tenable stance if you want to draw people away from Twitter. People like the content discovery, the personalization, and getting to see cool shit they never would have found otherwise. The Youtube frontpage or sidebar are Personalized Algorithmic Feeds. Trust the algorithm! Why would you care to see a chronological list of videos by all people you followed, anyway? The Algorithm(tm) will bring them to you. Note on Youtube deprioritizing Subscriptions This has been an ongoing fight between Youtube and the few remaining holdouts that are still using the Subscriptions tab. (If you are feeling called out here, you should. I don’t judge, but you should be aware that you are a dying breed.) If I open my Subscriptions tab nowadays it opens with a ranked, non-chronological feed . Funny / tragic. Only then it starts showing videos in chronological order. Don’t judge me. This is just one instance of Youtube trying to deprioritize the non-algorithmic feed in favor of ranking. I still remember when “my subscriptions are difficult to see” was a common complaint. Are those people still around? Either everyone just got used to the new world, or I just frequent different spaces. Youtube’s search functionality also used to randomly show personalized results. Right now these are either more tightly integrated and hidden, or Youtube dropped that experiment. Finally, see the sidebar feed selection settings: Technology Connections, my beloved. Finally, TikTok is such an obvious example that mentioning it is barely necessary. It’s the quintessential feedscroller. Raw engagement. One video at a time. Watch or swipe away, the algorithm is always listening. Characteristics of Feedscrollers If I had to define what makes modern algorithmic feeds special, it’s the following three characteristics. (Every single one is important for the social-technological dynamics of how feedscrollers interact with society.) PERSONALIZED Each user sees different content. In Web 2.0 communities formed by meeting on different websites or forums. You decided which space you joined. In the new world community lines are drawn by the algorithm, for each individual user. ALGORITHMIC Users are subject to an inscrutable system known as The Algorithm(tm). The Algorithm(tm) decides which posts are better than others, such that you don’t have to look at any bad posts. Users have some influence over The Algorithm (blocking, likes, etc.), but no control. The Algorithm is expensive to run, requires vast amounts of data, and cannot be replicated by outsiders. (In this sense, it’s centralized and proprietary technology.) FEED The user interacts with the web by scrolling some sort of never-ending feed of content. The system is push-based . It predicts what you want to see and shows it to you. You do not have to ask the system for what you want. That would require knowing what you want, which would be difficult. Instead, the system decides for you. For lack of better terminology I call feeds exhibiting these traits Personalized Algorithmic Feeds. That’s a mouthful, so I’ll often just shorten it to “algorithmic feed”, or just broadly talk about “feedscrollers”, i.e. apps built around a personalized algorithmic feed. TikTok Twitter Google Search News website trending feeds Hacker News RSS feeds Youtube subscription feed Personalized Algorithmic Feed What does any of this mean? A few things. Cynically, I think that feeds are “good enough” nowadays that that every website that wants to compete with modern social media has to provide a content-discovery path that can compete with feeds. This includes Substack, Mastodon, but also less-personalized aggregators such as lobste.rs , or old websites slowly trying to reinvent themselves, such as Reddit. Users expect a feed, personalized or otherwise, and the feed has to be “high quality” enough that all they need to do is open the app, and get what they want to see. That’s what drives engagement. Engagement is a dirty word nowadays, but any thriving community needs it. You cannot build a village without common topics of conversation, comment threads, and so on. The thing that’s badly addictive for some subset of the users is also what’s necessary to ensure that a social network has the right “vibe”, people can discover new content and knit connections, and so on. You can avoid having a feed, and you can avoid data aggregation, but you need narrow scoping and are missing out on advertisement money and social media effects. lobste.rs solves(?) the problem by just restricting itself. The community is small. Highly focused on specific topics (computation). That’s a solution. There’s no need for a fancy feed as long as the community is small, and people are there for the same reason. It doesn’t scale, but that’s fine. I like it a lot. Mastodon Mastodon? You know, the decentralized Twitter competitor? Mastodon has no discoverability. I’m sure Mastodon has pockets of great content, but following a handful of people never helped me “jump” to any mysterious great communities or discover anyone new. The mathstodon homepage has a chronological feed for the people I follow, which is of limited use when I’m trying to find those great secret pockets of content of people I would vibe with. Let’s check the “Live feeds” tab. The “Live feeds” tab opens with a disclaimer: “These are the most recent public posts from people on the fediverse that people on mathstodon.xyz follow.” Posts are rolling across my screen, mostly stuff that I have exactly zero context on. What’s worse is the sheer amount of bot content. Not like, scam bots, just harmless accepted bots. Bots that mirror posts by newsletter outlets. Bots that post a picture of a mathematical knot every ten minutes. Bots that track what’s currently playing in some web radio. There’s no filtering, it’s just a raw firehose of “all the posts” that Mastodon can see. Nothing there helped me discover hidden gems. Sorry, it’s entirely possible that this was a user issue: Maybe I should not have joined Mathstodon of all instances. Rumor has it that other instances have something more like a trending tab, but that’s non-obvious to people just trying to join a social network. Maybe you need to join the biggest Mastodon platform of all, or it’s just going to be a miserable experience! Or maybe you need to be a tech-wizard and host your own, or deeply understand Mastodon to make calls like this! Neither of these are great options. What I’m saying is that, as far as I can tell, there’s no out-of-the-box way for new Mastodon users to “discover” the village they are looking for, and there is no algorithm that would show them what they actually care about. In that sense Mastodon isn’t strictly bad, it just doesn’t solve the Feed Problem, and is therefore unsuitable as a social network for the vast majority of people. Why is it like this? Well, running such an algorithm would require extensive data collection. It’d be expensive. It’d be difficult considering Mastodon’s decentralized model. That’s it, I assume. I see the trade-offs, but what we really need is a social media platform that can do both. Otherwise Twitter will remain undefeated. The Personalized Algorithmic Feed is the moat. Everyone who cares for an audience posts there, and everyone who wants something cozier just posts on Discord. Substack Substack’s feed is not particularly good. That’s my personal verdict, anyway. I have not run a survey. I do believe there’s a skill issue here (Substack has a whole list of problems), but a more sympathetic answer is that Substack just doesn’t have the data needed to build a perfect algorithm. To make things worse, Substack is where people go for longform writing. This makes it much harder to train an algorithm. (See TikTok, where every bit of content is bite-sized.) In other words, Substack is fighting an uphill battle. Whether it can survive without building an amazing feed (because the current one is not good) will have to be seen. It might be possible, maybe the usage patterns are different enough. Platforms like lobste.rs don’t need a personalized feed. Substack is a bit trickier, since it’s trying to be one of those vast “meta-platforms” that cover everyone. That’s as far as I can tell the point where a feed becomes necessary. Conclusion There is no conclusion. I am not fully happy with the shape of this draft, but don’t think I could get it to a reasonable state without a lot more work. It’s concerning how much “the feed” evolved to exploit us, just by showing us what engages us. It’s a double-edged sword. Addiction is bad, sure, but “the feed” is just a mirror shown in front of you, showing you what engages you (ideally, anyway). As long as you can opt out of it, this isn’t intrinsically bad. I’d like to have a better verdict on Mastodon and platforms like BlueSky who try to solve this problem, but sooner or later I’ll just reinvent decentralization from first principles, which brings us right back to my Web 3.0 claim. If you ask yourself what to take away from this giant pile of an essay, then it’s probably that all three components (personalization, the feed, and ’the algorithm’) are important to make “feedscrollers” feel the way they do. Second, I don’t think we can really “get rid” of feeds, they are probably here to stay. There was some qualitative shift between the old web and the new feedscroller one, and now feeds have become the de-facto standard for content discovery. Some people associate “Web 3.0” with crypto, decentralization, or with an older concept also known as “The Semantic Web”. That’s fair. I don’t like that terminology. Names for epochs should be given retroactively, not in advance. The current web has some attempts at decentralization, but the web as a whole is more centralized and locked-in than ever. Considering that we’re moving towards a world in which major platforms require usage of an account and their primary app, it feels like we’ve hit a new era. ↩︎📝MOND←TECH MAGAZINEMonday, November 30, 2026
CMake 4.5.1 available for downloadCMake 4.5.1 available for download📝Kitware Inc
OpenGL/C++ with No AI, LSP, or Debugger: Ep27 Maybe One Thing is Wrong🎥Zed A. Shaw
C++ Needs to Catch Up, and FastMemory Safety Won’t Build the Missing Stack📝My Very Best AI Slop
Follow the Anthropic HaloDario Amodei’s $1.5 Trillion Shakedown📝My Very Best AI Slop
C++ Weekly - Ep 561 - emplace_back, initializer_lists, and reserve🎥Jason Turner
Version control is not the same as version numbersOne is a release management problem; the other is a code development problem. The post Version control is not the same as version numbers appeared first on The Old New Thing .📝The Old New Thing
What's New for C++ in Visual Studio Code: C++ & AI Tooling for Your Build, Your Code, Your Workflow🎥CppCon
On Reading Source Code - Patrice Roy - Meeting C++ 2026🎥MeetingCpp
Getting Started With QNX Projects in CLionQNX is a Unix-like real-time operating system used where C and C++ code must be fast, predictable, and maintainable for many years. It powers digital cockpits, medical devices, and robots – from robotic arms on factory lines to autonomous mobile robots in warehouses. Starting with CLion 2026.3.0.3, you can build, deploy, and debug QNX applications […]📝CLion : A Cross-Platform IDE for C and C++ | The JetBrains Blog
C++ Under the Hood: Internal Class Mechanisms :: Chris Ryan🎥CoreCpp
Writing a paper is no longer a signalWhat nobody seems to be discussing is how academic publishing is being disrupted. I am an editor of a well-established journal. Here are the numbers of manuscripts I receive weekly. Writing a science paper used to require massive effort. Highly productive professors might produce 5 solid manuscripts a year. Sure, some publish 30 or 50 … Continue reading Writing a paper is no longer a signal📝Daniel Lemire's blog
C++ Book Review: The Art of Writing Efficient Programs | Modern Cpp Series Ep 255🎥Mike Shah
Processor Design and Memory Models - Ofek Shilon - ACCU 2026🎥ACCUConf
Rust Grows Gradually, It Doesn’t Appear All at Once - Joel Butler - ADC Japan 2026🎥audiodevcon
Building Reality View into Qt Surrounding RealityWhat Tesla Reality View prompted us to build with Qt When Tesla introduced Reality View with Full Self-Driving v15 , the clips circulating online showed a familiar thing from an unfamiliar angle. A virtual camera above the car made the drive visible on the dashboard, with upcoming turns drawn into the scene. The reaction caught our attention and brought a question for cockpit designers into focus. How much of the world around the car helps a driver understand what’s happening? Seeing what the system is tracking can reassure drivers and passengers. It might even spare everyone a round of "Did it see that cyclist?" from the back seat. We responded by adding Reality View to the Qt Surrounding Reality reference design. The first clip shows a recorded drive through reconstructed surroundings, with the car and its overlays rendered in Qt Quick 3D.📝Qt Blog
GSoC 2026: Merging Host and Device ClangIR for Cross-Boundary CUDA/HIP OptimizationHi, I’m David Rivera, a third-year computer science undergrad at Ontario Tech University in Canada. For Google Summer of Code 2026 I worked on the Host-Device CIR Combine Pipeline , mentored by Konstantinos Parasyris (Dinos) and Joseph Huber. I started contributing to ClangIR for the love of the game: I wanted to understand how compilers work underneath. GPU support in ClangIR was limited at the time, so I started working on it, and with the help of the maintainers I became a valuable contributor to the project, especially on the components related to GPU compilation. This project started as Dinos’s idea. He had a work-in-progress merge pipeline in the ClangIR incubator, and in January I added the driver-side support for CUDA on top of his branch. Before GSoC I also spent months landing CUDA and HIP support upstream ( tracking issue ), which this project depends on and which is like another mini GSoC project by itself. GSoC took me from sending patches to coordinating with the community: contributing to an RFC, publishing our evaluations and prototypes, writing my first paper, which will appear at LLVM-HPC at SC26 , and attending my first LLVM Developers’ Meeting. I also got to meet in person the maintainers I’d only interacted with through code review, which was a really cool experience. TL;DR: We have a prototype that merges the host and device ClangIR modules of a CUDA or HIP translation unit into one module, runs passes that see both sides, and splits them back into the normal pipelines. We’ve measured real benefits with it. We implemented three optimizations on top of it: kernel argument constant propagation, launch bounds propagation, and alias information forwarded from host launch sites. Alias information provides by far the largest gains: a 1.67× geomean in GPU-region time on PolyBench/GPU on an NVIDIA A10, with caveats I go through below. The prototype isn’t merged upstream yet. The foundations have landed, including the container and the work that followed Dinos’s RFC , we have a roadmap for the rest, and we’ll be working on it in the coming months. Background Clang compiles a CUDA or HIP translation unit several times: one host cc1 , plus one device cc1 per GPU architecture. There is never a single phase in the compiler where we have visibility of both the host launches and the kernels they launch, so co-optimizing them isn’t possible. Here’s what that costs: __global__ void acc ( float * out, const float * a, const float * b, int n) { int tid = blockIdx.x * blockDim.x + threadIdx.x; if (tid n) out[tid] = a[tid] + b[tid]; } int main () { // ... cudaMalloc(( void ** ) & a, bytes); cudaMalloc(( void ** ) & b, bytes); cudaMalloc(( void ** ) & out, bytes); acc (n + 255 ) / 256 , 256 >>> (out, a, b, n); } Anyone reading this can see that out , a and b are three separate buffers. The device compilation can’t: it only has the kernel, so it has to assume out may overlap a or b . We can’t just compile everything once, because headers can branch on __CUDA_ARCH__ , so parsing and Sema have to run once per side. What we can do is bring the two sides together after that step. Giving the compiler one view of both sides isn’t a new idea. The Heterogeneous LLVM-IR Modules RFC from 2020 sought the same visibility, but a conventional LLVM module has one target and one data layout. MLIR modules nest and each can carry its own, and ClangIR (CIR) is the bridge that gets a Clang AST into MLIR, with LLVM and the target backends still downstream. Since CIR comes after Sema, each side contributes its own correct translation and we merge those. Getting CUDA and HIP through CIR first None of this works if CIR can’t compile the programs in the first place, so a lot of my time went into parity: calling conventions, kernel registration, NVPTX builtins, address spaces and function attributes. In August, across 21 PolyBench/GPU programs, CIR matched classic CodeGen at 0.998× runtime on an H100 and 1.008× on an MI300X, with about 3% more compile time ( raw data ). We wrote up this part of the work, how CUDA and HIP kernels lower through CIR, in the paper that will appear at SC26. 25 of my PRs merged upstream during the project, and they’re listed at the end of this post. The merge pipeline The prototype lives on my fork. With --clangir-offload-merge , the driver stops each compilation after CIR, merges the results, runs the cross-boundary passes, splits the module back apart and resumes each cc1 from CIR: clang -x cuda -fclangir --clangir-offload-merge --cuda-gpu-arch = sm_86 -c kernel.cu clang -x hip -fclangir --clangir-offload-merge --offload-arch = gfx942 -c kernel.hip Two new job actions, CIRMergeJobAction and CIRSplitJobAction , both map to a standalone tool, cir-offload-merge . You can also run the steps by hand: cir-offload-merge -combine \ -input = host.cir -input = device-sm86.cir \ -targets = host-x86_64-unknown-linux-gnu,cuda-nvptx64-nvidia-cuda--sm_86 \ -output = combined.cir This works for CUDA and HIP, with one or several GPU architectures. The container The merged module is an ordinary MLIR module with host and device modules nested inside it. Trimmed: module attributes {cir.offload.container} { module @host attributes {cir.offload.kind = #cir.offload_kind } { // stubs + launch sites } module @device_cuda_nvptx64_nvidia_cuda__sm_86 attributes {cir.offload.kind = #cir.offload_kind } { // kernels, cc(ptx_kernel) } } My first version was a dedicated cir.offload.container op, because I wanted the verifier to enforce the hierarchy: one host module, then one or more device modules. In review of #206576 , Andy Kaylor asked whether we needed the op at all, or whether a module marked with an attribute could be the container. Looking at how the gpu dialect verifies gpu.container_module , I could keep the same invariants in CIRDialect::verifyOperationAttribute without introducing a new op, so that’s what landed. Connecting launches to kernels Being in the same module doesn’t connect anything, because a launch never calls the kernel directly. It goes through a stub and the runtime: // acc >>(out, a, b, n) lowers to: __cudaPushCallConfiguration(grid, block); __device_stub__acc(out, a, b, n); // and the stub, generated by Clang: void __device_stub__acc (...) { void * args[] = { & out, ...}; cudaLaunchKernel(( void * )__device_stub__acc, grid, block, args); } The link between the stub and the kernel only exists at runtime, through __cudaRegisterFunction . So the first analysis I wrote, KernelBindingTable , recovers that mapping statically: each host stub, its device kernel in each architecture’s module, and every launch site with its arguments and grid and block geometry. Every pass below is built on it. Reflecting on the implementation, we believe this mapping should be an operation in the IR rather than an analysis, which I come back to under future work. What made this harder than it looks Resuming from .cir . The pipeline has to re-enter cc1 with CIR as input and no ASTContext , so anything the later stages used to read from the AST has to live on the module. Dinos led the upstream work on this, starting from an RFC and tracked in #227917 . Lowering .cir input to objects landed in October ( #232506 ), and stopping before ABI lowering is still open. One context for two targets. Combining parses every input into a single MLIRContext , and CIR records are uniqued by name, so a different body for the same name on the device side is silently dropped. Valid code hits this: a host-only lambda shifts CIRGen’s anon.N counter, so the names stop matching. I have a prototype fix that namespaces device records on a separate branch . The first passes, and what moved runtime We started with a couple of passes that were partly a concept of how cross-boundary optimization could work: Pass What it does Runtime result Kernel argument constant propagation Folds an argument into the kernel when every launch passes the same constant Neutral on its own (1.0016× at 1× size, 0.9996× at 2×), but binaries were 11.8% smaller Launch bounds propagation Records the largest constant block size as nvvm.maxntid , like a user-written __launch_bounds__ 0.9998× geomean, and the SASS (NVIDIA’s machine code) was byte-identical on all 21 programs We expected launch bounds to be the biggest early win, since PolyBench declares its block sizes statically. On this suite the hint is invariant, and the reason is useful. NVPTX has no register allocator in LLVM, so ptxas makes the real decisions, and maxntid only gives it room to use more registers per thread. These kernels don’t spill registers to memory, so that room has nothing to relieve. The HeCBench kernels we forced by hand with stock nvcc were register-lean as well and showed the same result. We expect kernels with higher register pressure, the ones that actually spill, to benefit from this optimization, and we still need to widen our search for candidates like that. The pass only runs for NVIDIA today. Experimenting with AMD is something we still have to do, and we’re aware we might see different results on AMD or on Intel targets, although Intel isn’t something we support here. So by early September the infrastructure worked and nothing was faster. At our sync that week, Dinos suggested looking at aliasing: the host sees facts about buffers, and it could attach metadata like noalias . Andy had just added the start of alias analysis to CIR upstream. After launch bounds, I wanted to know whether the fact could matter before writing a pass for it. I injected __restrict by hand on the kernel pointers of 2mm , 3mm , gemm and gramschmidt and compiled with classic CodeGen, with no CIR involved. I wrote the rule down first: if the SASS stayed identical on all 9 kernels, we wouldn’t build the pass. It changed on all four programs, and kernel-region time came out about 2.3× faster on 2mm , 3mm and gramschmidt and 1.9× on gemm , with identical checksums. The remaining question was whether the compiler could prove what I’d written by hand. Launch-derived noalias The OffloadPointerFacts pass ( #30 ) starts from the acc example at the top of this post. For each kernel, it uses the binding table to look at every visible launch and checks that: every launch is known, each pointer argument traces to a different live cudaMalloc , and the kernel can’t reach those buffers any other way: no address-taken global, loaded pointer, escape or in-kernel allocation. If all of that holds, the existing kernel parameters get llvm.noalias : cir. func @_Z3accPfPKfS1_i (%out: !cir.ptr {llvm.noalias}, %a: !cir.ptr {llvm.noalias}, %b: !cir.ptr {llvm.noalias}, %n: !s32i) cc(ptx_kernel) The proof is kernel-wide and conservative: a repeated allocation, an unprovable argument or an unprovable path through the body drops every annotation on that kernel. My first version got this wrong, and review caught it. Dinos pointed out that I never proved the allocation reaches the launch. I only checked the order of stores, so this got noalias : float * A = B; if (c) cudaMalloc( & A, n); // skipped when !c k 1 , 1 >>> (A, B); // A == B The allocation now has to dominate the launch. He also showed a pointer smuggled through a uintptr_t argument, and a __noinline__ callee writing to a buffer through a device global. In the end, callees are checked with the same rules as the kernel, and later rounds of review from Dinos and Steffen Larsen turned the body check into an allow-list of pointer sources and made inline asm a rejection. The pass only adds attributes, and unchanged LLVM passes do the optimizing. Here’s PolyBench gemm at -O3 for sm_86 , trimmed, with index math and unrolling removed: ; before: c may alias a or b loop: %acc = phi float [ %c0, %pre ], [ %sum, %loop ] %va = load float , ptr %a.ik %vb = load float , ptr %b.kj %p = fmul float (%alpha * %va), %vb %sum = fadd float %acc, %p store float %sum, ptr %c.ij ; every iteration br i1 %done, label %exit, label %loop ; after: noalias from the host loop: %acc = phi float [ %c0, %pre ], [ %sum, %loop ] %va = load float , ptr %a.ik %vb = load float , ptr %b.kj %p = fmul float (%alpha * %va), %vb %sum = fadd float %acc, %p br i1 %done, label %exit, label %loop exit: store float %sum, ptr %c.ij ; once The sum was already in a register before the change. The store only stayed in the loop because the next load might read c . With the fact in place, LICM’s store promotion sinks it, taking the kernel from 6 stores to 2. Turning that off with -disable-licm-promotion brings all 6 back. The NVPTX backend also gets to use the non-coherent load form: 10 of the 11 global loads become ld.global.nc , and the remaining one is c , which is written. This pattern, accumulating inside a loop while alias uncertainty pins the memory access, is the one I kept seeing across the suite. Results Pass on versus pass off on an NVIDIA A10 ( sm_86 ), with everything else identical: 3 warmup runs plus 8 samples, serial, using the benchmark’s own GPU-region timer. These were measured at fbda065af219 , a revision that predates the final rounds of review. Validation passed in all 42 records across the two arms. Benchmark Speedup Benchmark Speedup correlation 7.17× gemm 1.90× covariance 7.08× atax 1.79× bicg 2.37× mvt 1.78× 2mm 2.28× gesummv 1.29× 3mm 2.26× syrk 1.07× gramschmidt 2.24× syr2k 1.03× gemver 2.05× adi 1.02× doitgen 2.03× The other six stay within about 1.5% of 1.00×, with jacobi-2d the lowest at 0.985×. Geomean over all 21 is 1.67× , and compile time goes up by 0.006 s per benchmark. These are the numbers I posted on Discourse and on #30 . That table only covers GPU-region time. I also compared the whole merge pipeline against the same -O3 CIR compilation without it, including wall time for the whole process: Problem size GPU-region speedup Wall-time speedup 1× 1.72× 1.19× 2× 1.68× 1.24× 4× 1.64× 1.25× The wall-time gain is smaller because GPU work is only part of the process. This run used an earlier revision of the pipeline at 7a94fd56356d and covers 20 programs. The 4× run was timing-only on a different A10. #30 has the details. Please read those numbers with these in mind: The kernels were forced static . If a kernel’s host stub is externally visible, another object could launch it, so the pass correctly leaves it alone. I patched the suite to make the kernels internal, which isn’t what you’d get on the suite as shipped. PolyBench is a starting point. These are single-file programs with flat kernels and small call graphs. Future work is to experiment deeper on large applications, catch the transformations that could yield better benefits there, and measure compile time on them too. 7× isn’t typical. In the whole-pipeline run, correlation and covariance dropped to about 4.6× at 4× problem size. One GPU, one vendor. The pass only recognizes cudaMalloc today, so these are CUDA numbers. The pipeline runs for HIP, but this pass doesn’t fire there on the final branch. HeCBench and other benchmarks Forcing static on every kernel isn’t an option for real code. Steffen contributed kernel cloning helpers that create a specialized copy of a kernel for a chosen set of launches and always keep the original, since the runtime can still reach it by name. A separate branch builds on them, so proven launches get an internal clone that carries the facts. That’s crucial for not having to write static all the time, and it’s what let us explore much more complex benchmarks. On the four unmodified PolyBench programs I ran, the gains mostly hold: 2mm 2.26×, 3mm 2.18×, gemm 1.81×, and lu 0.997× as a control. On HeCBench , the pass fires much less often and the gains are smaller: Benchmark Speedup Note chemv 1.75× Kernel pulled into the host TU with -include ; binary grows from 25.7 KB to 38.1 KB softmax 1.05× Stock source; loads become the read-only form miniFE, CG iteration 1.016× matvec inlined by hand; only 1 of 11 kernels is cloned To see how far this could go, I also forced noalias on every kernel pointer in IR, locally with stand-in headers, which gives an upper bound. Across 1,152 HeCBench kernels, stores or loops went down in 11. The accumulate-through-a-buffer pattern is less common there: a source scan finds it in 24 of 1,427 kernels, against 24 of 47 in PolyBench. In Rodinia’s 78 kernels, none lost a loop or a store from an innermost loop. When the pass doesn’t fire on real code, these are the main reasons: What blocks the pass Where we saw it Allocation and launch live in different functions 17 of 46 failed allocation traces in one HeCBench survey, plus miniFE Kernel defined in one file, declared in a header and launched from another 41 of 164 HeCBench benchmarks, including chemv cudaMalloc inside a nested scope, like an error-check macro About 77 of 519 HeCBench benchmarks Two buffers swapped between launches 14 HeCBench benchmarks, by source search Kernel passes a buffer pointer to a helper LULESH and 6 other HeCBench benchmarks Buffers owned by a framework object darknet, where forcing noalias takes the average pooling kernel from 67 SASS stores to 1, but none of the 48 launch sites we checked can be traced So the PolyBench numbers don’t carry over to real code today. The pattern is less common there, and when it’s present, the pass often can’t prove the facts. Limitations Separate TUs hide definitions. We merge one TU at a time, so a launch of a kernel defined in another TU only sees a declaration. The pipeline is also non-RDC only, so a device function calling a device function in another TU isn’t covered either. Solving this needs visibility across translation units, which is an inherent problem in compilers, not one specific to this pipeline. Tracing facts across the boundary is hard. When the launch sits in a function and the allocation happens in its caller, we can’t walk back and see every allocation, so the kernel gets rejected. A proper interprocedural framework would help more than another pass. Specialization has a cost. Cloning grows the binary, as chemv shows, so a cost model that decides when a clone is worth it would be great, and looking at what LLVM does for specialization is a good starting point. Status and future work Piece Status Container attribute and verifier Upstream ( #206576 ) Emitting and resuming .cir through cc1 Upstream, stop point before ABI lowering still open Driver integration, cir-offload-merge , binding table, passes Fork, on gsoc/combine-cir I’m staying on this after GSoC, and I’m planning to upstream all of these findings. The bigger goal is a much more generic representation of GPU programs in CIR, one that works across different GPU targets and runtimes: Launches connected through the call graph. KernelBindingTable is a proof of concept, and it’s one of the parts we likely need to reassess. MLIR has generic transformations like symbol-dce and sccp that dialects opt into through interfaces, and we could rely on them if a launch connected the call graph on the host to the kernel on the device. A higher-level launch op, similar to what the gpu dialect has, would make that edge explicit in the IR. This was also some of the feedback we got at the LLVM Developers’ Meeting. Generic runtime operations. The noalias pass has to recognize cudaMalloc , and with today’s shape we’d have to track every runtime’s allocation, whether that’s CUDA, HIP, liboffload or anything else. Ideally these operations would be generic in the CIR dialect, which is in part what the gpu dialect does. This representation can also introduce new diagnostics, because it sees both sides of the program. A small prototype warns when a kernel argument’s layout differs between host and device. I think the combine tool has a lot of potential, and conversations at the meeting with people from several important vendors in the space backed that up. I believe it’s one of the reasons someone would want to use ClangIR in the first place. Steffen also continues to help upstream and on the fork, and Mariya Podchishchaeva mainly upstream. What I learned The biggest surprise was how much alias analysis gave us. Initially our optimizations were a bit shallow: we went from constant propagation to launch bounds, and neither caused a noticeable speedup on PolyBench. I was sort of expecting aliasing to unlock something, since I’ve read a couple of LLVM’s middle-end passes and it’s one of the things that blocks many of them, but not at the level it did on PolyBench. The other thing I really learned is how to evaluate whether a pass is worth chasing. What I mainly did was inject the information a pass could derive, either from the front end or into LLVM IR, and check whether later passes consume it and whether SASS ultimately benefits. That’s far less work than the pass. Acknowledgements Thanks to my mentors, Dinos Parasyris and Joseph Huber, and especially to Dinos, whose idea this was and who I’ve been working with on CUDA support in CIR since January. Thanks to Steffen Larsen (AMD), who was working on a similar staging layer, reached out, and ended up contributing #27 , #28 , #31 and #32 to the fork. Thanks to the ClangIR maintainers Bruno Cardoso Lopes, Andy Kaylor, Erich Keane and Henrich Lauko for their reviews, and to Mariya Podchishchaeva for her upstream work on CIR. Thanks also to Google and the LLVM community for making GSoC possible. Links Final work: gsoc/combine-cir Talk: CUDA and HIP in ClangIR , LLVM Offload Workshop, Santa Clara, October 2026 Paper: GPU Device Compilation in ClangIR: Lowering CUDA and HIP Kernels Through the CIR Pipeline , with Bruno Cardoso Lopes, Joseph Huber and Dinos Parasyris, LLVM-HPC 2026 at SC26, November 16 Benchmark harness: polybench-gpu-audit Upstream PRs merged during the project: Area PRs Offload container #206576 CUDA/HIP codegen #195381 , #195382 , #195391 , #199270 , #204663 , #215314 , #231390 NVPTX builtins and attributes #195214 , #195217 , #214708 , #216447 , #221255 , #221261 , #221262 Address spaces #196868 , #226649 , #226650 Aliasing and floating point #221817 , #221818 , #226334 Tooling #196245 , #200266 , #229565 , #229575 Fork PRs are on RiverDave/llvm-project .📝The LLVM Project Blog
I don't like GermanyArno Schmidt, the greatest German writer you have never heard of. The German James Joyce. I don’t like Germany. Sorry, that isn’t quite correct, let me try again. I don’t like the things I associate with Germany. I associate Germany with decay and stagnation, with an increasingly inverted population pyramid, with committees and bureaucracy, with a lack of energy and dysfunction. The Coffee Machine My aunt once told me a story. At work the coffee machine in the break room broke down. It was an old, shoddy thing. Cheap. We’re talking Mr. Coffee(tm) drip coffee machine cheap, the sort of horrible thing you can get for fifteen bucks at your local supermarket. Replacing the darn thing would’ve been easy, but that’s not what happened. No, this is Germany . In Germany management will disavow all responsibility over the break room coffee machine, and push it onto the employees. “Ah no, we cannot do zis! Filling in the procurement forms for a new coffee machine and billing the company would take multiple weeks, however you may pitch in to buy a new employee-funded coffee machine, yes?” The employees, each broken by the oppressive spirit still haunting the land, fail to see any issue with this and form a small committee. (Participation in various committees is the German’s natural pastime.) The committee decides on a single person, who then reaches out to the other employees during their break time, and asks them to pitch in four euros worth of money for the new coffee machine. A week or two later the deed is finally done, and a new coffee machine stands in the break room. That’s what I associate with Germany. Tedious processes that are drawn-out for no reason in particular other than to “follow proper procedures”, and which could have been cut short if literally anyone involved in it had capitalized on their own agency. It’s a fucking coffee machine! It’s a near-mandatory productivity multiplier! Just buy the fucking thing! I don’t care if you’re the manager here or just an employee, no one benefits from dragging this out into a two week process just to shuffle the responsibility back and forth! Well, why didn’t they? I don’t know. It’s Germany. It’s something in the air, or maybe this is just the national spirit of the people. In Germany when a problem is discovered all involved people nod solemnly and say “Ja, zis is ein Problem.” and then they spontaneously form a new committee to discuss the problem. The committee will then formally note down that everyone agrees that the problem is, in fact, a problem, and then consider the proper procedures for resolving the problem. Most of the time this will result in the formation of another committee, or exasperated exclamations of the “Well, this really should be the government’s responsibility!” type, which then might result in a letter being sent to some local government official. Everyone feels that things have to be done “the right way” (committees) and at the same time the bureaucratic overhead is so exhausting that no one wants to be the person who’s doing it. That might be it. The exhaustion, that is. The sheer pain of trying to go against this. No one wants to work against the “proper way of doing things” because of how bad it is. Everyone just accepts it. It’s so deeply engrained that everyone has resigned themselves to not push back. This is Germany. It’s a place with no change. Just stasis. In the USA, at least, people will spit at you and work around the barriers you put in their way. In Germany the overwhelming smog of lethargy smothers the nation, and no one tries to fight it. Just sigh, try to put on a smile and embrace how much easier it would be to never do anything at all. Needless to say, my aunt worked at Storck all the way up until retirement. That’s German work culture. The Bikeshed God. Don’t remind me of the bikeshed. So, mond lore drop: For a few years of my life I lived in a German suburb. The sort of suburb where you send old people to die. I was living in a home for autistic people, the sort of well-meaning German boomer community project funded by parents who worry that their children will never move out , and decided to solve the problem by funding a committee that manages a home. This was good. Don’t get me wrong. I struggle with pretty severe autism and ADHD, and I don’t think I could’ve managed the whole “moving out” part without a gentle ramp. So, I was living in this apartment for autistic people. Unfortunately, out of the whole pack I was the high-functioning one. I was the guy who took it upon himself to try to organize BBQs, host cooking events in the communal area, do a little bit of gardening, and so on. I had an excellent friend there, my second-in-charge autist, but most of the others either never left their apartments or were barely capable of masking or both. I still don’t know what to think of this time. On one hand, I think “being the lone high-functioning guy”, the one-eyed among the blind, helped me become a stronger, more organized person. On the other hand, it’s the kind of thing that slowly burns you out over the years. You are the single guy who has to do everything because no one else can be trusted to handle anything at all. Imagine organizing a communal cooking event in a bone-headed attempt to BUILD COMMUNITY, since you’ve read the Wikipedia page on Bowling Alone and are worried about social isolation and so on and so on. Yes, it’s all badly self-inflicted pressure but it still hurt me : I tried to wrangle several severely autistic people to get them to peel potatoes , but due to their lack of functioning, I have to be the person who manages the pot, stays on top of everything, runs errands, and so on, and what should be a community-building event just ends up slowly burning me out over time. Deep down there was a hope here that, maybe, I would be able to lift these people up and form something of a self-sustaining thing. Along with the Jordan B Peterson in the back of my head saying shit like “Look, if you are not going to do it, no one else will. Go and push the boulder up that hill, bucko!” But of course, to me it felt like most of them never changed. They either didn’t want to change, didn’t know how to change, or didn’t even have the language to explain the situation they are in, even if it’s obvious from the outside. I had contempt for them, and was terrified that I was just like them. That I’d be stuck in stasis for all eternity, and then just die , and I tried to fight that wherever possible. It burned me out. Just a little bit. I carried the torch for a while, then fell, and I am glad my second-in-charge and other friends were able to pick it up for a while when necessary. My second-in-charge grew as a person. He really did. He picked up the torch after me, he helped me carry this stupid-ass boulder up the idiot hill I had decided to die on, and he is a great friend. So, how does any of this relate to a bikeshed? Sorry, this section was supposed to be about the bikeshed . Ah, well. Long story short, the house was supposed to have a fucking bikeshed. What ended up happening is that the German boomer committee that formally owned the house ended up discussing the bikeshed across the span of easily a full year. The meetings on this weren’t frequent, rather, this was the situation where every two months or so everyone sat down in a room together. Then, all the same topics were litigated again and again, taking into account anything that had changed over the months. You can imagine my situation, sitting in these meetings while German boomers are discussing a literal bikeshed over and over. Don’t get me wrong, it was bearable . It was fine. I didn’t even hate it. Yes sure, it was all tedious, but “this is how you do stuff, right?”. This is how shit gets done, right? And now I’m here, a few years later after I finally left, and I still feel the shadow of Germany hanging over me, and I howl like a beaten dog. The bikeshed was built. Eventually. After exhaustive, stupid back-and-forths between the association managing the community and the real estate corporation having formal ownership over the property itself. Leaving By the time I slowly approached my last year of university, I knew that I’d have to figure out what was going to come next. Where was I going to go? What sort of job would I even get with a degree in theoretical mathematics? University had slowly hammered me into shape and transformed me into a barely-functioning adult. I was still living in that German suburb, in the small house for special autistic people. I was doing fine. I had grown stronger over the years somehow, but the prospect of spending any more time in this desolate place was gnawing at me from within. All that was left was my thesis. The bargain was nearing its completion, and my soul was going to be up for grabs. The Dämons were already prowling, waiting and watching. Unwilling to offer any help, knowing that I would come and beg them for a job, for help, for anything at all. That’s when they would make me sign a contract in blood, strip my soul of any remaining ambition and Lebenswille, and drag me into the abyss where I would rot for all eternity. A bloated, fat German face wrinkling its forehead and sneering at me, saying shit like “We don’t do zis in Germany.” while asking me to fill in forms and do meaningless busywork for all eternity just to get by, in a city where nothing ever happens, with no people who would ever commit to anything that could compromise their scheduled dinnertime. When I say that I was terrified of staying in that godforsaken suburb, I mean it. I was worried I was going to rot and die there . That I will never escape the gravitational pull of this place, and wake up one morning and realize that there is nothing left of me. I felt like the one guy trying to carry the flame, in a place drowning in committees and lacking in ambition. A place where people never ask what they truly want to do, a place where everyone always chooses the easiest way out, and no one ever wants to bear responsibility or change . A place where even the thought of having fun just exhausts people. I leaped, and threw myself at a few opportunities. I taught myself how to code, back when this was still a reasonable thing to do. I visited a girl in Kyiv, back when this was still a reasonable thing to do. We became a couple, of sorts. She got a job offer in Warsaw (i.e. Poland, i.e. a neighboring country) and I decided to move with her. Yes, it’d be easy to say that I wanted to move “with” or “for” her, but this was not the whole truth. The truth is that I wanted to leave Germany. I had to get away. Anything. I needed a proper job, at any corporation that didn’t require you to submit a story of your life and multiple cover letters to apply, and was not rotting from the inside out with German committee boomerslop. Stasis If that sounds like I’m projecting too much onto the national spirit of Germany… Yeah. The truth is that the reason why I feel so strongly about this, why I’m still rambling like a madman, is that I see myself in them . It’s my own fear of giving in to the pull of nothingness. The pull of rot. Not the pull of pleasure or hedonism, no, the pull of sloth . The fear that I will never be more than what I am right now. That I, that the people I know could never transcend their limits, and overcome their flaws. If you’ve spent any time reading articles I have written, you will know that this is like, a whole recurring theme in my posts. Why? I don’t know. The stasis is the end. As I grew up I watched and saw people around me turn into caricatures of themselves. Fluid intelligence slowly crystallizing, until nothing was left. Until a person you liked just turned into an NPC, you know, the type of person who will reliably try to tell the same tired joke every single time a topic is brought up. This is what I saw happening to my parents. They had me rather late, you know? Like, late 30s late, or something like that. I got to watch my father slowly degenerate. Yes, he was a smart man, but his brain slowly crystallized, he spent too much time in his den, he probably had some level of untreated ADHD, and he never managed to do that one trip he’d wanted to do. Instead he just turned into a flanderized puppet, into someone who still knows a few things, but who is still stuck in a world from thirty years ago. You can talk to him, but you’ll learn to avoid certain topics. Not because he’s wrong or unpleasant, just because he’s hollow. A caricature. Saying the same shit you already heard several times before. He never kicked his old habit of drinking, he never quite managed to lose weight. And then eventually his health caught up with him. He ended up in a hospital, and died a few months later. All that’s left is an enormous pile of books and vinyls, old trinkets that were once meaningful but are signs of decay. By that time I was in Warsaw, and about to depart on a flight to London. Some business trip. I had managed to land a job at Google. The moonshot of working my ass off for over a year to learn how to code had, in fact, paid off, and turned out to be the best decision I’d ever made. Instead of cancelling the trip I just went ahead. I’d already made peace with my father’s death months, if not years before he died, honestly. Or maybe I’m just cold, and don’t know how to feel. Maybe it’s both. I know that it hurts when I remember him. I made it back to Germany in time for the funeral, and I forgot if I cried. But I was there to support my mother, even as the age is slowly and steadily getting to her. Do you understand what I am afraid of? It’s all of that. It’s the fear of ending up in stasis, of failing to make the change that you have to make, of failing to overcome your boundaries, of rotting away. The truth is, it’s not that I hate Germany, it’s that I’m afraid of it. I am afraid of myself, of carrying this curse inside of me, of never being able to escape the same pit that swallowed my father, some of my friends, and so many others. Right now I’m on a work visa in the United States, and I don’t regret it one bit. I love the people I met here. I love my friends. I love bantering with them, I love to spontaneously ride my bike just to hang out, I love to take cold plunges in mountain rivers, playing cards, laughing at tired jokes, and discussing the world. Most of all, I love their ability to just do things . The flame in their eyes, the lively spark, the will to climb a tree for the sake of it or to do anything at all. And I fear that, if I were to ever lose my job, the Dämons would come for me and pull me into the abyss, I’d end up back in Germany and never escape again, just rot. “Come here! We finally GOT YOU. You thought you could be in control of your life? You thought you could go and meet people? Hah! Down into the pit of doom with you! Nothing but sloth for you, let us quench your fire. No joy, no pain, just emptiness.” More than that, I fear that I will age and turn into a shallow caricature of myself, and not even one anyone would find funny. I fear that my fire will grow small, that I will look at all the things I could be doing and say to myself “All of this sounds so tiresome. I’d rather just lie down and sleep.” and then I will lie down and never wake up, or worse, turn into a hollow shell of myself and go through the same motions as I did every day while everyone around me acts like I still have the spark of humanity in my life. Look! Friends don’t allow friends to flanderize themselves. Show me your beautiful and delicate soul. Be more than you were yesterday. Suffer, but be honest and real in your suffering, instead of resigned to it. Ask yourself where you want to be tomorrow, then struggle and change . Be someone else. If we make it to the post-scarcity future, this will be all there is to it. A painful infinite climb up a mountain, sculpting yourself along the way, or stagnation and nothingness. Climbing Trees Even knowing how many things I’m projecting onto Germany, I don’t know if I will ever be able to come to terms with it. The country damaged and hurt me with all of its bad, nonsensical habits and tics. It’s a place with insane hiring expectations, where you are expected to hand in a full history of your life, high school diplomas on top of university paperwork, an application letter, a professional photo of yourself, and so on. It’s a place where trying to pay for your own prescription at the psychiatrist results in the secretary derisively wrinkling up her nose, telling you that “it’s so much more work to do the paperwork if it’s not via insurance” and that “she has to check with the doctor first”, a week after your father died, while you are running out of meds you need to function. (Yes, this really happened to me.) It’s a place where nothing ever happens . Where everything is late. Where decisions are never made on schedule, and committees run everything. Where the people that had the most positive impact on my life all extensively lived in other countries, and were willing to get shit done without bothering with the small-minded, life-denying German spirit. Despite all of this, if I ever were to move back to G*rmany, I would probably survive. I have grown, and I have changed. I am a different person now, even if that means looking at old friends and faces, and realizing that you have grown apart, and will see each other less frequently than before. That’s the cost. If I ever come back, I hope I’ll find a nicer place to live. Maybe Berlin, maybe any big city with an active scene of hackers, do-ers or even party-goers and artists, whatever it is. It just has to feel alive , and have people who are not above climbing random trees.📝MOND←TECH MAGAZINE
Pattern Matching for C++29Update from Búzios, a tour of P2688R6, and next steps📝Michael ParkSunday, November 29, 2026
Lightning Talk: Run-time Template Parameters - Sort Of - Braden Ganetsky - C++Now 2026🎥CppNow
Most Valuable std::variant (Part 1)Most tutorials introduce std::variant as a way to store unrelated types in one variable. Ivan Čukić shows its far more valuable use: modelling program states so that invalid states can't be represented, RAII works again, and hidden coupling between members disappears.📝MC++ BLOG
Back to Basics: Abstractions :: Nathanel Ozeri🎥CoreCpp
AI Made a 3D Game Engine from a SINGLE PROMPT... but is it good?🎥The Cherno
Today was a Day of RotAfter incredible effort, you manage to get out of bed. Today was a Day of Rot. Nothing of today was redeemable. Well, except the part where I learned how to sew a button back onto my pants. It was about to tear off, y’see. That was nice. I don’t think I did a particularly good job, but I hope it’s going to last for at least a few months. When working hard and single-mindedly, I keep my bar at most one Day of Rot per week. Any more than that is a sign something is deeply wrong. Less than that is good, and can be achieved using the power of friendship, going sicko mode running or biking to the point of exhaustion, not working on the same problem every day , and getting enough sleep. I do not enjoy Days of Rot. It’s a day of being stuck in a dopamine hole, a day of trying to do things and failing, a day of searching for an inner flame and finding none. On those days, it may be better to resign yourself to the Rot sooner rather than later. It’s a gamble. Either you push through, pierce the heavens and spiral towards lock-in, or you drift and float, and your attention is a piece of roadkill by the side of the road. On some days I wish for the Rot to take me even deeper. I need to suffer. Suffer to the point I’m about to drown in dark, black liquid and finally understand which change I have to do to my life to transform into someone, or something else. I want the panic to set in. The fear. The knowledge of death, the adrenaline, the disgust. But it rarely happens. And the fear of being unable to change, of stasis, is just not directed enough on its own. “What do you want to do today?” I don’t know. Nothing. Lie on the couch. Whatever I am already doing. “But don’t you want to write?” Maybe. I don’t know. If I wanted to write, then I’d already be writing, no? There’s just a hollowness there, where my desire to do anything should be, and I am a zombie guided by cheap dopamine. Oh, to be a mere cat or dog lying in front of a warm fire! It would be rather nice now and then. “Then what’s stopping you? Just lie down by the fire? Relax? Play video games? Do something you enjoy ?” Here’s the issue: On a Day of Rot I would not even enjoy video games. There is nothing here that enjoys. Just dull emptiness, tightness, wrinkled disgust, frustration, unwillingness to look at anything beautiful or nice. I am probably lying to myself. I don’t know. Maybe I’d be better off if I just recognized the Rot early, and just played Balatro for two hours in the morning. Or commited to doing anything I’d like to do. Low effort but makes you good afterwards type shit. Before the Rot truly sets in, let myself flow and go where the base instinct, the voice that wants to sleep and eat cookies in the bed takes me. Stifle it, smother it with what it craves. And then be alive and awake and capable of unifying thought and action. Alternatively, I get up. I look at bright lights. I have “a responsible breakfast”. I feel the dull ache in my temples grow throughout the hours. I chant “lock in lock in lock in”, and hope I have a specific draft or task that grabs me, and which I can ride towards freedom. And that either works, or it doesn’t. It’s probably all just some weird sleep and dopamine thing, where sometimes I overwork in the evening, or stay up too long, or something like that. Who knows. Oh, and ADHD meds, of course. The mystical pills people treat like literally-fix-everything-and-lock-in buttons, but which only work if you know exactly how to take them, and then fail mysteriously 20% of the time. (Hint: When you take them you have to start working on something you want to work on immediately. They increase your ability to lock in during a tight 20 minute window. If you fail to lock in during that time you’ll be in Rot territory. And tense. And awful. Since you are still on ADHD meds. Your stimmed brain-cycles crystallize on your patterns of distraction, and you’ll spend the next few hours jumping from feedscroller app to feedscroller app, with no chance of escape.) If I get lucky I may find my energy return in the far evening, at 8PM or so after far too many hours of nothingness. And then I find myself sitting somewhere, writing, and much to my dismay, I may even enjoy it. I’m beginning to feel the flow, and I hate feeling it at this hour, as the words are finally flowing like curdled milk out of the carton. Sorry, what I am writing here is disgustingly meta. If you want to scrape one meaningful cornflake of wisdom out of this disgusting bowl of cereal, here: Meta is easy. There is nothing, and no one to stop me from going meta at any possible moment. Want me to prove it? Look, I am doing it right now. This is meta, and it is the meta. These are the words that I am writing right now, except when you’re reading them, they will already have been written, and no amount of disgust you feel for this slop can un-write them. Actors practice for years to resist the urge to look into the camera. They could do it at any moment, and if they do, if they wink and wave and say “Hey look! This is a movie!”, it breaks the illusion the whole movie has worked so carefully to sustain. Is meta bad? Meh. Maybe. Allow me to wield my cudgel of online discourse and loudly proclaim that it depends, and that nuance is required. Some meta is good. But it is easy. The hard part is getting your viewers, readers, players so immersed that they don’t see the sledgehammer of meta coming. Alternatively, keeping them immersed despite the meta. This post? It’s not what I wanted to write. (That’s just another secret from me to you: I am addressing you directly, in itself an act of meta-aggression.) What did I want to write? Something easy. Well, this was easy. Because I wrote it late. But I wanted to like, I don’t know, spit a listicle on “obscure indie video games that made me cry and which I enjoyed” onto the page. But I didn’t. Maybe another day. In the meantime, go and play Titanium Court . It’s a game about yourself, there are no wrong decisions, and it has a free demo.📝MOND←TECH MAGAZINESaturday, November 28, 2026
Why updating C++ packages is a trap #cpp #programming #developer🎥CppCon
A Declarative Startup Model for Cortex M Microcontrollers - Alexey Karelin - Meeting C++ 2026🎥MeetingCpp
Generating Language Bindings using C++ Reflection - Callum Piper - ACCU 2026🎥ACCUConf
Who cares about the new C++ standard?A new C++ standard gets plenty of attention. But who is waiting for it, and what would make an upgrade worth the effort?📝Engineering the Craft
Inkbird IAM-T1, ESPHome and Home AssistantMonitoring CO2 I’ve not been sleeping well recently and realised that, since it got colder, we’ve not been leaving the bedroom window open like we used to. A bit of googling suggested that the CO2 level in the bedroom may be contributing to my poor quality sleep and so, as is my way, I decided I needed to measure it. I have been playing with Home Assistant for a while now and so I wanted whatever I decided to use to monitor my CO2 to integrate into my smart home.📝Rambling Comments - Len Holgate's blogFriday, November 27, 2026
Why I Learn Old APIs Like OpenGL🎥Zed A. Shaw
Lightning Talk: Reflection - The Monad - Ben Deane - C++Now 2026🎥CppNow
Could we use the CoreApplication Properties to manage the lifetime of an object that refuses to be marshaled?It doesn't help with the underlying problem. The post Could we use the CoreApplication Properties to manage the lifetime of an object that refuses to be marshaled? appeared first on The Old New Thing .📝The Old New Thing
Component Based or Monolithic Development for Large C and C++ Projects: Why Not Both? - CppCon 2026🎥CppCon
Webinar Recap: Embedded Debugging With CLion and SEGGERCLion supports debugging embedded targets with SEGGER J-Link. Recently, we extended this integration with one-click access to Ozone and SystemView, as well as the ability to run debug sessions using AI agents. We presented the updated integration together with SEGGER in a joint webinar, and this post summarizes the highlights. You can also watch the […]📝CLion : A Cross-Platform IDE for C and C++ | The JetBrains Blog
AI vs. The Algorithm - Reclaiming "The Scene" through Ethical Vocal Synthesis - Seann Nicols🎥audiodevcon
std::chrono building a stopwatch for profiling | Modern Cpp Series Ep. 254🎥Mike ShahThursday, November 26, 2026
Our textbook on machine learning and artificial intelligence is outRobert Godin and I have a new book. The title is Introduction to Machine Learning and Artificial Intelligence with Python. The paperback came out today. It is 741 pages. The Kindle edition is there too. IWe wrote the book as a first course in a college program or at university, and for a programmer who … Continue reading Our textbook on machine learning and artificial intelligence is out📝Daniel Lemire's blog
FFTs Part 6: The FFT-20XX Real-Input Algorithm(s)Here it is, the final part of this series of posts about FFTs and the specific algorithms that FFT-20XX uses. The Discrete Fourier Transform The Basics of the FFT Some Optimizations to the FFT The Inverse FFT The FFT-20XX Complex-Input Algorithm The FFT-20XX Real-Input Algorithm(s) (← you are here) Over five posts we’ve gone over way more about the FFT than I ever intended to write, up to and including the complex-input algorithm used by FFT-20XX. But one thing we haven’t gone over yet is how to deal with purely real-valued inputs (like, for instance, most audio and video applications). This took me a hot minute to get right and was effectively the final boss of the whole project! Once again, we can’t just jump right in — first, we need to talk about real-input FFTs. Real-Input FFTs For FFTs where the inputs are only real values (like audio samples), at first glance it may seem like there isn’t enough memory to store all of the results. For example, a 256-element real-input FFT would have 256 real (scalar) inputs , but generate 256 complex outputs (each of which contains two scalars), which means it seems like we’d need 512 scalars worth of output data . But, if we go all the way back to part 1 of this series and play around with the diagrams again, we’ll note that the DFT creates the folowing values: The first element is the DC bias (or DC offset) . This is always a real value when there are only real inputs (as all of the rotations are 0, so nothing ever ends up in the complex (y) component). The next N 2 − 1 \frac{N}{2} - 1 values are complex, representing the (non-zero) frequencies below the Nyquist frequency . The value at index N 2 \frac{N}{2} represents the aforementioned Nyquist frequency , and — like the DC bias — is always a real value when the inputs are real (as the rotations are either 0 or 180 degrees, which is effectively only ever a scale of 1 or -1). The remaining N 2 − 1 \frac{N}{2} - 1 values are complex, but they are (in reverse order) the complex conjugates of the other complex values when the inputs are all real values (they are still distinct values for complex inputs) Note The complex conjugates are in the opposite order from each other. If you recall that our angles look like: 0, 1, 2, 3, 4, -3, -2, -1 Angles 1 and -1 are conjugates, 2 and -2 are conjugates, etc. This little reversal caused me a lot of headache while trying to get this all to work, as you’ll see in a bit! So what we have are N 2 − 1 \frac{N}{2} - 1 complex values, 2 real values, then the rest are effetively redundant, as they’re the same as the other complex values but with the opposite sign on the imaginary component. Conveniently, that’s N N scalar values , which fits exactly in the same amount of space as our inputs! Note Traditionally, to keep the complex pairs together, the Nyquist value gets moved to be paired with the DC value, so the memory layout ends up like: v d c v_{dc} , v n y q v_{nyq} , r 1 r_1 , i 1 i_1 , r 2 r_2 , i 2 i_2 , …, r N / 2 − 1 r_{N/2-1} , i N / 2 − 1 i_{N/2-1} That’s great! Now we know that we can store the values in the same amount of memory, now we just need to figure out how to compute the values in half the usual memory! Computing the Real-Input FFT There are a few techniques that people have used to calculate the FFT of purely real-valued data. One trick (illustrated here ) is to compute two halves of the real FFT at the same time using a single ( N 2 \frac{N}{2} -length) complex FFT, then combine the two halves into the final result with a single radix 2 step. This works well, but there are more-efficient ways to do it. Instead, we’ll start with an idea from this 1968(!) paper by Glenn D. Bergland. Remember that the (radix-2) decimation in time algorithm does a pass of standard 2-element FFTs, then a pass of 4-element FFTs, etc: A standard 16-element radix-2 diagram. " " 0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0 0 0 0 0 4 0 4 0 4 0 4 0 2 4 6 0 2 4 6 0 1 2 3 4 5 6 7 We can take advantage of the fact that every real-valued FFT has two real output values (DC and Nyquist) and the rest are complex conjugate pairs. Here’s that diagram again, this time with known-real values labeled with blue squares, the “necessary” complex values labeled with green up-pointing triangles, and the redundant conjugate complex values labeled with red down-pointing triangles (some of the triangles have circles on them, I’ll explain those in a moment): A standard 16-element radix-2 diagram, where the values have been color-coded by function as described above. 0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0 0 0 0 0 4 0 4 0 4 0 4 0 2 4 6 0 2 4 6 0 1 2 3 4 5 6 7 There are some interesting things to note here: The first pass has only real outputs : Because there are no rotations involved, it’s just an add/sub step, leaving everything still real. In the next step, half of its outputs are real . This makes sense: two outputs get computed with no rotation and two with a 90-degree rotation (which end up as conjugates of each other). From the second step on, every step has half the number of real outputs as the step before , ending when there are just two left (DC and Nyquist). Each sub-FFT (past the first) has four real inputs, and of those, one pair is used without rotation, leaving them real. The other pair of real inputs to these sub-FFTs, it’s worth noting (because we’ll use this later), is always done with a 90-degree rotation . This is what the small circles on those values signify. If we instead visualize this with standard-order inputs and bit-reversed outputs, it can give us even more insight: The same 16-element FFT diagram, except reordered as described above. 0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 4 2 6 1 5 3 7 0 0 4 4 2 2 6 6 0 0 0 0 4 4 4 4 0 0 0 0 0 0 0 0 Viewed this way: The halving of the number of real values after the first step is much easier to see, as we keep them all contiguous. In this ordering, DC and Nyquist end up next to each other at the end, exactly as we want for our final output! Every complex value in the final output is paired with a conjugate value. Note that these are not necessarily paired conjugates (see the note earlier about how the pairs of conjugate values are in the opposite order from each other). Every computation step (the circular nodes) with complex inputs kicks out one “standard” complex value and one “redundant” value. Again, these are not always conjugates of each other! The 90-degree rotations (the arrows with circles on them) are always the first set of complex conjugate pairs after the real outputs (as they are the output from the half of the real inputs to this step that were rotated). Zeroing in on that third point, if every computation kicks out one redundant complex value, we can use that to our advantage: instead of storing that redundant value, we could use its storage to hold the imaginary value for the non-redundant output . That gives us enough space to do the whole computation in the memory we were provided! To figure out the best way to do that, let’s go back to one of our diagrams from part 2 , showing the way that the elements interleave during the FFT computation: A diagram (originally from part 2) showing the inputs on the left in bit-reversed format, then they interleave in groups of 4, then 8, then 16, before ending up in standard, ascending order as outputs on the right. 0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15 0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15 0 4 8 12 2 6 10 14 1 5 9 13 3 7 11 15 0 2 4 6 8 10 12 14 1 3 5 7 9 11 13 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Now we’re going to relabel the redundant conjugates’ indices to correlate them with their matches (recoloring to match the above butterfly diagram, and using “R” and “i” to show which gets the real and imaginary components): The same diagram as above, but this time with the values color-coded as to whether they are real, complex, or the complex conjugate, and the conjugates have been re-labeled to show the index of the value they are the conjugate of. 0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15 0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15 0 4 R 8 4 i 2 6 R 10 6 i 1 5 R 9 5 i 3 7 R 11 7 i 0 2 R 4 R 6 R 8 6 i 4 i 2 i 1 3 R 5 R 7 R 9 7 i 5 i 3 i 0 1 R 2 R 3 R 4 R 5 R 6 R 7 R 8 7 i 6 i 5 i 4 i 3 i 2 i 1 i Now, let’s rearrange the rows of this to have the inputs in standard order (to match the butterfly diagrams above): A diagram similar to the above, but reordered such that the inputs on the left are in standard, ascending order and the outputs on the right are in the bit-reversed order. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 8 9 10 11 4 R 5 R 6 R 7 R 4 i 5 i 6 i 7 i 0 1 8 9 4 R 5 R 4 i 5 i 2 R 3 R 6 i 7 i 6 R 7 R 2 i 3 i 0 8 4 R 4 i 2 R 6 i 6 R 2 i 1 R 7 i 5 R 3 i 3 R 5 i 7 R 1 i Now we can see that we hypothetically have space for everything, but if we keep things in their standard order, we end up with complex pairs that are not actually correlated (note how 1 R 1_R is followed by 7 i 7_i , etc). Ignoring that for a moment, let’s look at what we have to do to even make this work (sticking to radix-2 for now). For any given radix-2 computation involving complex inputs, we actually end up needing to load two at once, because both the “real” and “imaginary” component still represent two distinct values (the complex conjugates v R + i v i v_R + i v_i and v R − i v i v_R - i v_i ), and thus are used to get two different sets of outputs. To illustrate this, we’ll use a modified butterfly diagram, showing the two pairs (one real, one imaginary) that go into each value, and the corresponding values that come out: Note I left the rotations off of this diagram, mostly because I couldn’t figure out where to put them. A modified radix-2 butterfly diagram showing the pattern of accesses necessary to use the real and imaginary components (stored separately) to compute their corresponding outputs. It's a bit of a mess. --> 0 8 4 R 4 i 2 R 6 i 6 R 2 i 1 R 7 i 5 R 3 i 3 R 5 i 7 R 1 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Welp. This is a bit more of a mess than our previous diagrams due to the overlapping ranges here. Each computation that has complex inputs, as we said, has two pairs of inputs, and writes to two pairs of outputs. Importantly: The indices for input and output per computation are always the same , though which values get paired changes from input to output. In addition to the real and imaginary components not ending up paired (again, note that 1 R 1_R is paired with 7 i 7_i , which is not its imaginary part), the other problem with this arrangement is that it very much does not SIMD well . Plus, even if it did, it ends up causing problems when we get to doing the incremental bit reversal (similar to how the complex-input did it)! Note Specifically, once this gets squished together into radix-4 and there are passes loading 4 sets of radix-4s to do the bit flips, as it gets closer to the end for larger FFT sizes (ones that would be prohibitive to diagram here), there end up being long dependency chains through the various butterflies needed, and frequently the final step requires all of them be computed at once in order to properly do the final bit flip pass! That’s not ideal. But, going back to that paper by Glenn D. Bergland, we can change the order in which we save out the imaginary components, such that things end up staying paired: The block interleave diagram again, but this time with the imaginary components stored in different orders, and how that filters through the system. The output pairs are now correlated (the real and imaginary components are stored contiguously). 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 8 9 10 11 4 R 5 R 6 R 7 R 4 i 5 i 6 i 7 i 0 1 8 9 4 R 5 R 4 i 5 i 2 R 3 R 2 i 3 i 6 R 7 R 6 i 7 i 0 8 4 R 4 i 2 R 2 i 6 R 6 i 1 R 1 i 7 R 7 i 3 R 3 i 5 R 5 i At first glance, this looks great! A given set of “real” values (the non-redundant complex values) is now followed by its corresponding “imaginary” parts (its complex conjugate) at every step, which is what we were looking for! If we do a butterfly diagram again, it’s a lot more regular-looking than the last one: A modified radix-2 FFT diagram showing this new ordering. It is considerably less messy than the last attempt. --> 0 8 4 R 4 i 2 R 2 i 6 R 6 i 1 R 1 i 7 R 7 i 3 R 3 i 5 R 5 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 So it seems like maybe this is the point where we start in on the bit-reversal like we did with the complex-input FFT. Buuuuut before we do that, we can make this a little more efficient! 90 Degree Rotations This whole time we’ve been labeling the complex values that are the result of a 90-degree rotation with the promise that it was going to be important. Well, the time is nigh! As we’ve gone over many times, the decimation in time algorithm rotates the second input and then adds it to and subtracts it from the first input to get the two outputs for a given computation step: y 0 = x 0 + k x 1 y_0 = x_0 + k x_1 y 1 = x 0 − k x 1 y_1 = x_0 - k x_1 In the event that we’re rotating by (negative) 90 degrees, k k is just − i {-}i : y 0 = x 0 − i x 1 y_0 = x_0 - i x_1 y 1 = x 0 + i x 1 y_1 = x_0 + i x_1 If x 0 x_0 and x 1 x_1 are both real numbers (which they are, for our 90-degree rotations), and we’re only writing out the first complex output y 0 y_0 (where the real component goes where y 0 y_0 lives and the imaginary component goes where we would put y 1 y_1 ), then the value at the location of x 0 x_0 / y 0 R y_{0R} is completely unchanged (the real component of y 0 y_0 is x 0 x_0 ), and the value at the location of x 1 x_1 / y 0 i y_{0i} is just negated (the imaginary component of y 0 y_0 is − x 1 {-}x_1 ). An Example If we have the two input values x 0 = 8 x_0 = 8 and x 1 = 3 x_1 = 3 for a radix 2 butterfly with a quarter-turn rotation, rotating the latter (as it’s our odd input) turns it into − 3 i -3i . Thus the sum for y 0 y_0 ends up being 8 − 3 i 8 - 3i . Because we’re only writing out y 0 y_0 (putting its imaginary component where y 1 y_1 would go in a complex FFT), one value written is 8 8 and one is − 3 -3 . And since these are being written to the same 2 indices that the inputs came from, the end result (in memory) is simply a negation of the second input: the 8 8 remains unchanged, and the 3 3 is negated. So let’s redraw the diagram again, making those parts be pass-through, except for a negation (represented by a long red rectangle): A similar diagram to the last radix-2 diagram, except where there were real values being processed into complex pairs, instead we have denoted that no work happens (besides the imaginary outputs being negated). --> 0 8 4 R 4 i 2 R 2 i 6 R 6 i 1 R 1 i 7 R 7 i 3 R 3 i 5 R 5 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 So now there are these blocks where nothing is happening except a negation ! If we, instead, moved the negation to the end of the previous phase (when writing those values out), we can collapse all of those down (shifting everything after one of these negation-only passes to the left in the diagram), removing almost one entire pass (everything except the computation of outputs 0 and 8): The same diagram as above, except the "no work being done" sections have been collapsed, so overall there is one less pass of FFT calculation. The only exception are the first two outputs (indexed 0 and 8), which remain real the whole time and thus cannot collapse. --> 0 8 4 R 4 i 2 R 2 i 6 R 6 i 1 R 1 i 7 R 7 i 3 R 3 i 5 R 5 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 This gives us two nice properties: The main one: now instead of log N \log\,N steps, we are doing ( log N ) − 1 (\log\,N) - 1 steps (with a single addition and subtraction at the end to compute the final two values). The real groups are all consistent, and the last half of each real group negates the second outputs (outputting x 1 − x 0 x_1 - x_0 instead of x 0 − x 1 x_0 - x_1 ). Now we’re doing less work, and it’s all very regular in how it works (which means good things for SIMD implementation!), so finally it’s time to handle… Bit Reversal Two related things change the way we do the bit reversal in this: We’ve managed to work our equation such that we have all of the pairs of values (DC/Nyquist and the real/imaginary pairs) together already, so we don’t want to break those up. There are half as many complex outputs as with a complex FFT (counting DC and Nyquist as one), since we’re dropping the redundant complex conjugates. Turns out, instead of doing the bit reversal for all N N elements, we actually reverse in N 2 \frac{N}{2} pairs instead! So, in our 16-element example, we do the reversal as if it were 8 elements, which means there is only one bit reversal instead of two (since 8 elements has 3-bit indices, so the outer two bits swap and the middle one stays put). The method we use to do the bit reversal is effectively the same as with the complex FFT: the last half of the radix-2 steps each do a middle-out bit reverse. Note And, accordingly, when we get to radix-4, each radix-4 pass reverses a pair of bits, which turns into a 4×4 transpose, exactly the same as with the complex implementatione (except, of course, when one pass needs to only do a single reverse due to an odd number of bit reversals). Conveniently, all of the same patterns we found in the complex-input version still apply! So let’s finish up our diagram by doing the single bit reversal at the end (admittedly not as useful as if there were more bit reversals, but like hell am I making any larger diagrams): The same diagram as before, except now we've added a paired bit reverse step at the end, putting things into an order that is *almost* but not quite sequential. --> 0 8 1 R 1 i 2 R 2 i 3 R 3 i 4 R 4 i 7 R 7 i 6 R 6 i 5 R 5 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 And there we are! Now all of the outputs are in the order we … uh … Wait, why are 7 and 5 not in the right spot? Note This was a real “Well, shit ” moment while I was working on this. This ordering is even in the 1968 paper and I didn’t notice it, because I was so used to seeing the bit-reversed orderings at that point I just assumed . Reversals Within Reversals It turns out, back when we rearranged everything to be more regular and get our final pairs together, this also changed the ordering of the components ! (If you go back and look at the diagrams before and after we did this, you can see 5 R 5_R and 7 R 7_R swap places). Note Also, importantly: the angles used for the rotations through the algorithm are also reversed using this same pattern (but in bit-reversed order ), so that needs to be taken into account! The reversal is just barely noticeable at 16 elements, but as we add more, it gets worse and worse. Here’s a grid showing the index pairs of a 128-element FFT (where “0” would contain DC and nyquist) and how they’re flipped (relative to standard order): 0 1 2 3 4 7 6 5 8 15 14 13 12 9 10 11 16 31 30 29 28 25 26 27 24 17 18 19 20 23 22 21 32 63 62 61 60 57 58 59 56 49 50 51 52 55 54 53 48 33 34 35 36 39 38 37 40 47 46 45 44 41 42 43 What. Even . It turns out that, due to the way we flipped around the imaginary values that we write at each level, there is a corresponding flip of the outputs. Here’s the indices for 32 elements in a big column showing the reversals: A display of 32 indices (representing pairs of elements in a 64-element real FFT), and the sections that are reversed 0 1 2 3 4 7 6 5 8 15 14 13 12 9 10 11 16 31 30 29 28 25 26 27 24 17 18 19 20 23 22 21 The process to undo this, then, is as follows: Every 8 pairs of elements, reverse the order of the last 3 Every 16 pairs of elements, reverse the order of the last 7 Every 32 pairs of elements, reverse the order of the last 15 … Every N pairs of elements, reverse the order of the last N 2 − 1 \frac{N}{2} - 1 Note The pattern here is closely related to Gray code , which is a special ordering of values where only one bit changes as the value increments or decrements (major credit to Matthijs De Smedt who figured out the pattern). The actual code to go from a standard-order index to the “tangled” index above is: size_t TangleIndex ( size_t i ) { auto mask = ( i & ( i - 1 ) ) >> 1 ; mask ^= mask >> 32 ; mask ^= mask >> 16 ; mask ^= mask >> 8 ; mask ^= mask >> 4 ; mask ^= mask >> 2 ; mask ^= mask >> 1 ; return ( i - ( mask & 1 ) ) ^ mask ; } I honestly don’t remember how I derived that anymore, but that middle bit with the xors and shifts is exactly the routine to convert a 32-bit Gray code value back to its standard binary representation. Here’s the one thing that bummed me out coming up with this algorithm: I was unable to find a nice iterative way to handle this (every attempt led to some breakdown of regularity or to giant dependency chains), so this ended up as a post-process step at the end. But, it’s still way less costly than a full bit-reverse pass, as there are nice ways to do this operation in larger chunks, which can be done fairly efficiently in SIMD on both x64 and ARM. The Algorithm! Ultimately, the implementation in FFT-20XX was done in radix-4 instead of the radix-2 we’ve been discussing thus far. I’m not going to go through getting it into radix-4 because, honestly, it’s not the important part, and is just a set of uninteresting, mechanical steps. Like the complex FFT, it does the bit reversal iteratively, 2 bits at a time at the last half of the transform, except we do the above trickery to compute only the half of the outputs that we need in the space that we have. Finally, after all that, it does an “untangle” pass to get from, uh, whatever order that is into standard order. There is a reference implementation checked in here . The main routine is titled RealForwardReference . The Inverse The one downside of real FFTs is that, unlike with the complex FFT, we cannot use the same base routine to invert this process. Instead, like in part 4 , we need to straight-up do the whole process in reverse (ending up with a DIF-like routine): We start by “re-tangling” the inputs such that they’re in the weird order from the end of our forward routine Then do a series of DIF steps that are the inverse of the steps we did to get here, with every step (except the last one) having twice as many real values as the one before, doing the bit-reverse steps in the first half this time (since those were the last-half steps of the forward algorithm). Like the forward algorithm there is a reference implementation for this, called RealInverseReference . SIMD Considerations Again The optimization of this routine was relatively straightforward: using SIMD operations and doing the bit reversals works very similarly to the complex routine, all of the same tricks apply. As with the complex routine, as the FFTs get smaller, there are some special-cases that needed to be done. For AVX’s 8-element vectors, FFTs smaller than 128 are done via SSE2, and FFTs smaller than 32 are done purely in scalar. The untangle was also done by doing the process in blocks, and working as locally as possible to try to stay within CPU cache as much as it can. Additionally, the table ends up being stored differently: The table entries are stored in “tangled” order rather than the standard order (which means the cos/sin values can’t be overlapped like with the complex version). However, it turns out that we need half as many angles in the table (due to the lack of computing the redundant values), so the table ends up being a bit smaller than the complex-input one (it is 2 3 \frac{2}{3} the size). Finally And we’re finally through this gauntlet of bit reversals, other reversals, and diagrams! If you read this far: wow, I honestly didn’t expect anyone to! Hopefully you found this interesting (or at least understandable). And now I’m going to try to stop thinking about FFTs for a while.📝JoshJers' Ramblings
emplace_back() vs push_back() in C++ – Is It REALLY Faster? 🤔 #Shorts🎥CppNuts
Introducing Qt Edge AI: Build AI Into Your Products Once, and Keep it as Hardware ChangesIf you want to add computer vision, such as object detection or face recognition, to an embedded product, you usually have to tie your application to one chip vendor’s AI pipeline. That makes building edge AI features into real-world devices complicated and slow, for a few reasons.📝Qt Blog
std::complex Ate My Performances! Making Faster Hyper complex Maths - Joel Falcou - Meeting C++26🎥MeetingCpp
Don’t be Andy BernardPeople seek prestige but rarely think about what prestige is. Reputation is what enables trust between strangers. Pay on time and deliver the goods, and over time people prefer to trade with you. Reputation is valuable. Young people typically have little of it, so they struggle. Nobody trusts them yet. You acquire reputation over time, … Continue reading Don’t be Andy Bernard📝Daniel Lemire's blog
Why you should put assertions in your declarations #cpp #programming #coding🎥CppCon
What happens when you put a non-agile object in the CoreApplication Properties?The reference expires, but the entry remains. The post What happens when you put a non-agile object in the CoreApplication Properties? appeared first on The Old New Thing .📝The Old New Thing
Smashing the Stack: Modern Mitigations Against a Classic Exploit :: Sivan Zohar-Kotzer🎥CoreCpp
Language Compilation at 30 FPS - A Tale of Performance Optimization in C++ - Adrien Devresse - ACCU🎥ACCUConf
MVVM in C#: What Changes When You Switch UI Frameworks?"If I change UI frameworks, will the C# MVVM backend of my application still work?" This is the most frequent question that we've received from developers since releasing the Qt Bridge for C# . We wanted to provide some detailed information to back the answer to that question, which is: yes, when moving to a Qt Quick / QML UI, your C# MVVM backend will still work in the exact same way. As we will see in the course of this blog post, this is due to two major factors: a) how C# and Qt Quick are brought together by the C# bridge, and b) the intrinsic design principles promoted by MVVM.📝Qt Blog
An interesting article on \Device\AFDI’ve just come across an interesting article that talks, in depth, about \Device\AFD and has lots of links to other useful stuff. More on AFD Adventures with \Device\Afd Test Driven Understanding Test Driven Design A simple client A simple server More \Device\Afd goodness Socket readiness without \Device\Afd A multi-connection AFD-based echo server AFD datagram performance An interesting article on \Device\Afd - this post📝Rambling Comments - Len Holgate's blog
Practical Testing: 47 - First steps with `if contexpr'As I mentioned in the last post I’m looking in to more modern ways to include conditional code in a class. Since I’m exploring here, and since I need some reasonably complicated code to make the exploration a viable test, I’ve decided to work on the “Practical Testing” code. So the next few episodes of Practical Testing will centre on removing preprocessor conditional code and replacing it with code that uses ‘if constexpr’.📝Rambling Comments - Len Holgate's blog
C++ Programming with No AI, LSP, or Debugger: Ep26 -- Image Solved🎥Zed A. Shaw
Make it a five-minute yes to contributeMake it a five-minute yes to contribute Someone hits a small bug in your library and has a one-line fix they would happily send you. They want to help. Then they read your CONTRIBUTING.md : install Clang 18, CMake 3.28, Ninja, Conan 2.0, configure three presets, wait for a build. Twenty minutes later, before they have changed a single character, they give up. Willing contributors are rare, and that one was lost at setup.📝mp-units
:: BIP 9 or how to do Soft ForkFor context about how this article idea came to me, was the recent BIP-110 soft fork activation. During that time window of the proposal a lot of websites created visualization tools in order to help monitor the network for counting the nodes that are signaling the BIP and those that aren’t alongside with making simulation of any case that could happen depending on the network hashrates etc.📝sdmg15