modify_maximal_reconvergence.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef LIBSPIRV_OPT_MODIFY_MAXIMAL_RECONVERGENCE_H_
  15. #define LIBSPIRV_OPT_MODIFY_MAXIMAL_RECONVERGENCE_H_
  16. #include "pass.h"
  17. namespace spvtools {
  18. namespace opt {
  19. // Modifies entry points to either add or remove MaximallyReconvergesKHR
  20. //
  21. // This pass will either add or remove MaximallyReconvergesKHR to all entry
  22. // points in the module. When adding the execution mode, it does not attempt to
  23. // determine whether any ray tracing invocation repack instructions might be
  24. // executed because it is a runtime restriction. That is left to the user.
  25. class ModifyMaximalReconvergence : public Pass {
  26. public:
  27. const char* name() const override { return "modify-maximal-reconvergence"; }
  28. Status Process() override;
  29. explicit ModifyMaximalReconvergence(bool add = true) : Pass(), add_(add) {}
  30. IRContext::Analysis GetPreservedAnalyses() override {
  31. return IRContext::kAnalysisDefUse |
  32. IRContext::kAnalysisInstrToBlockMapping |
  33. IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators |
  34. IRContext::kAnalysisCFG | IRContext::kAnalysisNameMap |
  35. IRContext::kAnalysisConstants | IRContext::kAnalysisTypes;
  36. }
  37. private:
  38. bool AddMaximalReconvergence();
  39. bool RemoveMaximalReconvergence();
  40. bool add_;
  41. };
  42. } // namespace opt
  43. } // namespace spvtools
  44. #endif // LIBSPIRV_OPT_MODIFY_MAXIMAL_RECONVERGENCE_H_