This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Initial support for scalable vectorization
Needs ReviewPublic

Authored by alextsao1999 on Dec 28 2021, 8:16 AM.

Details

Summary

Initial support for scalable vectorization.
This patch add some basic implements of TTI for scalable vectorization.

Diff Detail

Unit TestsFailed

Event Timeline

alextsao1999 created this revision.Dec 28 2021, 8:16 AM
alextsao1999 requested review of this revision.Dec 28 2021, 8:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 28 2021, 8:16 AM
jrtc27 added inline comments.Dec 28 2021, 11:12 AM
llvm/test/Transforms/LoopVectorize/RISCV/scalable-vectorization.ll
3

Use update_test_checks.py, and preferably show the changes to the test case with this patch, not the whole test case, so it's clear what's been improved.

3

Don't use -linux-gnu targets when it's not OS-specific, just use riscv64 (aka riscv64-unknown-elf)

11

Not actually showing the code generated? Debug output is generally not great for testing, it's often unclear what's actually going on, it can only run in builds that have debugging built in and you have to write the CHECK lines by hand.

alextsao1999 edited the summary of this revision. (Show Details)Dec 28 2021, 11:14 AM
craig.topper added inline comments.Dec 29 2021, 1:56 PM
llvm/test/Transforms/LoopVectorize/RISCV/scalable-vectorization.ll
8

This says SVE and the numbers weren't updated to match what is shown on the CHECK lines.

alextsao1999 marked 2 inline comments as done.

update test case

The commit message seems wrong, because this patch is about tuning the cost-model, not about enabling scalable vectorization.

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
166

You may want to add some unit tests to llvm/test/Analysis/CostModel/ for this change.

The commit message seems wrong, because this patch is about tuning the cost-model, not about enabling scalable vectorization.

That's because if you can't get the cost of some cast instructions, you will not force some instructions a specific cost...Maybe a better way is to make the cast instruction legal...

llvm/test/Transforms/LoopVectorize/RISCV/scalable-vectorization.ll
3

thx, I will fix it

8

Thx...I have fixed it

11

The test case is from sve, so I think it's better to be consistent with sve...

jrtc27 added inline comments.Jan 4 2022, 9:48 AM
llvm/test/Transforms/LoopVectorize/RISCV/scalable-vectorization.ll
11

I disagree. Some other targets have some utterly crap tests, we don't need to copy them.

The commit message seems wrong, because this patch is about tuning the cost-model, not about enabling scalable vectorization.

That's because if you can't get the cost of some cast instructions, you will not force some instructions a specific cost...Maybe a better way is to make the cast instruction legal...

I see this as a separate concern, since scalable vectorization is already supported if the loop has no cast instructions.

llvm/test/Transforms/LoopVectorize/RISCV/scalable-vectorization.ll
11

It depends on what you want to test. For SVE we added this test purely to check which VF gets selected, since there are other tests for testing code-gen itself (because the loop itself is trivial for vectorization). That of course doesn't mean you have to follow the same approach for this test, you can do whatever has your preference.