target_info.h 2.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

20
/*!
tqchen committed
21
 * \file tvm/target_info.h
22 23 24 25 26
 * \brief Various information about target.
 */
#ifndef TVM_TARGET_INFO_H_
#define TVM_TARGET_INFO_H_

27
#include <string>
28 29
#include "base.h"
#include "expr.h"
30 31 32 33 34 35 36 37 38 39 40 41 42 43

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;
44 45 46 47 48
  /*!
   * \brief head address of the buffer, if visible to CPU
   *  This address can be None.
   */
  Expr head_address;
49 50 51 52 53

  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);
54
    v->Visit("head_address", &head_address);
55 56 57 58 59 60 61 62 63
  }

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

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

64 65 66 67 68
/*!
 * \brief get memory info given scope
 * \param scope The scope name.
 * \return info The memory info.
 */
69
TVM_DLL MemoryInfo GetMemoryInfo(const std::string& scope);
70

71 72
}  // namespace tvm
#endif  // TVM_TARGET_INFO_H_