[VPTO] Materialize VMOV copies for tied operands - #1351
Open
yexiaosu wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Some A5 vector instructions use two-address semantics: one input must share the destination physical register and is overwritten by the result.
When multiple destructive instructions consume the same tied operand, Bisheng inserts additional VMOV instructions during later lowering. The current PTOAS scheduler works on VPTO IR and cannot see these backend-generated instructions, so its DAG, resource usage, latency, and register-pressure view are incomplete.
This change makes those physical copies explicit in VPTO IR before scheduling. It addresses the issue described in #1327.
Changes
Add an unmasked, full-register
pto.vmovoperation.!pto.vregtypes.Pure, preventing canonicalize, CSE, and DCE from removing or merging physical copies.PIPE_Voperation without ordinary memory access.Add
VPTOTiedOperandOpInterfaceto describe operand/result physical-register constraints.Register tied operands for:
pto.vmula: operand 0pto.vmadd: operand 0pto.vaxpy: operand 1pto.chistv2: operand 0pto.dhistv2: operand 0pto.vusqz: operand 0Add scheduler-independent physical-register view-root helpers for
pto.vbitcastandpto.pbitcast.Add the A5-only
pto-vpto-materialize-tied-operand-copiespass.Ndestructive uses of the same physical root, the final safe material use owns the original register and the other uses receiveN - 1VMOV copies.Add legacy and CANN 9.0.0 LLVM emitter lowering:
llvm.hivm.vmov.v<lanes><type>llvm.hivm.vmov.x.v<lanes><type>Add the design document and update the VPTO micro-ISA documentation.
Scope
The pass is registered for independent use through
pto-test-opt, but is not added to the defaultptoaspipeline in this change.This PR does not modify scheduler selection strategies, DAG owner anti-dependencies, register-pressure tracking, or existing pass ordering. Those changes remain part of the scheduler integration follow-up.
Testing
Added 7 VPTO lit tests covering:
N - 1materializationFocused tests: 7 passed
Full
check-pto: 1850 passed, 1 unsupported, 0 failedCompliance check: 0 errors, 0 warnings