MLIR  16.0.0git
Passes.h
Go to the documentation of this file.
1 //===- Passes.h - SPIR-V pass entry points ----------------------*- C++ -*-===//
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 // This header file defines prototypes that expose pass constructors.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_DIALECT_SPIRV_TRANSFORMS_PASSES_H_
14 #define MLIR_DIALECT_SPIRV_TRANSFORMS_PASSES_H_
15 
16 #include "mlir/Pass/Pass.h"
17 
18 namespace mlir {
19 
20 class ModuleOp;
21 
22 namespace spirv {
23 
24 class ModuleOp;
25 
26 //===----------------------------------------------------------------------===//
27 // Passes
28 //===----------------------------------------------------------------------===//
29 
30 /// Creates a pass to run canoncalization patterns that involve GL ops.
31 /// These patterns cannot be run in default canonicalization because GL ops
32 /// aren't always available. So they should be involed specifically when needed.
33 std::unique_ptr<OperationPass<>> createCanonicalizeGLPass();
34 
35 /// Creates a module pass that converts composite types used by objects in the
36 /// StorageBuffer, PhysicalStorageBuffer, Uniform, and PushConstant storage
37 /// classes with layout information.
38 /// Right now this pass only supports Vulkan layout rules.
39 std::unique_ptr<OperationPass<mlir::ModuleOp>>
41 
42 /// Creates an operation pass that deduces and attaches the minimal version/
43 /// capabilities/extensions requirements for spv.module ops.
44 /// For each spv.module op, this pass requires a `spv.target_env` attribute on
45 /// it or an enclosing module-like op to drive the deduction. The reason is
46 /// that an op can be enabled by multiple extensions/capabilities. So we need
47 /// to know which one to pick. `spv.target_env` gives the hard limit as for
48 /// what the target environment can support; this pass deduces what are
49 /// actually needed for a specific spv.module op.
50 std::unique_ptr<OperationPass<spirv::ModuleOp>>
52 
53 /// Creates an operation pass that lowers the ABI attributes specified during
54 /// SPIR-V Lowering. Specifically,
55 /// 1. Creates the global variables for arguments of entry point function using
56 /// the specification in the `spv.interface_var_abi` attribute for each
57 /// argument.
58 /// 2. Inserts the EntryPointOp and the ExecutionModeOp for entry point
59 /// functions using the specification in the `spv.entry_point_abi` attribute.
60 std::unique_ptr<OperationPass<spirv::ModuleOp>> createLowerABIAttributesPass();
61 
62 /// Creates an operation pass that rewrites sequential chains of
63 /// spv.CompositeInsert into spv.CompositeConstruct.
64 std::unique_ptr<OperationPass<spirv::ModuleOp>> createRewriteInsertsPass();
65 
66 /// Creates an operation pass that unifies access of multiple aliased resources
67 /// into access of one single resource.
68 std::unique_ptr<OperationPass<spirv::ModuleOp>>
70 
71 //===----------------------------------------------------------------------===//
72 // Registration
73 //===----------------------------------------------------------------------===//
74 
75 /// Generate the code for registering passes.
76 #define GEN_PASS_REGISTRATION
77 #include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
78 
79 } // namespace spirv
80 } // namespace mlir
81 
82 #endif // MLIR_DIALECT_SPIRV_TRANSFORMS_PASSES_H_
Include the generated interface declarations.
std::unique_ptr< OperationPass<> > createCanonicalizeGLPass()
Creates a pass to run canoncalization patterns that involve GL ops.
std::unique_ptr< OperationPass< spirv::ModuleOp > > createUnifyAliasedResourcePass()
Creates an operation pass that unifies access of multiple aliased resources into access of one single...
std::unique_ptr< OperationPass< spirv::ModuleOp > > createLowerABIAttributesPass()
Creates an operation pass that lowers the ABI attributes specified during SPIR-V Lowering.
std::unique_ptr< OperationPass< mlir::ModuleOp > > createDecorateSPIRVCompositeTypeLayoutPass()
Creates a module pass that converts composite types used by objects in the StorageBuffer, PhysicalStorageBuffer, Uniform, and PushConstant storage classes with layout information.
std::unique_ptr< OperationPass< spirv::ModuleOp > > createRewriteInsertsPass()
Creates an operation pass that rewrites sequential chains of spv.CompositeInsert into spv...
std::unique_ptr< OperationPass< spirv::ModuleOp > > createUpdateVersionCapabilityExtensionPass()
Creates an operation pass that deduces and attaches the minimal version/ capabilities/extensions requ...