-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Revert "[mlir][mlir-spirv-cpu-runner] Move MLIR pass pipeline to mlir-opt" #113176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kuhar
merged 1 commit into
main
from
revert-111575-73457-runner-migration-cpu-pipeline-pass
Oct 21, 2024
Merged
Revert "[mlir][mlir-spirv-cpu-runner] Move MLIR pass pipeline to mlir-opt" #113176
kuhar
merged 1 commit into
main
from
revert-111575-73457-runner-migration-cpu-pipeline-pass
Oct 21, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-mlir-spirv @llvm/pr-subscribers-mlir Author: Jakub Kuderski (kuhar) ChangesReverts llvm/llvm-project#111575 This caused build failures: https://lab.llvm.org/buildbot/#/builders/138/builds/5244 Full diff: https://github.com/llvm/llvm-project/pull/113176.diff 6 Files Affected:
diff --git a/mlir/test/lib/Pass/CMakeLists.txt b/mlir/test/lib/Pass/CMakeLists.txt
index f489b7e51e5038..b190f054e50bd1 100644
--- a/mlir/test/lib/Pass/CMakeLists.txt
+++ b/mlir/test/lib/Pass/CMakeLists.txt
@@ -3,7 +3,6 @@ get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
add_mlir_library(MLIRTestPass
TestDynamicPipeline.cpp
TestPassManager.cpp
- TestSPIRVCPURunnerPipeline.cpp
EXCLUDE_FROM_LIBMLIR
diff --git a/mlir/test/lib/Pass/TestSPIRVCPURunnerPipeline.cpp b/mlir/test/lib/Pass/TestSPIRVCPURunnerPipeline.cpp
deleted file mode 100644
index ded0d22c31307e..00000000000000
--- a/mlir/test/lib/Pass/TestSPIRVCPURunnerPipeline.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===------------------ TestSPIRVCPURunnerPipeline.cpp --------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// Implements a pipeline for use by mlir-spirv-cpu-runner tests.
-//
-//===----------------------------------------------------------------------===//
-
-#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h"
-#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
-#include "mlir/Dialect/GPU/Transforms/Passes.h"
-#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
-#include "mlir/Pass/PassManager.h"
-
-using namespace mlir;
-
-namespace {
-
-void buildTestSPIRVCPURunnerPipeline(OpPassManager &passManager) {
- passManager.addPass(createGpuKernelOutliningPass());
- passManager.addPass(createConvertGPUToSPIRVPass(/*mapMemorySpace=*/true));
-
- OpPassManager &nestedPM = passManager.nest<spirv::ModuleOp>();
- nestedPM.addPass(spirv::createSPIRVLowerABIAttributesPass());
- nestedPM.addPass(spirv::createSPIRVUpdateVCEPass());
- passManager.addPass(createLowerHostCodeToLLVMPass());
- passManager.addPass(createConvertSPIRVToLLVMPass());
-}
-
-} // namespace
-
-namespace mlir {
-namespace test {
-void registerTestSPIRVCPURunnerPipeline() {
- PassPipelineRegistration<>(
- "test-spirv-cpu-runner-pipeline",
- "Runs a series of passes for lowering SPIR-V-dialect MLIR to "
- "LLVM-dialect MLIR intended for mlir-spirv-cpu-runner.",
- buildTestSPIRVCPURunnerPipeline);
-}
-} // namespace test
-} // namespace mlir
diff --git a/mlir/test/mlir-spirv-cpu-runner/double.mlir b/mlir/test/mlir-spirv-cpu-runner/double.mlir
index 35557ba1e94c00..cd551ffb1bd062 100644
--- a/mlir/test/mlir-spirv-cpu-runner/double.mlir
+++ b/mlir/test/mlir-spirv-cpu-runner/double.mlir
@@ -1,5 +1,4 @@
-// RUN: mlir-opt %s -test-spirv-cpu-runner-pipeline \
-// RUN: | mlir-spirv-cpu-runner - -e main --entry-point-result=void --shared-libs=%mlir_runner_utils,%mlir_test_spirv_cpu_runner_c_wrappers \
+// RUN: mlir-spirv-cpu-runner %s -e main --entry-point-result=void --shared-libs=%mlir_runner_utils,%mlir_test_spirv_cpu_runner_c_wrappers \
// RUN: | FileCheck %s
// CHECK: [8, 8, 8, 8, 8, 8]
diff --git a/mlir/test/mlir-spirv-cpu-runner/simple_add.mlir b/mlir/test/mlir-spirv-cpu-runner/simple_add.mlir
index 75675a69a67583..119e973e45e4a7 100644
--- a/mlir/test/mlir-spirv-cpu-runner/simple_add.mlir
+++ b/mlir/test/mlir-spirv-cpu-runner/simple_add.mlir
@@ -1,5 +1,4 @@
-// RUN: mlir-opt %s -test-spirv-cpu-runner-pipeline \
-// RUN: | mlir-spirv-cpu-runner - -e main --entry-point-result=void --shared-libs=%mlir_runner_utils,%mlir_test_spirv_cpu_runner_c_wrappers \
+// RUN: mlir-spirv-cpu-runner %s -e main --entry-point-result=void --shared-libs=%mlir_runner_utils,%mlir_test_spirv_cpu_runner_c_wrappers \
// RUN: | FileCheck %s
// CHECK: data =
diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp
index 002c3900056dee..36b142484bb04a 100644
--- a/mlir/tools/mlir-opt/mlir-opt.cpp
+++ b/mlir/tools/mlir-opt/mlir-opt.cpp
@@ -142,7 +142,6 @@ void registerTestSCFWhileOpBuilderPass();
void registerTestSCFWrapInZeroTripCheckPasses();
void registerTestShapeMappingPass();
void registerTestSliceAnalysisPass();
-void registerTestSPIRVCPURunnerPipeline();
void registerTestSPIRVFuncSignatureConversion();
void registerTestSPIRVVectorUnrolling();
void registerTestTensorCopyInsertionPass();
@@ -279,7 +278,6 @@ void registerTestPasses() {
mlir::test::registerTestSCFWrapInZeroTripCheckPasses();
mlir::test::registerTestShapeMappingPass();
mlir::test::registerTestSliceAnalysisPass();
- mlir::test::registerTestSPIRVCPURunnerPipeline();
mlir::test::registerTestSPIRVFuncSignatureConversion();
mlir::test::registerTestSPIRVVectorUnrolling();
mlir::test::registerTestTensorCopyInsertionPass();
diff --git a/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp b/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
index 22ad1024db4a0b..7e0b51cac80621 100644
--- a/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
+++ b/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
@@ -12,12 +12,18 @@
//
//===----------------------------------------------------------------------===//
+#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h"
+#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h"
+#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
+#include "mlir/Dialect/GPU/Transforms/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
+#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
#include "mlir/ExecutionEngine/JitRunner.h"
#include "mlir/ExecutionEngine/OptUtils.h"
#include "mlir/Pass/Pass.h"
@@ -69,6 +75,23 @@ convertMLIRModule(Operation *op, llvm::LLVMContext &context) {
return mainModule;
}
+static LogicalResult runMLIRPasses(Operation *module,
+ JitRunnerOptions &options) {
+ PassManager passManager(module->getContext(),
+ module->getName().getStringRef());
+ if (failed(applyPassManagerCLOptions(passManager)))
+ return failure();
+ passManager.addPass(createGpuKernelOutliningPass());
+ passManager.addPass(createConvertGPUToSPIRVPass(/*mapMemorySpace=*/true));
+
+ OpPassManager &nestedPM = passManager.nest<spirv::ModuleOp>();
+ nestedPM.addPass(spirv::createSPIRVLowerABIAttributesPass());
+ nestedPM.addPass(spirv::createSPIRVUpdateVCEPass());
+ passManager.addPass(createLowerHostCodeToLLVMPass());
+ passManager.addPass(createConvertSPIRVToLLVMPass());
+ return passManager.run(module);
+}
+
int main(int argc, char **argv) {
llvm::InitLLVM y(argc, argv);
@@ -76,6 +99,7 @@ int main(int argc, char **argv) {
llvm::InitializeNativeTargetAsmPrinter();
mlir::JitRunnerConfig jitRunnerConfig;
+ jitRunnerConfig.mlirTransformer = runMLIRPasses;
jitRunnerConfig.llvmModuleBuilder = convertMLIRModule;
mlir::DialectRegistry registry;
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
mlir:core
MLIR Core Infrastructure
mlir:spirv
mlir
skip-precommit-approval
PR for CI feedback, not intended for review
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #111575
This caused build failures: https://lab.llvm.org/buildbot/#/builders/138/builds/5244