blob: bf2880aa022eed802082235c0c6af5bbc4340e61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
//===------------------ 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
|