target_info.h 1.34 KB
Newer Older
1 2
/*!
 *  Copyright (c) 2017 by Contributors
tqchen committed
3
 * \file tvm/target_info.h
4 5 6 7 8
 * \brief Various information about target.
 */
#ifndef TVM_TARGET_INFO_H_
#define TVM_TARGET_INFO_H_

9
#include <string>
10 11
#include "base.h"
#include "expr.h"
12 13 14 15 16 17 18 19 20 21 22 23 24 25

namespace tvm {

/*!
 * \brief Memory information of special memory region.
 *  Use MemoryInfo as its container type
 */
struct MemoryInfoNode : public Node {
  /*! \brief The addressable unit */
  int unit_bits;
  /*! \brief Maximum number of bits supported in the memory */
  int max_num_bits;
  /*! \brief maximum number of bits to be used in simd op */
  int max_simd_bits;
26 27 28 29 30
  /*!
   * \brief head address of the buffer, if visible to CPU
   *  This address can be None.
   */
  Expr head_address;
31 32 33 34 35

  void VisitAttrs(AttrVisitor* v) final {
    v->Visit("unit_bits", &unit_bits);
    v->Visit("max_num_bits", &max_num_bits);
    v->Visit("max_simd_bits", &max_simd_bits);
36
    v->Visit("head_address", &head_address);
37 38 39 40 41 42 43 44 45
  }

  static constexpr const char* _type_key = "MemoryInfo";
  TVM_DECLARE_NODE_TYPE_INFO(MemoryInfoNode, Node);
};

/*! \brief Defines memory info */
TVM_DEFINE_NODE_REF(MemoryInfo, MemoryInfoNode);

46 47 48 49 50
/*!
 * \brief get memory info given scope
 * \param scope The scope name.
 * \return info The memory info.
 */
51
TVM_DLL MemoryInfo GetMemoryInfo(const std::string& scope);
52

53 54
}  // namespace tvm
#endif  // TVM_TARGET_INFO_H_