This commit builds on and completes the work done in
9f6c632ecd to eliminate the need for a
separate mlir-spirv-cpu-runner binary. Since the MLIR processing is
already done outside this runner, the only real difference between it
and the mlir-cpu-runner is the final linking step between the nested
LLVM IR modules. By moving this step into mlir-cpu-runner behind a new
command-line flag (`--link-nested-modules`), this commit is able to
completely remove the runner component of the mlir-spirv-cpu-runner.
The runtime libraries and the tests are moved and renamed to fit into
the Execution Engine and Integration tests, following the model of the
similar migration done for the CUDA Runner in D97463.
48 lines
1.7 KiB
C++
48 lines
1.7 KiB
C++
//===------------------ 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 SPIR-V 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 SPIR-V CPU Runner tests.",
|
|
buildTestSPIRVCPURunnerPipeline);
|
|
}
|
|
} // namespace test
|
|
} // namespace mlir
|