This is an archive of the discontinued LLVM Phabricator instance.

[mlir][mlprogram] Add `mlprogram-pipeline-globals` optimization pass
ClosedPublic

Authored by rsuderman on Aug 30 2023, 2:22 PM.

Details

Summary

Added pass optimizes MLProgram global operations by reducing to only
the minimal load/store operations for global tensors. This avoids
unnecessary global operations throughout a program and potentially
improves operation gusion.

Diff Detail

Event Timeline

rsuderman created this revision.Aug 30 2023, 2:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2023, 2:22 PM
rsuderman requested review of this revision.Aug 30 2023, 2:22 PM
jpienaar added inline comments.Sep 7 2023, 2:22 PM
mlir/include/mlir/Dialect/MLProgram/Transforms/Passes.td
17

Could you expand the description a bit?

mlir/lib/Dialect/MLProgram/IR/MLProgramOps.cpp
186

Why not have this in the for loop construct itself?

mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
54

Could we just check for interrupted ?

112

Elide trivial braces please

186

inside

192

Could we avoid recursion?

mlir/test/Dialect/MLProgram/pipeline-globals.mlir
9

Shouldn't we have a CHECK-NOT too to verify only 1?

Updated for jpienaar@ comments

rsuderman marked 5 inline comments as done.Sep 12 2023, 11:04 AM
rsuderman added inline comments.
mlir/lib/Dialect/MLProgram/IR/MLProgramOps.cpp
186

I just disliked it being on multiple lines. Updated.

mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
54

I decided to not use it because I did not know it existed :). Updated.

192

I do not think so. It is technically possible to process each block to get the list of manipulations then add the block to a worklist, however if there are sub-blocks they would also need to be iterated on. I can rework if we are concerned but it will not simplify.

mlir/test/Dialect/MLProgram/pipeline-globals.mlir
9

Probably a good idea. Added.

rsuderman marked 4 inline comments as done.Sep 12 2023, 11:04 AM
jpienaar accepted this revision.Sep 18 2023, 4:30 PM
This revision is now accepted and ready to land.Sep 18 2023, 4:30 PM