Programming Leftovers
-
Everything New in Home Assistant 2023.3!
Finally, for this release, Python 3.11 is now supported!
Again this won’t mean much to most of you as this only affects Home Assistant core users and hasn’t yet been added to Home Assistant OS or Container yet, but after speaking to the devs, this support for core will firstly allow them to start getting some feedback before making changes to OS and container as Python 3.11 is quite a big change so they want to make sure it’s fully stable first.
-
Maira Canal: Rust for VGEM
In the last blog post, I pointed out that I didn’t know exactly what it would be my next steps for the near future. Gladly, I had the amazing opportunity to start a new Igalia Coding Experience with a new project.
This time Melissa Wen pitched me with the idea to play around with Rust for Linux in order to rewrite the VGEM driver in Rust. The Rust for Linux project is growing fast with new bindings and abstractions being introduced in the downstream RfL kernel. Also, some basic functionalities were introduced in Linux 6.1. Therefore, it seems like a great timing to start exploring Rust in the DRM subsystem!
-
How AI is Eating the Software World
I don’t use the word understand lightly, it’s the most important word in this essay. But what does it actually mean for software to understand something? Here’s how I think about the progression from data to understanding, and this is the definition I’m using to back my claim that large GPT models actually understand.
-
The simplest thing that could possibly work
I'm a programming child of the agile software movement. Just as I was starting out, Kent Beck published Extreme Programming Explained in 2000. It was a revelation. I had just enough exposure to Big Upfront Design and waterfall methodologies to appreciate what a monumental shift this was. Beck's methodology x-rayed the ills of the traditional approach, and made the terminal diagnosis crystal clear.
-
Finding 10x+ Performance Improvements in C++ with CodeQL – Part 2/2 on Combining Dynamic and Static Analysis for Performance Optimisation
In this post we’re going to go deeper, with a static analysis that actually looks at the application’s code. When I started thinking about combinations of analyses for performance optimisation, I didn’t find much in the way of off-the-shelf static analyses that I could just use. So, I decided to build my own. We’re going to try and answer the question: can we use static analysis to find C/C++ code patterns that lead to sub-optimal machine code being emitted by the compiler?
I’ll first describe a particular code pattern that can lead to the compiler emitting unnecessary memory reads, and failing to auto-vectorise loops. When these patterns exist they can lead to functions being 10-20x or more slower than they otherwise could be. I’ll show how we can build CodeQL queries to find the patterns, and how we can modify the code to allow the compiler to auto-vectorise. I’ll then discuss results of applying the queries to a few code bases, lay out some issues that arise, and detail some potential future work and open questions.
-
Mind the Gap When Learning
There are many models for knowledge acquisition: your lamdas, oodas, etc. I like the Shewhart cycle22 Also known under many other names, e.g. the Deming cycle, pdsa, or pdca, depending on who you ask., so that’s the one I’ll talk about here. But it doesn’t matter which one you prefer; most of these models are basically the same thing33 Except for ooda which is weird in a way I don’t understand and nobody has been able to adequaty explain to me. But then again, I have only myself to blame for not yet reading Boyd. Maybe it would be obvious if I did!: a way to operationalise the scientific method.
-
Lucas Fryzek: Journey Through Freedreno
Android running Freedreno
As part of my training at Igalia I’ve been attempting to write a new backend for Freedreno that targets the proprietary “KGSL” kernel mode driver. For those unaware there are two “main” kernel mode drivers on Qualcomm SOCs for the GPU, there is the “MSM”, and “KGSL”. “MSM” is DRM compliant, and Freedreno already able to run on this driver. “KGSL” is the proprietary KMD that Qualcomm’s proprietary userspace driver targets. Now why would you want to run freedreno against KGSL, when MSM exists? Well there are a few ones, first MSM only really works on an up-streamed kernel, so if you have to run a down-streamed kernel you can continue using the version of KGSL that the manufacturer shipped with your device. Second this allows you to run both the proprietary adreno driver and the open source freedreno driver on the same device just by swapping libraries, which can be very nice for quickly testing something against both drivers.
When “DRM” isn’t just “DRM”
When working on a new backend, one of the critical things to do is to make use of as much “common code” as possible. This has a number of benefits, least of all reducing the amount of code you have to write. It also allows reduces the number of bugs that will likely exist as you are relying on well tested code, and it ensures that the backend is mostly likely going to continue to work with new driver updates.
When I started the work for a new backend I looked inside mesa’s
src/freedreno/drm
folder. This has the current backend code for Freedreno, and its already modularized to support multiple backends. It currently has support for the above mentioned MSM kernel mode driver as well as virtio (a backend that allows Freedreno to be used from within in a virtualized environment). From the name of this path, you would think that the code in this module would only work with kernel mode drivers that implement DRM, but actually there is only a handful of places in this module where DRM support is assumed. This made it a good starting point to introduce the KGSL backend and piggy back off the common code.For example the
drm
module has a lot of code to deal with the management of synchronization primitives, buffer objects, and command submit lists. All managed at a abstraction above “DRM” and to re-implement this code would be a bad idea.How to get Android to behave