From de535ff27312201279c5bf730c3d24113c14562b Mon Sep 17 00:00:00 2001 From: Quinn Dawkins Date: Tue, 2 Jul 2024 16:37:53 -0400 Subject: [PATCH 1/3] Integrate llvm-project @59f4267c8e0625c6583327be2db1608930f2d796 --- .../plugins/target/LLVMCPU/LLVMTargetOptions.cpp | 1 + compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp | 12 ++++++------ compiler/src/iree/compiler/PluginAPI/Client.h | 8 ++++---- compiler/src/iree/compiler/PluginAPI/PluginManager.h | 5 +++-- compiler/src/iree/compiler/Utils/OptionUtils.h | 2 +- third_party/llvm-project | 2 +- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/compiler/plugins/target/LLVMCPU/LLVMTargetOptions.cpp b/compiler/plugins/target/LLVMCPU/LLVMTargetOptions.cpp index 8fe6469b790d4..b8c2513bf2aee 100644 --- a/compiler/plugins/target/LLVMCPU/LLVMTargetOptions.cpp +++ b/compiler/plugins/target/LLVMCPU/LLVMTargetOptions.cpp @@ -11,6 +11,7 @@ #include "llvm/ADT/APFloat.h" #include "llvm/ADT/StringRef.h" #include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/IR/Module.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" diff --git a/compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp b/compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp index 5df65ce85b43b..2937fefc354ef 100644 --- a/compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp +++ b/compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp @@ -21,8 +21,8 @@ namespace mlir::iree_compiler::IREE::HAL { /// Returns the command to compile the given MSL source file into Metal library. static std::string getMetalCompileCommand(MetalTargetPlatform platform, - StringRef mslFile, - StringRef libFile) { + llvm::StringRef mslFile, + llvm::StringRef libFile) { const char *sdk = ""; switch (platform) { case MetalTargetPlatform::macOS: @@ -51,7 +51,7 @@ static std::string getMetalCompileCommand(MetalTargetPlatform platform, } /// Returns the given command via system shell. -static LogicalResult runSystemCommand(StringRef command) { +static LogicalResult runSystemCommand(llvm::StringRef command) { LLVM_DEBUG(llvm::dbgs() << "Running system command: '" << command << "'\n"); int exitCode = system(command.data()); if (exitCode == 0) @@ -62,9 +62,9 @@ static LogicalResult runSystemCommand(StringRef command) { } std::unique_ptr -compileMSLToMetalLib(MetalTargetPlatform targetPlatform, StringRef mslCode, - StringRef entryPoint) { - SmallString<32> mslFile, airFile, libFile; +compileMSLToMetalLib(MetalTargetPlatform targetPlatform, + llvm::StringRef mslCode, llvm::StringRef entryPoint) { + llvm::SmallString<32> mslFile, airFile, libFile; int mslFd = 0; llvm::sys::fs::createTemporaryFile(entryPoint, "metal", mslFd, mslFile); llvm::sys::fs::createTemporaryFile(entryPoint, "metallib", libFile); diff --git a/compiler/src/iree/compiler/PluginAPI/Client.h b/compiler/src/iree/compiler/PluginAPI/Client.h index 0272e2538012f..f9e44b83d9a8e 100644 --- a/compiler/src/iree/compiler/PluginAPI/Client.h +++ b/compiler/src/iree/compiler/PluginAPI/Client.h @@ -61,14 +61,14 @@ class PipelineExtensions { // Adds input type mnemonics that this instance supports. At least one plugin // must advertise support for a custom input type in order for it to be // considered valid. - virtual void populateCustomInputConversionTypes(StringSet<> &typeMnemonics) {} + virtual void + populateCustomInputConversionTypes(llvm::StringSet<> &typeMnemonics) {} // Adds input type mnemonics that this instance supports, if those types are // detected in |module|. // Requires that |registerDialects| has been called first. - virtual void - populateDetectedCustomInputConversionTypes(ModuleOp &module, - StringSet<> &typeMnemonics) {} + virtual void populateDetectedCustomInputConversionTypes( + ModuleOp &module, llvm::StringSet<> &typeMnemonics) {} // Adds passes to the input preprocessing pipeline for the given // InputDialectOptions::Type::plugin type with the given mnemonic. diff --git a/compiler/src/iree/compiler/PluginAPI/PluginManager.h b/compiler/src/iree/compiler/PluginAPI/PluginManager.h index 7f820dc547397..ef194993d25d9 100644 --- a/compiler/src/iree/compiler/PluginAPI/PluginManager.h +++ b/compiler/src/iree/compiler/PluginAPI/PluginManager.h @@ -102,14 +102,15 @@ class PluginManagerSession : public PipelineExtensions { } } - void populateCustomInputConversionTypes(StringSet<> &typeMnemonics) override { + void populateCustomInputConversionTypes( + llvm::StringSet<> &typeMnemonics) override { for (auto *s : initializedSessions) { s->populateCustomInputConversionTypes(typeMnemonics); } } void populateDetectedCustomInputConversionTypes( - ModuleOp &module, StringSet<> &typeMnemonics) override { + ModuleOp &module, llvm::StringSet<> &typeMnemonics) override { for (auto *s : initializedSessions) { s->populateDetectedCustomInputConversionTypes(module, typeMnemonics); } diff --git a/compiler/src/iree/compiler/Utils/OptionUtils.h b/compiler/src/iree/compiler/Utils/OptionUtils.h index c2b5812187380..d972281824102 100644 --- a/compiler/src/iree/compiler/Utils/OptionUtils.h +++ b/compiler/src/iree/compiler/Utils/OptionUtils.h @@ -129,7 +129,7 @@ class OptionsBinder { -> decltype(static_cast(parser), static_cast(*value), LocalOptionInfo::PrintCallback()) { return [optionName, &parser, value](llvm::raw_ostream &os) { - StringRef valueName(""); + llvm::StringRef valueName(""); for (unsigned i = 0; i < parser.getNumOptions(); ++i) { V cmpValue = static_cast &>( parser.getOptionValue(i)) diff --git a/third_party/llvm-project b/third_party/llvm-project index 8ded6ce55deaf..e5c3964800143 160000 --- a/third_party/llvm-project +++ b/third_party/llvm-project @@ -1 +1 @@ -Subproject commit 8ded6ce55deafcad4b78ec814f1ecc80f9889392 +Subproject commit e5c3964800143f4e38293affef1e9c627e555b7c From a6c3de9c88399684d17180a86d9f9acf93b83181 Mon Sep 17 00:00:00 2001 From: Quinn Dawkins Date: Wed, 3 Jul 2024 10:06:02 -0400 Subject: [PATCH 2/3] Integrate llvm-project @31015240d366e4bf6f114856caa6e9ce90742b7f --- third_party/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/llvm-project b/third_party/llvm-project index e5c3964800143..4334375d5666c 160000 --- a/third_party/llvm-project +++ b/third_party/llvm-project @@ -1 +1 @@ -Subproject commit e5c3964800143f4e38293affef1e9c627e555b7c +Subproject commit 4334375d5666c628610fc500aaab2059fd3892ba From 1654fa55d8b3386d12e1570450949174e1103750 Mon Sep 17 00:00:00 2001 From: Quinn Dawkins Date: Wed, 3 Jul 2024 11:45:09 -0400 Subject: [PATCH 3/3] fix bazel and update clip size --- .github/workflows/pkgci_regression_test.yml | 2 +- compiler/plugins/target/LLVMCPU/BUILD.bazel | 1 + compiler/plugins/target/LLVMCPU/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pkgci_regression_test.yml b/.github/workflows/pkgci_regression_test.yml index c49da34aedf13..99ee321502e0d 100644 --- a/.github/workflows/pkgci_regression_test.yml +++ b/.github/workflows/pkgci_regression_test.yml @@ -306,7 +306,7 @@ jobs: --goldendispatch-rocm-clip 1569 \ --goldendispatch-rocm-vae 248 \ --goldensize-rocm-unet-bytes 2062938 \ - --goldensize-rocm-clip-bytes 780200 \ + --goldensize-rocm-clip-bytes 780328 \ --goldensize-rocm-vae-bytes 757933 \ --gpu-number 6 \ --rocm-chip gfx90a \ diff --git a/compiler/plugins/target/LLVMCPU/BUILD.bazel b/compiler/plugins/target/LLVMCPU/BUILD.bazel index 71abc152c6abc..0e765fc6a4175 100644 --- a/compiler/plugins/target/LLVMCPU/BUILD.bazel +++ b/compiler/plugins/target/LLVMCPU/BUILD.bazel @@ -111,6 +111,7 @@ iree_compiler_cc_library( deps = [ "//compiler/src/iree/compiler/Utils", "@llvm-project//llvm:Analysis", + "@llvm-project//llvm:Core", "@llvm-project//llvm:MC", "@llvm-project//llvm:Passes", "@llvm-project//llvm:Support", diff --git a/compiler/plugins/target/LLVMCPU/CMakeLists.txt b/compiler/plugins/target/LLVMCPU/CMakeLists.txt index 2abea28dad36c..5d372d01d3550 100644 --- a/compiler/plugins/target/LLVMCPU/CMakeLists.txt +++ b/compiler/plugins/target/LLVMCPU/CMakeLists.txt @@ -98,6 +98,7 @@ iree_cc_library( "LLVMTargetOptions.cpp" DEPS LLVMAnalysis + LLVMCore LLVMMC LLVMPasses LLVMSupport