How Mesa compiles shaders from SPIR-V bytecode to ACO assembly—parsing SPIR-V, converting to NIR, NIR optimization passes, lowering to ACO IR, and final code generation. Understanding the full pipeline to build a standalone compiler.
I'm a developer who works on low-level graphics and systems code. I currently contribute to the Linux open source graphics stack.
I care about performance, hardware understanding, and code that actually does something useful. Not interested in enterprise abstractions or "best practices" that ignore how hardware works. If something can be faster, it should be faster.
These days I enjoy working on GPU compilers and graphics drivers, which is much more interesting than most of the corporate software I've seen. Previously worked on embedded systems at Baykar on the T3 Gemstone project (Turkey's first open-source SBC)—doing low-level board bring-up, porting RTOSes, the kind of work where you read datasheets and count instruction cycles.
I'm currently contributing to these parts of the Mesa project:
Also studying the Linux kernel DRM subsystem and contributing patches when I can.
Here are some of the more interesting things I've worked on over the past few years.
I'm documenting my journey learning Mesa internals to build a standalone ACO compiler tool. Each post covers a piece of the puzzle I need to understand to make it work.
How Mesa compiles shaders from SPIR-V bytecode to ACO assembly—parsing SPIR-V, converting to NIR, NIR optimization passes, lowering to ACO IR, and final code generation. Understanding the full pipeline to build a standalone compiler.
NIR as the common intermediate representation in Mesa—why it exists, what optimizations happen at NIR level, how different drivers share code through NIR, and why you can't skip it when compiling shaders.
Understanding the RADV-ACO interface—what structures RADV fills, shader info, pipeline configuration, hardware capabilities. What I need to replicate in a standalone tool without RADV's context.
From compiled shader to GPU execution—pipeline objects, shader upload, command buffer encoding, DRM ioctl interface, and what actually happens when you call vkCreateGraphicsPipelines.
Understanding ACO's IR—instruction formats, basic blocks, SSA form, register allocation constraints, and how to read ACO assembly dumps. Essential for debugging compiler output.
What ACO needs to know about RDNA hardware—wavefronts, VGPR/SGPR architecture, instruction latencies, execution masks, and hardware constraints that affect code generation.
Putting it all together—decoupling ACO from RADV dependencies, implementing the CLI interface, handling hardware configuration, and making a usable standalone shader compiler.
What I've learned while getting started with Mesa contribution—understanding the codebase, debugging tools, and making your first patches.
Overview of how the Linux graphics stack works, what Mesa does, and why keeping your drivers up to date matters for performance.
An overview of graphics driver architecture—firmware, kernel drivers, userspace drivers, shader compilers, and how they fit together.