Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

[SVE] Add new VectorType subclasses
ClosedPublic

Authored by ctetreau on Apr 6 2020, 2:24 PM.

Details

Summary

Introduce new types for fixed width and scalable vectors.

Does not remove getNumElements yet so as to not break code during transition
period.

Diff Detail

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
ctetreau updated this revision to Diff 256129.Apr 8 2020, 3:42 PM

Move getMinNumElements to ScalableVectorType. There's no reason for it to be in base VectorType

Looks right, generally.

llvm/include/llvm-c/Core.h
179

The C API is officially not ABI-stable anymore across versions, No reason to have a gap like this.

llvm/lib/ExecutionEngine/ExecutionEngine.cpp
1011 ↗(On Diff #256129)

?

llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
481 ↗(On Diff #256129)

Please fix this to use isa<> while you're here.

ctetreau marked an inline comment as done.Apr 9 2020, 12:23 PM
ctetreau added inline comments.
llvm/lib/ExecutionEngine/ExecutionEngine.cpp
1011 ↗(On Diff #256129)

clang-format-diff must have done this.

Thanks for this patch @ctetreau! Overall looks great to me, just two little nits.

llvm/include/llvm/IR/DerivedTypes.h
434

Do you need the method on line 432 if you have this one (that takes a const VectorType *Other) ?

llvm/lib/ExecutionEngine/ExecutionEngine.cpp
1109 ↗(On Diff #256129)

This code doesn't really work for scalable vectors. Assuming you don't want to change that in this patch, Is it worth putting a FIXME here?

ctetreau marked 2 inline comments as done.Apr 9 2020, 3:47 PM
ctetreau added inline comments.
llvm/include/llvm/IR/DerivedTypes.h
434

It shouldn't be needed, I'll remove it.

llvm/lib/ExecutionEngine/ExecutionEngine.cpp
1109 ↗(On Diff #256129)

This will have to be changed when getNumElements() moves into FixedVectorType. I'll get it then.

Likely, the plan will be to just have the scalable vector branch assert. My overall strategy is to just assume all calls to getNumElements are correct, cast to FixedVectorType instead of VectorType, and just fix enough to make the tests pass.

There's a lot of code that calls getNumElements, and the overall goal is to force everybody to clean their own houses.

ctetreau updated this revision to Diff 256435.Apr 9 2020, 3:50 PM

address code review issues

ctetreau marked an inline comment as done.Apr 14 2020, 9:20 AM
ctetreau added inline comments.
llvm/include/llvm/IR/DerivedTypes.h
430

In this example, "getElementType" should be "getElementCount", but I assume you get the idea...

sdesmalen added inline comments.Apr 14 2020, 2:30 PM
llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
411 ↗(On Diff #257138)

should this be !isa<FixedVectorType>(ArgType) (i.e. negated)?

ctetreau updated this revision to Diff 257542.Apr 14 2020, 3:51 PM

address code review issues

ctetreau marked 2 inline comments as done.Apr 14 2020, 3:57 PM
sdesmalen accepted this revision.Apr 20 2020, 2:15 PM

Thanks for all the changes, this patch LGTM!

This revision is now accepted and ready to land.Apr 20 2020, 2:15 PM
ctetreau updated this revision to Diff 259044.Apr 21 2020, 10:14 AM

Fixup canLosslesslyBitCastTo to use FixedVectorType again

ctetreau updated this revision to Diff 259104.Apr 21 2020, 2:16 PM

remove unused variable

ctetreau updated this revision to Diff 259114.Apr 21 2020, 3:28 PM

Catch stragglers in C api

ctetreau updated this revision to Diff 259126.Apr 21 2020, 4:29 PM

split C api stuff into separate commit. Do bare minimum here

This revision was automatically updated to reflect the committed changes.