ScheduleOptimizer.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //===- polly/ScheduleOptimizer.h - The Schedule Optimizer -------*- 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. #ifndef POLLY_SCHEDULEOPTIMIZER_H
  9. #define POLLY_SCHEDULEOPTIMIZER_H
  10. #include "polly/ScopPass.h"
  11. namespace llvm {
  12. class Pass;
  13. class PassRegistry;
  14. } // namespace llvm
  15. namespace polly {
  16. llvm::Pass *createIslScheduleOptimizerWrapperPass();
  17. struct IslScheduleOptimizerPass
  18. : llvm::PassInfoMixin<IslScheduleOptimizerPass> {
  19. IslScheduleOptimizerPass() {}
  20. llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
  21. ScopStandardAnalysisResults &SAR, SPMUpdater &U);
  22. };
  23. struct IslScheduleOptimizerPrinterPass
  24. : llvm::PassInfoMixin<IslScheduleOptimizerPrinterPass> {
  25. IslScheduleOptimizerPrinterPass(raw_ostream &OS) : OS(OS) {}
  26. PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
  27. ScopStandardAnalysisResults &SAR, SPMUpdater &);
  28. private:
  29. llvm::raw_ostream &OS;
  30. };
  31. /// Build the desired set of partial tile prefixes.
  32. ///
  33. /// We build a set of partial tile prefixes, which are prefixes of the vector
  34. /// loop that have exactly VectorWidth iterations.
  35. ///
  36. /// 1. Drop all constraints involving the dimension that represents the
  37. /// vector loop.
  38. /// 2. Constrain the last dimension to get a set, which has exactly VectorWidth
  39. /// iterations.
  40. /// 3. Subtract loop domain from it, project out the vector loop dimension and
  41. /// get a set that contains prefixes, which do not have exactly VectorWidth
  42. /// iterations.
  43. /// 4. Project out the vector loop dimension of the set that was build on the
  44. /// first step and subtract the set built on the previous step to get the
  45. /// desired set of prefixes.
  46. ///
  47. /// @param ScheduleRange A range of a map, which describes a prefix schedule
  48. /// relation.
  49. isl::set getPartialTilePrefixes(isl::set ScheduleRange, int VectorWidth);
  50. } // namespace polly
  51. namespace llvm {
  52. void initializeIslScheduleOptimizerWrapperPassPass(llvm::PassRegistry &);
  53. }
  54. #endif // POLLY_SCHEDULEOPTIMIZER_H