1 //===------------------ TestSPIRVCPURunnerPipeline.cpp --------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Implements a pipeline for use by SPIR-V CPU Runner tests.
11 //===----------------------------------------------------------------------===//
13 #include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h"
14 #include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
15 #include "mlir/Dialect/GPU/Transforms/Passes.h"
16 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
17 #include "mlir/Dialect/SPIRV/Transforms/Passes.h"
18 #include "mlir/Pass/PassManager.h"
24 void buildTestSPIRVCPURunnerPipeline(OpPassManager
&passManager
) {
25 passManager
.addPass(createGpuKernelOutliningPass());
26 passManager
.addPass(createConvertGPUToSPIRVPass(/*mapMemorySpace=*/true));
28 OpPassManager
&nestedPM
= passManager
.nest
<spirv::ModuleOp
>();
29 nestedPM
.addPass(spirv::createSPIRVLowerABIAttributesPass());
30 nestedPM
.addPass(spirv::createSPIRVUpdateVCEPass());
31 passManager
.addPass(createLowerHostCodeToLLVMPass());
32 passManager
.addPass(createConvertSPIRVToLLVMPass());
39 void registerTestSPIRVCPURunnerPipeline() {
40 PassPipelineRegistration
<>(
41 "test-spirv-cpu-runner-pipeline",
42 "Runs a series of passes for lowering SPIR-V-dialect MLIR to "
43 "LLVM-dialect MLIR intended for SPIR-V CPU Runner tests.",
44 buildTestSPIRVCPURunnerPipeline
);