This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][CodeGen] Account for LMUL for Vector Integer Arithmetic Instructions
ClosedPublic

Authored by michaelmaitland on Oct 25 2022, 6:55 PM.

Details

Summary

It is likley that subtargets act differently for a vector integer arithmetic instruction based on the LMUL.
This patch creates seperate SchedRead, SchedWrite, WriteRes, ReadAdvance for each relevant LMUL. It also
introduces the concept of an "UpperBound LMUL" which allows us to describe how an instruction should behave
when the LMUL is unknown. All base instructions use the UpperBound resources because they are not tied to
a specific LMUL. This gives subtargetes the flexibility to describe their own upper bounds on each vector
instruction.

I have a series of patches for the rest of the vector instruction set ready to go, but I would like to first
get feedback on the first one of the series (this one).

Diff Detail

Event Timeline

michaelmaitland requested review of this revision.Oct 25 2022, 6:55 PM

Commit 1fab0ac559a1eb4e74d193c772264b590ad3c317 renamed ReadVIALUCV->ReadVICALUV to match WriteVICALUV.
Needed to update this patch to reflect that.

Sorry my last update replaced in the wrong direction. This update should do what I meant :)

I needed to bring back some of the classes that I killed. The subroutines that this change
brings back can be killed at the end of this series of patches.

craig.topper added inline comments.Nov 1 2022, 8:02 PM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
2339–2368

I think this needs to be indented 2 spaces

2498–2509

Indent

llvm/lib/Target/RISCV/RISCVScheduleV.td
117–119

Is the empty string needed?

michaelmaitland added inline comments.Nov 1 2022, 9:00 PM
llvm/lib/Target/RISCV/RISCVScheduleV.td
117–119

We do need the double quotes. According to the docs,

The name is parsed in the same special mode used by def. If the name is not included, an unspecified but globally unique name is provided. That is, the following examples end up with different names:
defm    : SomeMultiClass<...>;   // A globally unique name.
defm "" : SomeMultiClass<...>;   // An empty name.

Its no good if we have an empty name because it would generate something like <globally_unique_name>WriteVIALUV_UpperBound when we really want WriteVIALUV_UpperBound

Fix indentation

llvm/lib/Target/RISCV/RISCVScheduleV.td
117–119

Meant to say no good if we have no quotes (i.e. a globally unique name)

michaelmaitland marked 2 inline comments as done.Nov 2 2022, 3:34 PM
This revision is now accepted and ready to land.Nov 2 2022, 9:43 PM