Notes from my first weeks reading and building Mesa. Mostly for myself, but maybe useful if you're in the same position.
AMD-specific code lives under src/amd/. RADV is in
src/amd/vulkan/, ACO in src/amd/compiler/.
NIR (Mesa's shared compiler IR) is in src/compiler/nir/.
Everything else can wait.
meson setup build -Dvulkan-drivers=amd -Dgallium-drivers= -Dbuildtype=debug ninja -C build
Skip Gallium if you're only working on RADV/ACO. Debug builds are slower but you get assertions, which catch bugs early.
To use your build without installing system-wide:
export VK_ICD_FILENAMES=/path/to/build/src/amd/vulkan/radeon_icd.x86_64.json export LD_LIBRARY_PATH=/path/to/build/src/amd/vulkan:$LD_LIBRARY_PATH
I traced vkCreateGraphicsPipelines end to end.
radv_pipeline.c → radv_shader.c → aco_interface.cpp →
instruction selection, register allocation, scheduling → binary embedded in the pipeline object.
Following one call path teaches you more than reading docs.
RADV_DEBUG=shaders — dumps shader assemblyRADV_DEBUG=checkir — validates NIR after each passACO_DEBUG=validateir — validates ACO IRNIR_PRINT=1 — prints NIR before compilationWhen something breaks, diff the shader dumps before and after your change. Usually tells you exactly what happened.
My first kernel patch removed unused code that generated warnings. Trivial, but it taught me the patch submission workflow and how maintainer review works.
For Mesa: make changes, meson test, format commit message (match existing style),
push to GitLab, open MR, wait for CI and review. Maintainers will ask for changes.
IRC on OFTC. #dri-devel for general Mesa, #radeon for AMD.
ACO internals — instruction selection, register allocator, instruction scheduler. Textbook register allocation is graph coloring. ACO deals with VGPR vs SGPR, wave32/wave64, latency hiding through occupancy, spilling to scratch memory. The hardware constraints make it more interesting than the theory.