This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Remove side effects from vsetvli intrinsics.
ClosedPublic

Authored by craig.topper on Feb 2 2023, 3:19 PM.

Details

Summary

Delete the opt intrinsics since they are now identical.

I left the side effects due to user expectations about how these
interact with things like inline assembly or function calls. Or
that they wouldn't be hoisted. I think we should look at other
ways to address thoughs.

If I could, I'd rename them these somehow to distance them from
the vsetvli instruction. In some sense they only query the VL for
a particular SEW and LMUL. They don't guarantee a vsetvli
instruction will be emitted.

Fixes https://github.com/llvm/llvm-project/issues/59359

Diff Detail

Event Timeline

craig.topper created this revision.Feb 2 2023, 3:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 3:19 PM
craig.topper requested review of this revision.Feb 2 2023, 3:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 3:19 PM
craig.topper edited the summary of this revision. (Show Details)Feb 2 2023, 6:36 PM
kito-cheng accepted this revision.Feb 2 2023, 6:49 PM

LGTM, I like this change, GCC also implement this way too, and it's more close to our RVV intrinsic programming model - abstract VL and VTYPE status from the front-end and middle-end.

This revision is now accepted and ready to land.Feb 2 2023, 6:49 PM
rogfer01 accepted this revision.Feb 2 2023, 10:51 PM

Thanks @craig.topper.

I believe that "unfettered" reads (and other uncontrolled changes) to the vl / vtype should not prevent us from creating an efficient intrinsics-based programming model for RVV and this change aligns with this view.

reames added a comment.Feb 3 2023, 7:50 AM

No objection here. I don't have a strong opinion on how this should work through the C intrinsic interface.

If we do land this, we should revisit the implementation of the InsertVSETVLI pass. We are deliberately very conservative there around user VSETVLIs, and this patch would remove that restriction. This would seem to unblock some optimizations, and we can probably simplify the implementation a bit too.

This revision was landed with ongoing or failed builds.Feb 3 2023, 1:04 PM
This revision was automatically updated to reflect the committed changes.

Bit late to the party, but thanks for doing this