This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add two more PowerPC vector intrinsics
ClosedPublic

Authored by DanielCChen on Jul 25 2023, 8:14 AM.

Details

Summary

This patch adds 2 more PowerPC vector intrinsics

vec_cvspbf16
vec_cvbf16spn

These two are for Power10 only. The checking code along with other similar vector or mma intrinsics will be in a separate patch.

Diff Detail

Event Timeline

DanielCChen created this revision.Jul 25 2023, 8:14 AM
DanielCChen requested review of this revision.Jul 25 2023, 8:14 AM

Add the test cases.

Can you prioritise the checking code? The in-tree flang intrinsics may crash on my fictitious PowerPC Apple and your Power 9.

Can you prioritise the checking code? The in-tree flang intrinsics may crash on my fictitious PowerPC Apple and your Power 9.

I see. Since this patch seems small enough, I will include the checking code with this patch.

Add semantic checking for specific supported cpu. In this case, power10.

kkwli0 added inline comments.Jul 25 2023, 2:57 PM
flang/include/flang/Evaluate/target.h
44 ↗(On Diff #544070)

Why are they moved from the original location?

flang/lib/Semantics/check-call.cpp
1429 ↗(On Diff #544070)

This has dependency on https://reviews.llvm.org/D155725. I suggest to add this check in there and also add a test for the MMA intrinsics.

flang/module/__ppc_intrinsics.f90
34

missing elemental

473

Nit: please order it alphebatically

DanielCChen marked 2 inline comments as done.

To address review comments.

flang/include/flang/Evaluate/target.h
44 ↗(On Diff #544070)

It occurs to me that the order of setters and getters are based on the order of the declaration of the member. e.g. isPPC_ is after isBigEndian_. I am not sure if this is something we "need" to maintain though

DanielCChen added inline comments.Jul 26 2023, 6:18 AM
flang/lib/Semantics/check-call.cpp
1429 ↗(On Diff #544070)

Right. I will remove the mma check from this patch and will add it back in with the mma patch.

Remove check for mma intrinsics from this patch. It will be added back in with the MMA intrinsic patch.

DanielCChen marked an inline comment as done.

Fix the build failure due to chang-format checking.

DanielCChen added inline comments.Aug 2 2023, 10:31 AM
flang/lib/Semantics/check-call.cpp
1427 ↗(On Diff #544769)

@tschuett
We had an internal discussion on how to check a specific intrinsic against its supported CPUs. We plan to migrate the current target feature checking code for PowerPC from clang to llvm so that it can be referenced by both clang and flang. This is not a small feature so it will take a while to implement.
As for this CPU checking function in this patch, I think we have 2 options.

  1. we keep it as is until we implement the proper target feature checking in llvm, then we update the code here.
  2. we remove all CPU checking related code from this patch and re-implement it the proper way.

What would be your suggestion?

No worries. Pick your preference.

No worries. Pick your preference.

Thanks! I will remove the code for now then as it is a cleaner approach.

To remove the pwr10 check as we plan to do it as target feature checking as in clang.

Fix the test header to to only dump llvm IR.

This revision is now accepted and ready to land.Aug 3 2023, 5:23 AM

LG

Thanks. I will wait for one more day to see if there are any further comments.

Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 1:11 PM