This is an archive of the discontinued LLVM Phabricator instance.

[clang][OpenMP] Fix getNDSWDS for aarch64.
ClosedPublic

Authored by fpetrogalli on Apr 27 2020, 3:28 PM.

Details

Summary

This change fixes an aarch64-specific bug in the generation of the NDS and WDS values used to compute the signature of the vector functions out of OpenMP directives like declare simd. When the directive is used in conjunction with the linear clause, the size of the pointee must be used instead of the size of the pointer to compute NDS and WDS.

The code-fix is strictly related to the behavior for linear, but given that the only way we have to test the NDS and WDS values is to check the resulting <vlen> token in the mangled name of the vector function, the tests have been extended to cover all the possible values of WDS and NDS as defined in the ABI at https://github.com/ARM-software/abi-aa/tree/master/vfabia64.

Diff Detail

Event Timeline

fpetrogalli created this revision.Apr 27 2020, 3:28 PM

Hello reviewers,

I know this is not how the fix should be tested (fprintf in debug builds...).

This function would benefit of some unitests in the unittests folder of clang, but I don't have a way to export it there as it is private to this module.

I would like to lift it to some class (as a static function of CodeGenFunction, for example), but that would require exposing the ParamAttrTy. Are you OK with that? I'd rather use the llvm::VFParameter of llvm/Analisys/VectorUtils.h as I suggested in http://lists.llvm.org/pipermail/llvm-dev/2020-April/141057.html, but that would definitely require a first patch work to remove the uses of ParamAttrTy in favor of llvm::VFParameter.

I am open to alternative suggestions, of course!

Kind regards,

Francesco

Is the NDS and WDS number never visible in the IR, e.g., as part of the name?

Is the NDS and WDS number never visible in the IR, e.g., as part of the name?

Hang on, thanks for asking the question, maybe I can work something out here! :)

They won't be visible in IR directly, but they are part of an expression that is used to compute the number of lanes in the mangled name.

I'll come up with an IR check.

Thanks!

Francesco

I have added (indirect) testing of the values of NDS and WDS.

Removed single use variable definition.

fpetrogalli edited the summary of this revision. (Show Details)May 1 2020, 8:45 PM
fpetrogalli added a reviewer: andwar.
Harbormaster completed remote builds in B55528: Diff 261610.
jdoerfert accepted this revision.May 3 2020, 9:10 AM

LGTM.

This revision is now accepted and ready to land.May 3 2020, 9:10 AM
This revision was automatically updated to reflect the committed changes.