This is an archive of the discontinued LLVM Phabricator instance.

[Matrix] Mark expressions shared between multiple remarks.
ClosedPublic

Authored by fhahn on Jan 10 2020, 10:50 AM.

Details

Summary

This patch adds support for explicitly highlighting sub-expressions
shared by multiple leaf nodes. For example consider the following
code

%shared.load = tail call <8 x double> @llvm.matrix.columnwise.load.v8f64.p0f64(double* %arg1, i32 %stride, i32 2, i32 4), !dbg !10, !noalias !10
%trans = tail call <8 x double> @llvm.matrix.transpose.v8f64(<8 x double> %shared.load, i32 2, i32 4), !dbg !10
tail call void @llvm.matrix.columnwise.store.v8f64.p0f64(<8 x double> %trans, double* %arg3, i32 10, i32 4, i32 2), !dbg !10
%load.2 = tail call <30 x double> @llvm.matrix.columnwise.load.v30f64.p0f64(double* %arg3, i32 %stride, i32 2, i32 15), !dbg !10, !noalias !10
%mult = tail call <60 x double> @llvm.matrix.multiply.v60f64.v8f64.v30f64(<8 x double> %trans, <30 x double> %load.2, i32 4, i32 2, i32 15), !dbg !11
tail call void @llvm.matrix.columnwise.store.v60f64.p0f64(<60 x double> %mult, double* %arg2, i32 10, i32 4, i32 15), !dbg !11

We have two leaf nodes (the 2 stores) and the first store stores %trans
which is also used by the matrix multiply %mult. We generate separate
remarks for each leaf (stores). To denote that parts are shared, the
shared expressions are marked as shared (), with a reference to the
other remark that shares it. The operation summary also denotes the
shared operations separately.

Diff Detail

Event Timeline

fhahn created this revision.Jan 10 2020, 10:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2020, 10:50 AM

Unit tests: pass. 61765 tests passed, 0 failed and 780 were skipped.

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

fhahn updated this revision to Diff 238570.Jan 16 2020, 12:07 PM

rebase, use += OpInfoTy operator.

Unit tests: pass. 61932 tests passed, 0 failed and 783 were skipped.

clang-tidy: unknown.

clang-format: pass.

Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

anemet accepted this revision.Jan 23 2020, 11:55 AM

LGTM.

llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
950

Please comment these two.

1130

Do we even need to run find if ParentShared?

This revision is now accepted and ready to land.Jan 23 2020, 11:55 AM
fhahn marked 2 inline comments as done.Jan 28 2020, 9:25 AM
fhahn added inline comments.
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
1130

Not really. I've moved the find in the if().

This revision was automatically updated to reflect the committed changes.