Skip to content

[VM] Fix ref ownership in branch remaps - #24781

Open
zhangpan2001 wants to merge 1 commit into
iree-org:mainfrom
zhangpan2001:fix/24753-null-buffer-control-flow
Open

[VM] Fix ref ownership in branch remaps#24781
zhangpan2001 wants to merge 1 commit into
iree-org:mainfrom
zhangpan2001:fix/24753-null-buffer-control-flow

Conversation

@zhangpan2001

Copy link
Copy Markdown
Contributor

Branch remaps selected MOVE using isLastRealValueUse, whose result accounts for uses across all successors. A use on one successor therefore prevented ownership transfer on another mutually exclusive successor, leaving an extra owning reference on the taken path.

Use target-block liveness to select MOVE independently for each successor. If one occurrence of a repeated operand is coalesced with its destination, prevent the other remaps from using MOVE; otherwise a MOVE would clear the coalesced register.

Add register allocation tests for both cases and an LLVM CPU end-to-end regression that executes both selector paths with indirect command buffers disabled.

Fixes #24753

@zhangpan2001
zhangpan2001 requested a review from benvanik as a code owner August 4, 2026 08:13
@AGindinson
AGindinson requested a review from devtbi August 5, 2026 09:16
Branch remaps selected MOVE using `isLastRealValueUse`, whose result accounts
for uses across all successors. A use on one successor therefore prevented
ownership transfer on another mutually exclusive successor, leaving an extra
owning reference on the taken path.

Use target-block liveness to select MOVE independently for each successor. If
one occurrence of a repeated operand is coalesced with its destination,
prevent the other remaps from using MOVE; otherwise a MOVE would clear the
coalesced register.

Add register allocation tests for both cases and an LLVM CPU end-to-end
regression that executes both selector paths with indirect command buffers
disabled.

Fixes iree-org#24753

Co-authored-by: OpenAI <noreply@openai.com>
Signed-off-by: zhangpan <98025960+zhangpan2001@users.noreply.github.com>
@zhangpan2001
zhangpan2001 force-pushed the fix/24753-null-buffer-control-flow branch from cc4d43f to 6878b03 Compare August 7, 2026 02:37
@devtbi

devtbi commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

need to take a closer look, at first glance this seems eerily close to #24841

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hal.command_buffer.dispatch OUT_OF_RANGE on 3.12.0rc but works on 3.11.0

2 participants