Spent about a month on this in my spare time. Wrote the patch, wrote the test, ran shader-db — nothing triggered. Here's what happened.
I was looking for some places to patch and I noticed some TODO comments left in aco_optimizer.cpp. So I thought I could pick one of them and try to implement it.
Before GFX11 there was no pack_hl instruction in the ISA. The idea was: if any of the operands are constant, we can shift it and transform the _hl instruction to _ll or _hh depending on the constant's position. That way you can use an instruction that actually exists on older hardware.
The implementation part was not that hard. I referenced the existing implementations and adapted it to my needs, basically just read and copied a few lines from above. After I felt okay about it I wrote a test that triggers that instruction, it was passing and seemed fine to me.
Then I ran shader-db and none of the shaders triggered my optimization. Not a single one. I re-ran it, checked the conditions again, tried a few more things, but nothing changed.
After some days I reached out to Rhys Perry and Timur Kristoff in a Discord channel and proposed the change to them. Timur basically said ACO tries to handle everything at once, so this pattern was probably already eliminated somewhere earlier in the pipeline — maybe NIR already simplified it before ACO even gets to see the IR.
That made sense to me, I just didn't think about it at the time. So I dropped it, no MR opened.
This was the first real thing I worked on in ACO. Didn't go anywhere but still, it was a good way to get into the codebase and I think it was worth writing down.