Remove BASE_HLO_ConvOp to remove coupling between MHLO and LMHLO conv ops

PiperOrigin-RevId: 373201247
This commit is contained in:
Jacques Pienaar 2021-05-11 11:53:40 -07:00 committed by TensorFlow MLIR Team
parent a4db6c57aa
commit 2ea9470515
3 changed files with 30 additions and 17 deletions

View File

@ -1383,7 +1383,13 @@ def HLO_CollectivePermuteOp: HLO_Op<"collective_permute",
let results = (outs HLO_Tensor);
}
def HLO_ConvOp : HLO_Op<"convolution", [NoSideEffect]>, BASE_HLO_ConvOp {
def HLO_ConvOp : HLO_Op<"convolution", [NoSideEffect]> {
let summary = "Convolution operator";
let description = [{
Computes a convolution of the kind used in neural networks.
See https://www.tensorflow.org/xla/operation_semantics#conv_convolution.
}];
let arguments = !con(
(ins
HLO_Tensor:$lhs,
@ -1392,6 +1398,14 @@ def HLO_ConvOp : HLO_Op<"convolution", [NoSideEffect]>, BASE_HLO_ConvOp {
let results = (outs HLO_Tensor);
let hasCustomHLOConverter = 1;
code extraClassDeclaration = [{
bool hasWindowReversal() {
auto reversal = window_reversalAttr();
return reversal && llvm::any_of(reversal.getBoolValues(),
[](bool v) { return v; });
}
}];
}
def HLO_CopyOp: HLO_Op<"copy", [NoSideEffect, SameOperandsAndResultType]> {

View File

@ -150,21 +150,6 @@ def ConvolutionAttributes {
}
class BASE_HLO_ConvOp {
string summary = "Convolution operator";
string description = [{
Computes a convolution of the kind used in neural networks.
See https://www.tensorflow.org/xla/operation_semantics#conv_convolution.
}];
code extraClassDeclaration = [{
bool hasWindowReversal() {
auto reversal = window_reversalAttr();
return reversal && llvm::any_of(reversal.getBoolValues(),
[](bool v) { return v; });
}
}];
}
#endif // HLO_OPS_BASE

View File

@ -844,13 +844,27 @@ def LHLO_ConcatenateOp : LHLO_Op<"concatenate", []> {
);
}
def LHLO_ConvOp : LHLO_Op<"convolution", []>, BASE_HLO_ConvOp {
def LHLO_ConvOp : LHLO_Op<"convolution", []> {
let summary = "Convolution operator";
let description = [{
Computes a convolution of the kind used in neural networks.
See https://www.tensorflow.org/xla/operation_semantics#conv_convolution.
}];
let arguments = !con(
(ins
Arg<LHLO_Buffer, "", [MemRead]>:$lhs,
Arg<LHLO_Buffer, "", [MemRead]>:$rhs,
Arg<LHLO_Buffer, "", [MemWrite]>:$output),
ConvolutionAttributes.attributes);
code extraClassDeclaration = [{
bool hasWindowReversal() {
auto reversal = window_reversalAttr();
return reversal && llvm::any_of(reversal.getBoolValues(),
[](bool v) { return v; });
}
}];
}
def LHLO_CopyOp: LHLO_Op<"copy", [CopyOpInterface]> {