From d978408a5fb1155dd89ad0ed6ac4d43ef2493c9f Mon Sep 17 00:00:00 2001 From: Kevin Gleason Date: Wed, 6 Mar 2024 19:31:48 -0600 Subject: [PATCH] Integrate LLVM at llvm/llvm-project@be15a6b3b68b (#2078) --- WORKSPACE.bazel | 4 ++-- build_tools/llvm_version.txt | 2 +- stablehlo/reference/InterpreterOps.cpp | 2 +- stablehlo/transforms/StablehloLegalizeToVhlo.cpp | 9 +++++---- stablehlo/transforms/VhloLegalizeToStablehlo.cpp | 10 ++++++---- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 42511e52503..ac200b3e21d 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -17,9 +17,9 @@ workspace(name = "stablehlo") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -LLVM_COMMIT = "e630a451b457e4d8d071a2b4f102b342bbea2d02" +LLVM_COMMIT = "be15a6b3b68bed7b9d982f25b2e10a273302002a" -LLVM_SHA256 = "184e7622a47609d960295e5e363466e9e60e6d9dbc20d554b3e1118ffd9f1bfb" +LLVM_SHA256 = "1e6cc2eb634438a59fb5e1b87e7bb35883fb680dc2934f431150db22fb3a6c09" http_archive( name = "llvm-raw", diff --git a/build_tools/llvm_version.txt b/build_tools/llvm_version.txt index 0cfaa065f7d..83d0c4aeed5 100644 --- a/build_tools/llvm_version.txt +++ b/build_tools/llvm_version.txt @@ -1 +1 @@ -e630a451b457e4d8d071a2b4f102b342bbea2d02 +be15a6b3b68bed7b9d982f25b2e10a273302002a diff --git a/stablehlo/reference/InterpreterOps.cpp b/stablehlo/reference/InterpreterOps.cpp index b6006b21394..05664e2d6ed 100644 --- a/stablehlo/reference/InterpreterOps.cpp +++ b/stablehlo/reference/InterpreterOps.cpp @@ -160,7 +160,7 @@ LogicalResult RunParallelOp::verify() { SmallVector evalRunParallelOp( ArrayRef inputs, std::queue &infeed, SmallVector> programs, SymbolTable &symbolTable) { - llvm::ThreadPool threadPool; + llvm::DefaultThreadPool threadPool; SmallVector>> futures; uint32_t numReplicas = programs.size(); diff --git a/stablehlo/transforms/StablehloLegalizeToVhlo.cpp b/stablehlo/transforms/StablehloLegalizeToVhlo.cpp index b7669058fab..8644c834093 100644 --- a/stablehlo/transforms/StablehloLegalizeToVhlo.cpp +++ b/stablehlo/transforms/StablehloLegalizeToVhlo.cpp @@ -838,12 +838,12 @@ class StablehloToVhloOpConverter : public OpConversionPattern { // additional argument for the generic builder. StablehloToVhloOp vhloOp; if constexpr (std::is_same::value) { - vhloOp = rewriter.replaceOpWithNewOp( - stablehloOp, vhloTypes, vhloOperands, vhloAttrs, + vhloOp = rewriter.create( + stablehloOp.getLoc(), vhloTypes, vhloOperands, vhloAttrs, stablehloOp.getBranches().size()); } else { - vhloOp = rewriter.replaceOpWithNewOp>( - stablehloOp, vhloTypes, vhloOperands, vhloAttrs); + vhloOp = rewriter.create>( + stablehloOp.getLoc(), vhloTypes, vhloOperands, vhloAttrs); } for (auto [stablehloRegion, vhloRegion] : @@ -855,6 +855,7 @@ class StablehloToVhloOpConverter : public OpConversionPattern { /*entryConversion=*/nullptr))) return failure(); } + rewriter.replaceOp(stablehloOp, vhloOp); return success(); } }; diff --git a/stablehlo/transforms/VhloLegalizeToStablehlo.cpp b/stablehlo/transforms/VhloLegalizeToStablehlo.cpp index ba84adc6548..c4a08c94442 100644 --- a/stablehlo/transforms/VhloLegalizeToStablehlo.cpp +++ b/stablehlo/transforms/VhloLegalizeToStablehlo.cpp @@ -856,12 +856,12 @@ class VhloToStablehloOpConverter : public OpConversionPattern { // additional argument for the generic builder. VhloToStablehloOp stablehloOp; if constexpr (std::is_same::value) { - stablehloOp = rewriter.replaceOpWithNewOp( - vhloOp, stablehloTypes, stablehloOperands, stablehloAttrs, + stablehloOp = rewriter.create( + vhloOp.getLoc(), stablehloTypes, stablehloOperands, stablehloAttrs, vhloOp.getBranches().size()); } else { - stablehloOp = rewriter.replaceOpWithNewOp>( - vhloOp, stablehloTypes, stablehloOperands, stablehloAttrs); + stablehloOp = rewriter.create>( + vhloOp.getLoc(), stablehloTypes, stablehloOperands, stablehloAttrs); } for (auto [vhloRegion, stablehloRegion] : @@ -873,6 +873,8 @@ class VhloToStablehloOpConverter : public OpConversionPattern { /*entryConversion=*/nullptr))) return failure(); } + + rewriter.replaceOp(vhloOp, stablehloOp); return success(); } };