This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Tensor] Add a helper build method for pad operations with constant padding.
ClosedPublic

Authored by mravishankar on Oct 21 2022, 1:33 PM.

Diff Detail

Event Timeline

mravishankar created this revision.Oct 21 2022, 1:33 PM
mravishankar requested review of this revision.Oct 21 2022, 1:33 PM

I think we already have a similar method in tensor/Utils.h. Does it fit your needs?

// Return a PadOp that pads `source to `type` size with `pad` value.
// I.e., a block will be created and the `pad` value will be yielded
// directly. If the type passed is nullptr, it is inferred.
PadOp createPadScalarOp(Type type, Value source, Value pad,
                        ArrayRef<OpFoldResult> low, ArrayRef<OpFoldResult> high,
                        bool nofold, Location loc, OpBuilder &builder);

I think we already have a similar method in tensor/Utils.h. Does it fit your needs?

// Return a PadOp that pads `source to `type` size with `pad` value.
// I.e., a block will be created and the `pad` value will be yielded
// directly. If the type passed is nullptr, it is inferred.
PadOp createPadScalarOp(Type type, Value source, Value pad,
                        ArrayRef<OpFoldResult> low, ArrayRef<OpFoldResult> high,
                        bool nofold, Location loc, OpBuilder &builder);

Maybe we should just drop that method....

Drop duplicate method in Tensor/Utils.h.

hanchung accepted this revision.Oct 24 2022, 10:57 AM
This revision is now accepted and ready to land.Oct 24 2022, 10:57 AM
This revision was landed with ongoing or failed builds.Oct 24 2022, 11:12 AM
This revision was automatically updated to reflect the committed changes.