api_schedule.cc 1.77 KB
Newer Older
1
/*!
2
 *  Copyright (c) 2017 by Contributors
3
 *  Implementation of API functions related to schedule pass.
4
 * \file api_schedule.cc
5 6 7 8
 */
#include <tvm/expr.h>
#include <tvm/tensor.h>
#include <tvm/schedule.h>
9
#include <tvm/schedule_pass.h>
10
#include <tvm/api_registry.h>
11
#include "../schedule/graph.h"
12 13 14 15

namespace tvm {
namespace schedule {

16
TVM_REGISTER_API("schedule.AutoInlineElemWise")
17 18
.set_body([](TVMArgs args, TVMRetValue* ret) {
    AutoInlineElemWise(args[0]);
19 20 21 22 23 24
  });


TVM_REGISTER_API("schedule.AutoInlineInjective")
.set_body([](TVMArgs args, TVMRetValue* ret) {
    AutoInlineInjective(args[0]);
25 26
  });

27 28 29
TVM_REGISTER_API("schedule.ScheduleOps")
.set_body([](TVMArgs args, TVMRetValue* ret) {
  if (args.size() == 2)
30
    *ret = ScheduleOps(args[0], args[1], false);
31 32 33 34
  else
    *ret = ScheduleOps(args[0], args[1], args[2]);
});

35
#define REGISTER_SCHEDULE_PASS1(PassName)                         \
36
  TVM_REGISTER_API("schedule."#PassName)                          \
37 38
  .set_body([](TVMArgs args,  TVMRetValue *ret) {                 \
      *ret = PassName(args[0]);                                   \
39 40
    })                                                            \

41
#define REGISTER_SCHEDULE_PASS2(PassName)                         \
42
  TVM_REGISTER_API("schedule."#PassName)                          \
43 44
  .set_body([](TVMArgs args,  TVMRetValue *ret) {                 \
      *ret = PassName(args[0], args[1]);                          \
45 46
    })                                                            \

47 48

REGISTER_SCHEDULE_PASS1(InferBound);
49 50
REGISTER_SCHEDULE_PASS1(CreateReadGraph);
REGISTER_SCHEDULE_PASS2(PostDFSOrder);
51
REGISTER_SCHEDULE_PASS1(CreateAttachPath);
52 53
REGISTER_SCHEDULE_PASS1(ScanGetBody);
REGISTER_SCHEDULE_PASS1(ScanFixPointAnalysis);
54 55 56

}  // namespace schedule
}  // namespace tvm