/src/spirv-tools/source/opt/modify_maximal_reconvergence.h
Line | Count | Source |
1 | | // Copyright (c) 2024 Google LLC |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #ifndef LIBSPIRV_OPT_MODIFY_MAXIMAL_RECONVERGENCE_H_ |
16 | | #define LIBSPIRV_OPT_MODIFY_MAXIMAL_RECONVERGENCE_H_ |
17 | | |
18 | | #include "pass.h" |
19 | | |
20 | | namespace spvtools { |
21 | | namespace opt { |
22 | | |
23 | | // Modifies entry points to either add or remove MaximallyReconvergesKHR |
24 | | // |
25 | | // This pass will either add or remove MaximallyReconvergesKHR to all entry |
26 | | // points in the module. When adding the execution mode, it does not attempt to |
27 | | // determine whether any ray tracing invocation repack instructions might be |
28 | | // executed because it is a runtime restriction. That is left to the user. |
29 | | class ModifyMaximalReconvergence : public Pass { |
30 | | public: |
31 | 0 | const char* name() const override { return "modify-maximal-reconvergence"; } |
32 | | Status Process() override; |
33 | | |
34 | 0 | explicit ModifyMaximalReconvergence(bool add = true) : Pass(), add_(add) {} |
35 | | |
36 | 0 | IRContext::Analysis GetPreservedAnalyses() override { |
37 | 0 | return IRContext::kAnalysisDefUse | |
38 | 0 | IRContext::kAnalysisInstrToBlockMapping | |
39 | 0 | IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators | |
40 | 0 | IRContext::kAnalysisCFG | IRContext::kAnalysisNameMap | |
41 | 0 | IRContext::kAnalysisConstants | IRContext::kAnalysisTypes; |
42 | 0 | } |
43 | | |
44 | | private: |
45 | | bool AddMaximalReconvergence(); |
46 | | bool RemoveMaximalReconvergence(); |
47 | | |
48 | | bool add_; |
49 | | }; |
50 | | } // namespace opt |
51 | | } // namespace spvtools |
52 | | |
53 | | #endif // LIBSPIRV_OPT_MODIFY_MAXIMAL_RECONVERGENCE_H_ |