This is an archive of the discontinued LLVM Phabricator instance.

[flang] lower matmul intrinsic to hlfir.matmul operation
ClosedPublic

Authored by tblah on Feb 15 2023, 5:20 AM.

Diff Detail

Event Timeline

tblah created this revision.Feb 15 2023, 5:20 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 15 2023, 5:20 AM
tblah requested review of this revision.Feb 15 2023, 5:20 AM
jeanPerier added inline comments.Feb 16 2023, 1:10 AM
flang/lib/Lower/ConvertCall.cpp
1313–1314

Same as for SUM, I think it is probably best to dereference allocatable/pointers here to save complexity in MATAMUL.

It would be great if we could somehow deduce and do that automatically based on some knowledge about the arguments. I think it is doable for all arguments that are not LowerIntrinsicArgAs::AsInquired and for which handleDynamicOptional is false.
loadTrivialScalar should be callable for all arguments that are LowerIntrinsicArgAs::AsValue and for which handleDynamicOptional is false.

flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
574

I have a feeling that this builder and the SUM builder are not very specific to the intrinsics and that the transformational operation hlfir.expr result type could be computed in lowering regardless of the intrinsic given stmtResultType, and that the default builder could be used.

tblah updated this revision to Diff 497958.EditedFeb 16 2023, 3:49 AM
tblah marked an inline comment as done.

Thanks for reviewing this. Changes are:

  • Share argument dereferencing with hlfir.sum
  • Share result type calculation with hlfir.sum
tblah marked an inline comment as done.Feb 16 2023, 3:50 AM
jeanPerier accepted this revision.Feb 16 2023, 6:23 AM

Looks great, thanks for dealing with all the comments.

This revision is now accepted and ready to land.Feb 16 2023, 6:23 AM
This revision was automatically updated to reflect the committed changes.