api_arith.cc 2.05 KB
Newer Older
1 2 3 4 5 6 7 8
/*!
 *  Copyright (c) 2016 by Contributors
 *  Implementation of API functions related to arith
 * \file api_arith.cc
 */
#include <tvm/expr.h>
#include <tvm/ir.h>
#include <tvm/api_registry.h>
9
#include <tvm/tensor.h>
10 11 12 13

namespace tvm {
namespace arith {

14
TVM_REGISTER_API("arith.intset_single_point")
15 16 17 18
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = IntSet::single_point(args[0]);
  });

19 20 21 22 23
TVM_REGISTER_API("arith.intset_vector")
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = IntSet::vector(args[0]);
  });

24
TVM_REGISTER_API("arith.intset_interval")
25 26 27 28
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = IntSet::interval(args[0], args[1]);
  });

29
TVM_REGISTER_API("arith.EvalModular")
30 31 32 33
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = EvalModular(args[0], Map<Var, IntSet>());
  });

34
TVM_REGISTER_API("arith.DetectLinearEquation")
35 36 37 38
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = DetectLinearEquation(args[0], args[1]);
  });

39 40 41 42 43
TVM_REGISTER_API("arith.DetectClipBound")
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = DetectClipBound(args[0], args[1]);
  });

44
TVM_REGISTER_API("arith.DeduceBound")
45
.set_body([](TVMArgs args, TVMRetValue *ret) {
46 47 48
    *ret = DeduceBound(args[0], args[1],
        args[2].operator Map<Var, IntSet>(),
        args[3].operator Map<Var, IntSet>());
49 50
  });

51 52 53 54 55 56 57

TVM_REGISTER_API("arith.DomainTouched")
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = DomainTouched(args[0], args[1], args[2], args[3]);
  });


58
TVM_REGISTER_API("_IntervalSetGetMin")
59 60 61 62
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = args[0].operator IntSet().min();
  });

63
TVM_REGISTER_API("_IntervalSetGetMax")
64 65 66 67
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = args[0].operator IntSet().max();
  });

68
TVM_REGISTER_API("_IntSetIsNothing")
69 70 71 72
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = args[0].operator IntSet().is_nothing();
  });

73
TVM_REGISTER_API("_IntSetIsEverything")
74 75 76 77 78 79
.set_body([](TVMArgs args, TVMRetValue *ret) {
    *ret = args[0].operator IntSet().is_everything();
  });

}  // namespace arith
}  // namespace tvm