This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Remove initial value for conditions.
ClosedPublic

Authored by hanchung on Mar 17 2020, 6:32 PM.

Details

Summary

Although bool and int1 are the same sometimes, using bool constant matches the
semantic better. In any cases, we don't have to care the type of conditions if
we remove the intial value. The type is determined automatically by the returned
type of logical operations.

Diff Detail

Event Timeline

hanchung created this revision.Mar 17 2020, 6:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2020, 6:32 PM
mravishankar requested changes to this revision.Mar 18 2020, 8:44 AM
mravishankar added inline comments.
mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
190

Maybe avoid having a "initial value" altogether? Just check if conds.size() == 0 to check if a condition already exists in the stack.

This revision now requires changes to proceed.Mar 18 2020, 8:44 AM
mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
190

+1, then the idiomatic MLIR way is to use conds.empty()

hanchung updated this revision to Diff 251157.Mar 18 2020, 1:07 PM

Address comment and update commit message.

hanchung retitled this revision from [mlir][Linalg] Use boolAttr in conditions instead of 1-bit integer. to [mlir][Linalg] Remove initial value for conditions..Mar 18 2020, 1:08 PM
hanchung edited the summary of this revision. (Show Details)
hanchung marked 3 inline comments as done.
hanchung added inline comments.
mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
190

Good point, and we can just rely on the return type of logical operations.

mravishankar accepted this revision.Mar 18 2020, 1:32 PM
This revision is now accepted and ready to land.Mar 18 2020, 1:32 PM
This revision was automatically updated to reflect the committed changes.
hanchung marked an inline comment as done.