Adding other complexities such as when to spill, and the possibility of reordering computation to reduce the number of registers makes the problem more difficult.
All of which makes me wonder how many of the "NP-hard problems" are in fact easier problems that a covering general case is hard
That's why it's a simpler problem with a polynomial time solution, not a magical bypass for np-completeness.
I knew someone would comment this because hn is always "well akshually...". But the parenthetical is doing all the work in this "nit". Yes coloring chordal graphs is polynomial but real compilers don't do register allocation on SSA form. Spilling and spitting break chordal form.
[0] https://dl.acm.org/doi/acm/10.1145/1772954.1772979 however they do note that splitting breaks SSA form, and fall back to slower algorithms for values which get split.
[1] https://libfirm.github.io/Features.html
[2] https://arxiv.org/abs/2011.05608v1
[3] https://developers.redhat.com/articles/2024/09/24/go-compile...
This is usually because ptxas runs a very simple pass to try to calculate register usage and it has a number of heuristics that it tries to apply to decide whether to keep things in the same registers or to grab new ones. Usually I find that for very high performance code they are not useful and produce very surprising behavior that makes it hard to predict performance :(