1//===------------------ TestSPIRVCPURunnerPipeline.cpp --------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// Implements a pipeline for use by SPIR-V CPU Runner tests.
10//
11//===----------------------------------------------------------------------===//
12
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"
19
20using namespace mlir;
21
22namespace {
23
24void buildTestSPIRVCPURunnerPipeline(OpPassManager &passManager) {
25 passManager.addPass(pass: createGpuKernelOutliningPass());
26 passManager.addPass(createConvertGPUToSPIRVPass(/*mapMemorySpace=*/true));
27
28 OpPassManager &nestedPM = passManager.nest<spirv::ModuleOp>();
29 nestedPM.addPass(spirv::createSPIRVLowerABIAttributesPass());
30 nestedPM.addPass(spirv::createSPIRVUpdateVCEPass());
31 passManager.addPass(pass: createLowerHostCodeToLLVMPass());
32 passManager.addPass(pass: createConvertSPIRVToLLVMPass());
33}
34
35} // namespace
36
37namespace mlir {
38namespace test {
39void 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);
45}
46} // namespace test
47} // namespace mlir
48

source code of mlir/test/lib/Pass/TestSPIRVCPURunnerPipeline.cpp