This is an archive of the discontinued LLVM Phabricator instance.

[InferAddressSpaces] Handle vector of pointers type & Support intrinsic masked gather/scatter
ClosedPublic

Authored by CaprYang on May 6 2023, 9:43 AM.

Details

Diff Detail

Event Timeline

CaprYang created this revision.May 6 2023, 9:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2023, 9:43 AM
CaprYang requested review of this revision.May 6 2023, 9:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2023, 9:43 AM
arsenm requested changes to this revision.May 7 2023, 2:49 PM
arsenm added inline comments.
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
259–265

This is reinventing Type::getPointerAddressSpace

268–271

isPtrOrPtrVectorTy

285

Don't need to bother trying to maintain pointer element types anymore

289

Ditto, only opaque pointers matter now

llvm/test/Transforms/InferAddressSpaces/AMDGPU/icmp.ll
151

You touched a lot more than just icmp, so this needs more tests to cover all the newly handled cases

This revision now requires changes to proceed.May 7 2023, 2:49 PM
CaprYang updated this revision to Diff 520294.May 8 2023, 1:01 AM

[InferAddressSpaces] Support intrinsic masked gather & masked scatter

Herald added a reviewer: ldionne. · View Herald Transcript
Herald added a reviewer: rafauler. · View Herald Transcript
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a reviewer: NoQ. · View Herald Transcript
Herald added a reviewer: njames93. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
CaprYang updated this revision to Diff 520296.May 8 2023, 1:11 AM
CaprYang removed reviewers: bollu, ldionne, nicolasvasilache, rafauler, Amir, maksfb, NoQ, njames93, Restricted Project, Restricted Project, Restricted Project, rymiel, HazardyKnusperkeks, owenpan, MyDeveloperDay.
CaprYang removed projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project.
CaprYang updated this revision to Diff 520302.May 8 2023, 1:45 AM
CaprYang retitled this revision from [InferAddressSpaces] Handle vector of pointers type to [InferAddressSpaces] Handle vector of pointers type & Support intrinsic masked gather/scatter.
PiotrZSL removed a subscriber: PiotrZSL.May 8 2023, 2:11 AM
CaprYang updated this revision to Diff 520308.May 8 2023, 2:36 AM
CaprYang added inline comments.May 8 2023, 7:20 PM
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
259–265

Yes.. it seems like I am doing some useless work.

268–271

Oh thanks! I just learned that there are these APIs, let me replace them.

285

Sorry.. I don't know what to do, can you tell me?

llvm/test/Transforms/InferAddressSpaces/AMDGPU/icmp.ll
151

I will add more tests later

CaprYang updated this revision to Diff 520660.May 9 2023, 5:05 AM
CaprYang added inline comments.May 9 2023, 5:29 AM
llvm/test/Transforms/InferAddressSpaces/AMDGPU/icmp.ll
151

added

arsenm added inline comments.May 9 2023, 5:42 AM
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
289

You don't need to bother using getWithSamePointeeType. You can use Type::getWithNewType

llvm/test/Transforms/InferAddressSpaces/masked-gather-scatter.ll
4

Generate full checks

llvm/test/Transforms/InferAddressSpaces/vector-of-pointers.ll
3

Generate full checks

CaprYang added inline comments.May 9 2023, 6:23 AM
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
289

Does it mean this? do't check non-opaque types.

static Type *getPtrOrVecOfPtrsWithNewAS(Type *Ty, unsigned NewAddrSpace) {
  assert(Ty->isPtrOrPtrVectorTy());
  PointerType *NPT = PointerType::get(Ty->getContext(), NewAddrSpace);
  return Ty->getWithNewType(NPT);
}
CaprYang updated this revision to Diff 520692.May 9 2023, 7:12 AM
CaprYang added inline comments.
llvm/test/Transforms/InferAddressSpaces/masked-gather-scatter.ll
4

updated

CaprYang added inline comments.May 15 2023, 11:46 PM
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
289

@arsenm Excuse me... can you help me review again?

arsenm accepted this revision.May 16 2023, 10:01 AM

LGTM

This revision is now accepted and ready to land.May 16 2023, 10:01 AM
arsenm added inline comments.May 16 2023, 10:02 AM
llvm/test/Transforms/InferAddressSpaces/masked-gather-scatter.ll
4

These aren't generated checks? I meant use update_test_checks

CaprYang updated this revision to Diff 523087.May 17 2023, 9:53 AM
CaprYang added inline comments.May 17 2023, 10:00 AM
llvm/test/Transforms/InferAddressSpaces/masked-gather-scatter.ll
4

Yeah.. but I've already rewritten with update_test_checks.py. I didn't know about its existence before, thx!

CaprYang added inline comments.May 17 2023, 10:58 AM
llvm/test/Transforms/InferAddressSpaces/masked-gather-scatter.ll
4

Could you please commit this for me if there are no issues? I don't have permissions to do. thx!
author: CaprYang <capryang@gmail.com>