Similar to my last post, this writeup covers how I solved a performance regression on LLVM by analyzing a benchmark from a RISCV target. TLDR A recent LLVM patch introduced ordered vector reductions to replace a chain of scalar fadds, but it triggered a performance regression on a benchmark by failing to account for cost of building the initial vector per iteration . This in turned caused…
Similar to the previous post, this post covers my analysis of a benchmark on RISC-V targets. Unlike the previous post, I was able to land a patch to eliminate the performance gap to GCC (for this benchmark)! TLDR A recent LLVM commit improved isKnownExactCastIntToFP to fold fpext(sitofp x to float) to double into a direct uitofp x to double cast, but this inadvertently broke a downstream narrowing…
This was my attempt at improving a benchmark on LLVM RISCV. Unfortunately, the solution to this problem is kind of out of my league. But the attempt does make for a good blog post. Introduction Recently, I found this blog post by Luke Lau, in which he shows how he was able to make improvements to the middle-end (and ultimately the generated code) in LLVM, resulting in better performance for RISC-V…
For a while now I’ve been interested in the RISCV architecture, and recently I had the opportunity to indulge this interest by working on a pass improving code gen on the RISCV backend for LLVM. Credits to @lenary to raising this issue. Relevant PRs: https://github.com/llvm/llvm-project/pull/182416 https://github.com/llvm/llvm-project/pull/183657…
Honestly, it’s actually my second upstreamed PR, but I think it’s worth writing a blog about and the title sounds better then ‘ My Second LLVM PR ’. It’s also a revival of the work done by @huhu233, who implemented the feature of this PR for the ARM backend. I also received a lot of help from the PR reviewer, @RKSimon, to ensure the code is up to LLVM’s…
This blog covers my journey of emulating the NES, a popular console from the 1980s made by Nintendo. Yet Another NES Emulator Why write an emulator for the NES, a project that can be considered well-trodden at this point? For those pursuing low level programming, an emulation project can serve as an excellent appetizer to the field. It gets you familiarized with CPU architecture and the…
This post covers the details of how I made a flight controller for a quadcopter using Rust and an STM32. Introduction This project began as a desire to familiarize myself with embedded development. I wanted to challenge myself by using technology I was not familiar with or had no prior knowledge of. This led me to the idea of making a Rust-based quadcopter. I will walk through the different…