This is an archive of the discontinued LLVM Phabricator instance.

[Driver][VE] Change to enable VPU flag by default
ClosedPublic

Authored by kaz7 on Aug 13 2023, 9:52 AM.

Details

Summary

Change to enable VPU flag for VE by default in order to support vector
intrinsics from clang.

Diff Detail

Event Timeline

kaz7 created this revision.Aug 13 2023, 9:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2023, 9:52 AM
kaz7 requested review of this revision.Aug 13 2023, 9:52 AM
efocht accepted this revision.Aug 14 2023, 4:54 AM

Looks good.
The default should be able to use intrinsics, hiding this only makes things complicated and gets users confused.

This revision is now accepted and ready to land.Aug 14 2023, 4:54 AM
kaz7 added a comment.Aug 14 2023, 6:10 AM

Thanks @efocht . I appreciate if someone working on clang can review this patch too.

I randamly added reviewrs who review code related to feature flags and features group in clang. I appreciate if some of you guys have a time to check this patch too. Thank you so much.

MaskRay added inline comments.Aug 14 2023, 11:30 PM
clang/include/clang/Driver/Options.td
5166

Other feature group options don't set CC1Option: we do not need them as CC1 options (e.g. -Xclang -msse4)

MaskRay requested changes to this revision.Aug 14 2023, 11:30 PM
This revision now requires changes to proceed.Aug 14 2023, 11:30 PM
MaskRay added inline comments.Aug 14 2023, 11:33 PM
clang/include/clang/Driver/Options.td
5169

In general, we just need documentation for the non-default option (let's say -mvevpu). Documentation for the opposite -mno-mvevpu is just boilerplate and not very useful.

clang/test/Driver/ve-features.c
2

-target has been deprecated since Clang 3.4. Use --target=

kaz7 updated this revision to Diff 550588.Aug 15 2023, 8:51 PM

Update to follow suggestions. Thank you.

kaz7 marked 3 inline comments as done.Aug 15 2023, 8:53 PM
kaz7 added inline comments.
clang/include/clang/Driver/Options.td
5166

Thank you. I was wondering which group options are required here.

5169

I see. Changed.

clang/test/Driver/ve-features.c
2

I didn't know that. Thank you!

kaz7 marked 3 inline comments as done.Aug 24 2023, 7:08 AM

ping

kaz7 added a comment.Aug 28 2023, 4:44 AM

Hi @MaskRay , thank you for reviewing this patch last time. Is it possible to review updated this patch again? Thanks!

MaskRay accepted this revision.Aug 28 2023, 10:33 AM
MaskRay added inline comments.
clang/lib/Driver/ToolChains/Arch/VE.cpp
22

Delete the comment. The code speaks itself.

if (Args.hasArg(options::OPT_mvevpu, options::OPT_mno_vevpu, true)
  Features.push_back("+vpu");
clang/test/Driver/ve-features.c
2

I think we typically spend just two RUN lines:

  • one for the default
  • one for -mvevpu -mno-vevpu

The additional coverage for having 3 RUN lines is probably not useful.

This revision is now accepted and ready to land.Aug 28 2023, 10:33 AM

[VE][Clang] Change to enable VPU flag by default

For components like llvm/, clang/, we usually use a more specific tag. I'd pick [Driver] over [Clang].

kaz7 updated this revision to Diff 554528.Aug 29 2023, 4:59 PM

Change to not control backend default bahavior but support VPU flag in
the backend for VE.

kaz7 marked an inline comment as done.Aug 29 2023, 5:03 PM
kaz7 added inline comments.
clang/lib/Driver/ToolChains/Arch/VE.cpp
22

Thanks. I remove comments and simplify existing code.

clang/test/Driver/ve-features.c
2

Thank you for suggesting. I consider what this patch should do and change the purpose to support VPU flag in the backend for VE. As a result, Tests are two RUN lines.

  • one for enable VPU
  • one for disable VPU
kaz7 retitled this revision from [VE][Clang] Change to enable VPU flag by default to [Driver][VE] Support VPU flag as a feature for VE.Aug 29 2023, 5:04 PM
kaz7 edited the summary of this revision. (Show Details)
kaz7 marked 2 inline comments as done.

[VE][Clang] Change to enable VPU flag by default

For components like llvm/, clang/, we usually use a more specific tag. I'd pick [Driver] over [Clang].

I also change it to following.

[Driver][VE] Support VPU flag as a feature for VE

Thank you so much.

MaskRay accepted this revision.Aug 29 2023, 6:01 PM
MaskRay added inline comments.
clang/lib/Driver/ToolChains/Arch/VE.cpp
22

Sorry for my typo. We should use the 3-argument hasFlag here. It's simpler than getLastArg+matches

kaz7 updated this revision to Diff 554742.Aug 30 2023, 8:42 AM

By using hasFlag, change to enable VPU flag for VE by default again.

kaz7 marked an inline comment as done.Aug 30 2023, 8:45 AM
kaz7 added inline comments.
clang/lib/Driver/ToolChains/Arch/VE.cpp
22

I see. I was wondering that part too. Now, I change it to use hasFlag function with default value.

clang/test/Driver/ve-features.c
2

Because we use hasFlag with default value, test is changed again for following two RUN lines.

  • one for the default
  • one for -mvevpu -mno-vevpu
kaz7 retitled this revision from [Driver][VE] Support VPU flag as a feature for VE to [Driver][VE] Change to enable VPU flag by default.Aug 30 2023, 8:45 AM
kaz7 edited the summary of this revision. (Show Details)
kaz7 marked an inline comment as done.Aug 30 2023, 8:48 AM

Thank you for correction. I clean code again.

This revision was automatically updated to reflect the committed changes.