This is an archive of the discontinued LLVM Phabricator instance.

CodeGen: Add TIED_COPY instruction
AbandonedPublic

Authored by arsenm on Feb 3 2020, 5:13 AM.

Details

Summary

I need a way to be able to constrain a register def to use the same
input register throughout a loop. For a VGPR, we don't model the other
live values in other lanes. In cases where we are explicitly
scalarizing operations and writing different lanes sequentially, we
need to model this as an input tied operand to the def instruction
inside the loop. The verifier doesn't allow adding a tied implicit use
to an explicit def, so move this constraint into a copy we can use to
accumulate the real result. This should be folded out after allocation
like a normal copy when possible.

Diff Detail

Event Timeline

arsenm created this revision.Feb 3 2020, 5:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2020, 5:13 AM
nhaehnle added a comment.EditedFeb 5 2020, 7:23 AM

Do you have a use case for this, or can you explain a bit more what this solves, perhaps with an example?

Normal waterfall loops ought to be solved in the same way as any other loop with divergent exit: a value written inside the loop is observed from outside the loop, so there should be a COPY to a vgpr / vector register bank if necessary, but then the regular register allocation etc. does the rest. We don't need a TIED_COPY there today, or rather, I don't think we should need one.

Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 7:02 PM
Herald added a subscriber: foad. · View Herald Transcript