Integrate LLVM at llvm/llvm-project@d1978fa4bf
Updates LLVM usage to match [d1978fa4bf0d](https://github.com/llvm/llvm-project/commit/d1978fa4bf0d) PiperOrigin-RevId: 355848094 Change-Id: Ie734789487e9e5ec5cabd691949eb5155bd37aef
This commit is contained in:
parent
e84e4b3c84
commit
bf622b7a04
@ -133,7 +133,7 @@ struct LegalizeGatherToTorchIndexSelectPass
|
||||
void runOnFunction() override {
|
||||
OwningRewritePatternList patterns;
|
||||
PopulateGatherToTorchIndexSelectPatterns(&getContext(), &patterns);
|
||||
applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
@ -201,7 +201,7 @@ void PopulateMhloToStdPatterns(OwningRewritePatternList *patterns,
|
||||
void LegalizeToStandardPass::runOnFunction() {
|
||||
OwningRewritePatternList patterns;
|
||||
mlir::mhlo::PopulateMhloToStdPatterns(&patterns, &getContext());
|
||||
applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
}
|
||||
|
||||
} // end namespace mhlo
|
||||
|
@ -259,7 +259,7 @@ struct LegalizeTrigonometricToApproximationPass
|
||||
void runOnFunction() override {
|
||||
OwningRewritePatternList patterns;
|
||||
PopulateTrigonometricToApproximationPatterns(&getContext(), &patterns);
|
||||
applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -164,7 +164,7 @@ class LhloFuseLinalgPass
|
||||
}
|
||||
});
|
||||
auto patterns = linalg::getLinalgTilingCanonicalizationPatterns(ctx);
|
||||
applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
|
||||
// Fuse producers of tiled linalg ops.
|
||||
llvm::SmallDenseSet<Operation*> erase_set;
|
||||
@ -185,7 +185,7 @@ class LhloFuseLinalgPass
|
||||
}
|
||||
|
||||
auto patterns = linalg::getLinalgTilingCanonicalizationPatterns(ctx);
|
||||
applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
}
|
||||
for (auto* e : erase_set) e->erase();
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ struct LhloLegalizeToAffinePass
|
||||
OwningRewritePatternList patterns;
|
||||
auto func = getFunction();
|
||||
populateLHLOToAffineConversionPattern(func.getContext(), &patterns);
|
||||
applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -70,7 +70,7 @@ void LowerComplexPass::runOnFunction() {
|
||||
OwningRewritePatternList patterns;
|
||||
mlir::mhlo::PopulateComplexLoweringPatterns(&getContext(), &patterns);
|
||||
|
||||
applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
}
|
||||
|
||||
std::unique_ptr<FunctionPass> mlir::mhlo::createLowerComplexPass() {
|
||||
|
@ -182,7 +182,7 @@ struct LegalizeGeneralDotPass
|
||||
void runOnFunction() override {
|
||||
OwningRewritePatternList patterns;
|
||||
mlir::mhlo::PopulateGeneralDotOpLoweringPatterns(&patterns, &getContext());
|
||||
applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ void OptimizeMhloPass::runOnFunction() {
|
||||
mlir::OwningRewritePatternList patterns;
|
||||
mlir::mhlo::PopulateOptimizeMHLOPatterns(&getContext(), &patterns);
|
||||
|
||||
applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
}
|
||||
|
||||
std::unique_ptr<mlir::FunctionPass> mlir::mhlo::createOptimizeMhloPass() {
|
||||
|
@ -87,7 +87,7 @@ struct TestInferShapedTypeMethodsPass
|
||||
OwningRewritePatternList patterns;
|
||||
patterns.insert<ReifyReturnTypeShapesPattern>(&getContext());
|
||||
patterns.insert<InferReturnTypeComponentsPattern>(&getContext());
|
||||
applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,7 @@ struct TestUnfuseBatchNormPass
|
||||
void runOnOperation() override {
|
||||
OwningRewritePatternList patterns;
|
||||
PopulateUnfuseBatchNormPatterns(&getContext(), &patterns);
|
||||
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -92,7 +92,7 @@ class KernelSpecs {
|
||||
|
||||
KernelSpecs& WithSignature(const KernelSpecs::Signature& signature,
|
||||
const ScaleFn& fn) {
|
||||
Add(signature, {ScaleConstraintType::CustomScale, fn});
|
||||
(void)Add(signature, {ScaleConstraintType::CustomScale, fn});
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ struct InsertQuantOpsAfterTFFakeQuantOp
|
||||
TypeAttr qtype = quant::GetQuantizedTypeAttr(
|
||||
rewriter, res_type, min_value, max_value, quant_dim, num_bits,
|
||||
narrow_range, /*is_signed=*/true);
|
||||
if (!qtype) failure();
|
||||
if (!qtype) return failure();
|
||||
|
||||
// Finally, use the quantization parameter to create the quantize and
|
||||
// dequantize ops, and insert them between the tf.FakeQuantWithMinMaxVarsOp
|
||||
@ -145,7 +145,7 @@ void LegalizeTFToQuant::runOnFunction() {
|
||||
auto func = getFunction();
|
||||
auto *ctx = func.getContext();
|
||||
patterns.insert<PreparePerTensorFakeQuant, PreparePerChannelFakeQuant>(ctx);
|
||||
applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -331,12 +331,11 @@ struct ConvertTensorListInitOp : public OpConversionPattern<OpT> {
|
||||
if (!(dtype.isF16() || dtype.isF32() || dtype.isF64() ||
|
||||
dtype.isInteger(1) || dtype.isInteger(8) || dtype.isInteger(16) ||
|
||||
dtype.isInteger(32) || dtype.isInteger(64))) {
|
||||
(void)rewriter.notifyMatchFailure(
|
||||
return rewriter.notifyMatchFailure(
|
||||
op,
|
||||
"requires element_dtype to be 1-bit/8-bit/16-bit/32-bit/64-bit "
|
||||
"integer or 16-bit/32-bit/64-bit float type during TF Lite "
|
||||
"transformation pass");
|
||||
return failure();
|
||||
}
|
||||
|
||||
Value element_shape = operands[0];
|
||||
@ -390,11 +389,10 @@ struct ConvertTensorListInitOp : public OpConversionPattern<OpT> {
|
||||
if (element_shape_acquired) break;
|
||||
}
|
||||
if (!element_shape_acquired) {
|
||||
(void)rewriter.notifyMatchFailure(
|
||||
return rewriter.notifyMatchFailure(
|
||||
op,
|
||||
"requires element_shape to be 1D tensor during TF Lite "
|
||||
"transformation pass");
|
||||
return failure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1056,8 +1056,8 @@ struct FusedBatchNormV3Pat : public ::mlir::RewritePattern {
|
||||
/*x=*/tblgen_value_0,
|
||||
/*y=*/tblgen_value_1);
|
||||
// We need to make sure the Add operands are broadcastable.
|
||||
if (mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(add_op_1)
|
||||
.value == LogicalResult::Failure) {
|
||||
if (mlir::failed(mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(
|
||||
add_op_1))) {
|
||||
return failure();
|
||||
}
|
||||
}
|
||||
@ -1077,8 +1077,8 @@ struct FusedBatchNormV3Pat : public ::mlir::RewritePattern {
|
||||
multiplier = rewriter.create<::mlir::TF::MulOp>(odsLoc,
|
||||
/*x=*/tblgen_value_0,
|
||||
/*y=*/tblgen_value_1);
|
||||
if (mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(multiplier)
|
||||
.value == LogicalResult::Failure) {
|
||||
if (mlir::failed(mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(
|
||||
multiplier))) {
|
||||
return failure();
|
||||
}
|
||||
}
|
||||
@ -1090,8 +1090,8 @@ struct FusedBatchNormV3Pat : public ::mlir::RewritePattern {
|
||||
/*x=*/tblgen_value_0,
|
||||
/*y=*/tblgen_value_1);
|
||||
// We need to make sure the Mul operands are broadcastable.
|
||||
if (mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(mul_op_1)
|
||||
.value == LogicalResult::Failure) {
|
||||
if (mlir::failed(mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(
|
||||
mul_op_1))) {
|
||||
return failure();
|
||||
}
|
||||
}
|
||||
@ -1102,8 +1102,8 @@ struct FusedBatchNormV3Pat : public ::mlir::RewritePattern {
|
||||
mul_op_2 = rewriter.create<::mlir::TF::MulOp>(odsLoc,
|
||||
/*x=*/tblgen_value_0,
|
||||
/*y=*/tblgen_value_1);
|
||||
if (mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(mul_op_2)
|
||||
.value == LogicalResult::Failure) {
|
||||
if (mlir::failed(mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(
|
||||
mul_op_2))) {
|
||||
return failure();
|
||||
}
|
||||
}
|
||||
@ -1114,8 +1114,8 @@ struct FusedBatchNormV3Pat : public ::mlir::RewritePattern {
|
||||
sub_op = rewriter.create<::mlir::TF::SubOp>(odsLoc,
|
||||
/*x=*/tblgen_value_0,
|
||||
/*y=*/tblgen_value_1);
|
||||
if (mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(sub_op).value ==
|
||||
LogicalResult::Failure) {
|
||||
if (failed(
|
||||
mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(sub_op))) {
|
||||
return failure();
|
||||
}
|
||||
}
|
||||
@ -1132,8 +1132,8 @@ struct FusedBatchNormV3Pat : public ::mlir::RewritePattern {
|
||||
add_op_2 = rewriter.create<::mlir::TF::AddOp>(
|
||||
odsLoc, tblgen_types, tblgen_values, tblgen_attrs);
|
||||
// We need to make sure the Add operands are broadcastable.
|
||||
if (mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(add_op_2)
|
||||
.value == LogicalResult::Failure) {
|
||||
if (mlir::failed(mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(
|
||||
add_op_2))) {
|
||||
return failure();
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ struct LowerTF : public PassWrapper<LowerTF, FunctionPass> {
|
||||
OwningRewritePatternList patterns;
|
||||
mlir::TF::PopulateLoweringTFPatterns(&getContext(), &patterns);
|
||||
|
||||
applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -744,7 +744,7 @@ TEST(TPURewriteDeviceUtilTest, TestGetHostDeviceFailBadDeviceName) {
|
||||
cluster->setAttr(kDeviceAssignmentAttr, builder.getArrayAttr({}));
|
||||
|
||||
mlir::TF::RuntimeDevices runtime_devices;
|
||||
GetDevicesFromOp(*module_ref, &runtime_devices);
|
||||
(void)GetDevicesFromOp(*module_ref, &runtime_devices);
|
||||
std::string host_device;
|
||||
EXPECT_TRUE(mlir::failed(
|
||||
GetHostDeviceOutsideComputation(runtime_devices, cluster, &host_device)));
|
||||
@ -799,7 +799,7 @@ TEST(TPURewriteDeviceUtilTest, TestGetHostDeviceNotReplicated) {
|
||||
cluster->setAttr(kDeviceAssignmentAttr, builder.getArrayAttr({}));
|
||||
|
||||
mlir::TF::RuntimeDevices runtime_devices;
|
||||
GetDevicesFromOp(*module_ref, &runtime_devices);
|
||||
(void)GetDevicesFromOp(*module_ref, &runtime_devices);
|
||||
std::string host_device;
|
||||
EXPECT_TRUE(mlir::succeeded(
|
||||
GetHostDeviceOutsideComputation(runtime_devices, cluster, &host_device)));
|
||||
|
@ -52,7 +52,7 @@ void Optimize::runOnFunction() {
|
||||
auto func = getFunction();
|
||||
|
||||
populateWithGenerated(ctx, patterns);
|
||||
applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -338,10 +338,10 @@ void ConvertUint8ToInt8::runOnFunction() {
|
||||
|
||||
// Convert uint8 const tensor. const needs to be handled specifically.
|
||||
patterns.insert<ConvertUint8QConstOp>(&ctx);
|
||||
applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
|
||||
// Replace uint8 tensor in the graph and insert rescale as needed.
|
||||
convert_graph_uint8_tensor(ctx, func);
|
||||
(void)convert_graph_uint8_tensor(ctx, func);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -113,7 +113,7 @@ void FuseBiasTF::runOnFunction() {
|
||||
|
||||
// Add the generated patterns to the list.
|
||||
patterns.insert<ConvertTFBiasAddOp>(ctx);
|
||||
applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -2112,7 +2112,7 @@ void LegalizeTF::runOnFunction() {
|
||||
patterns.insert<ConvertTFReverseV2Op>(ctx);
|
||||
patterns.insert<ConvertTFFakeQuantWithMinMaxArgsOp>(ctx);
|
||||
patterns.insert<ConvertTFFakeQuantWithMinMaxVarsOp>(ctx);
|
||||
applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -2962,7 +2962,7 @@ void LegalizeTFL::runOnFunction() {
|
||||
DEF_PATTERN_INSERT(TFLQuantize);
|
||||
DEF_PATTERN_INSERT(TFLDequantize);
|
||||
DEF_PATTERN_INSERT(TFLQConst);
|
||||
applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -56,7 +56,7 @@ std::string CompileHloConvAndGetMlir(absl::string_view hlo_text) {
|
||||
EmitConvolutionForwardAsMlir(conv, "Conv", &context).ValueOrDie();
|
||||
|
||||
mlir_module->push_back(function);
|
||||
mlir_module->verify();
|
||||
(void)mlir_module->verify();
|
||||
|
||||
std::string mlir_text;
|
||||
{
|
||||
|
@ -685,8 +685,8 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
|
||||
)
|
||||
|
||||
# Check out LLVM and MLIR from llvm-project.
|
||||
LLVM_COMMIT = "91e7a17133324ac4beaf6ed45c170436c2d91c98"
|
||||
LLVM_SHA256 = "07ef834c47337dc7b38c765693a3b5a1835aac2f716fd9a06c374a71722c20de"
|
||||
LLVM_COMMIT = "d1978fa4bf0d7da0b3cd88879e9411467edcb01f"
|
||||
LLVM_SHA256 = "7cf83492b954d713f727bbafb00aa93e412281cc6e0cab90a38a3c00ca63cc4a"
|
||||
LLVM_URLS = [
|
||||
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT),
|
||||
"https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT),
|
||||
|
Loading…
x
Reference in New Issue
Block a user