hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

vasm-graph-color: split penalty vectors when consensus conflicts

Open igogo-x86 opened this issue 2 weeks ago • 1 comments

color_block_initialize() biases each live-in toward the phys reg that its processed predecessors already use by adding weight to every other phys reg in the shared penalty vector. When multiple live-ins reuse that vector but their predecessors chose different phys regs, those penalties contradict each other. The resulting vector no longer corresponds to any of the prior assignments, so the allocator picks a register based on whatever mix of penalties remains, and we emit edge copies to fix the mismatches (while also pushing the wrong hint backward). Detect conflicting consensus assignments and clone the penalty vector on the spot so each live-in keeps its own bias/undo bookkeeping.

igogo-x86 avatar Dec 05 '25 12:12 igogo-x86

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D88480438. (Because this pull request was imported automatically, there will not be any future comments.)

meta-codesync[bot] avatar Dec 05 '25 12:12 meta-codesync[bot]

Thanks again for the PR!

This one triggers an assertion

Assertion failure: fbcode/hphp/runtime/vm/jit/vasm-graph-color.cpp:11212: void HPHP::jit::(anonymous namespace)::assign_colors(State &): assertion `v[r] == 0' failed.

We also get SIGABRT crashes (e.g Process terminated by the signal: 6)

meteorfox avatar Dec 10 '25 19:12 meteorfox

That assert shows some problems with the patch that are quite difficult to fix. Let's try a different approach - https://github.com/facebook/hhvm/pull/9696

igogo-x86 avatar Dec 17 '25 18:12 igogo-x86