You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

stmt_builder.h 1.7 kB

5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef UT_BASE_STMT_BUILDER_H_
  17. #define UT_BASE_STMT_BUILDER_H_
  18. #include <list>
  19. #include <string>
  20. #include <vector>
  21. #include "tvm/ir.h"
  22. #include "base/expr_builder.h"
  23. namespace akg {
  24. class UTStmtBuilder {
  25. public:
  26. UTStmtBuilder() = default;
  27. ~UTStmtBuilder() = default;
  28. static air::Stmt CreateFor(
  29. air::Var loop_var,
  30. int32_t min,
  31. int32_t extent,
  32. air::Stmt body);
  33. static air::Stmt CreateRealizeByPlaceholderOp(
  34. const air::Operation &op,
  35. air::Stmt body);
  36. static air::Stmt CreateProvideAssign(
  37. air::ir::FunctionRef func_dst,
  38. air::Array<air::Expr> vars,
  39. air::Expr src,
  40. int value_index = 0);
  41. template <typename T>
  42. static air::Stmt CreateProvideBinary(
  43. air::ir::FunctionRef func_dst,
  44. air::Array<air::Expr> vars,
  45. air::Expr src1,
  46. air::Expr src2,
  47. int value_index = 0) {
  48. return air::ir::Provide::make(
  49. func_dst,
  50. value_index,
  51. T::make(src1, src2),
  52. vars);
  53. }
  54. }; // class UTStmtBuilder
  55. } // namespace akg
  56. #endif // UT_BASE_STMT_BUILDER_H_