intrin_rule_opencl.cc 1.54 KB
Newer Older
1 2 3 4 5
/*!
 *  Copyright (c) 2017 by Contributors
 * \file intrin_rule_opencl.cc
 * \brief OpenCL intrinsic rules.
 */
6
#include "intrin_rule.h"
7 8 9 10 11

namespace tvm {
namespace codegen {
namespace intrin {

12 13 14 15 16 17
TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.floor")
.set_body(DispatchExtern<Direct>);

TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.ceil")
.set_body(DispatchExtern<Direct>);

18 19 20
TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.trunc")
.set_body(DispatchExtern<Direct>);

21 22 23
TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.fabs")
.set_body(DispatchExtern<Direct>);

24 25 26
TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.round")
.set_body(DispatchExtern<Direct>);

27
TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.exp")
28
.set_body(DispatchExtern<Direct>);
29 30

TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.log")
31
.set_body(DispatchExtern<Direct>);
32 33

TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.tanh")
34
.set_body(DispatchExtern<Direct>);
35

ziheng committed
36
TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.sqrt")
37
.set_body(DispatchExtern<Direct>);
ziheng committed
38

39
TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.pow")
40 41 42 43
.set_body(DispatchExtern<Direct>);

TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.popcount")
.set_body(DispatchExtern<Direct>);
44

45 46 47 48 49 50 51 52 53 54 55
// There is no warp shuffle instruction in standard OpenCL
// When shuffle is used, we assume it is intel's shuffle extension
struct IntelShuffle {
  std::string operator()(Type t, std::string name) const {
    return "intel_sub_group_shuffle";
  }
};

TVM_REGISTER_GLOBAL("tvm.intrin.rule.opencl.tvm_warp_shuffle")
.set_body(DispatchExtern<IntelShuffle>);

56 57 58
}  // namespace intrin
}  // namespace codegen
}  // namespace tvm