1 | /* |
2 | * Licensed to the Apache Software Foundation (ASF) under one |
3 | * or more contributor license agreements. See the NOTICE file |
4 | * distributed with this work for additional information |
5 | * regarding copyright ownership. The ASF licenses this file |
6 | * to you under the Apache License, Version 2.0 (the |
7 | * "License"); you may not use this file except in compliance |
8 | * with the License. You may obtain a copy of the License at |
9 | * |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * |
12 | * Unless required by applicable law or agreed to in writing, |
13 | * software distributed under the License is distributed on an |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 | * KIND, either express or implied. See the License for the |
16 | * specific language governing permissions and limitations |
17 | * under the License. |
18 | */ |
19 | |
20 | /*! |
21 | * \file tvm/target/target_info.h |
22 | * \brief Various information about target. |
23 | */ |
24 | #ifndef TVM_TARGET_TARGET_INFO_H_ |
25 | #define TVM_TARGET_TARGET_INFO_H_ |
26 | |
27 | #include <tvm/ir/expr.h> |
28 | |
29 | #include <string> |
30 | |
31 | namespace tvm { |
32 | |
33 | /*! |
34 | * \brief Memory information of special memory region. |
35 | * Use MemoryInfo as its container type |
36 | */ |
37 | class MemoryInfoNode : public Object { |
38 | public: |
39 | /*! \brief The addressable unit */ |
40 | int64_t unit_bits; |
41 | /*! \brief Maximum number of bits supported in the memory */ |
42 | int64_t max_num_bits; |
43 | /*! \brief maximum number of bits to be used in simd op */ |
44 | int64_t max_simd_bits; |
45 | /*! |
46 | * \brief head address of the buffer, if visible to CPU |
47 | * This address can be None. |
48 | */ |
49 | PrimExpr head_address; |
50 | |
51 | void VisitAttrs(AttrVisitor* v) { |
52 | v->Visit("unit_bits" , &unit_bits); |
53 | v->Visit("max_num_bits" , &max_num_bits); |
54 | v->Visit("max_simd_bits" , &max_simd_bits); |
55 | v->Visit("head_address" , &head_address); |
56 | } |
57 | |
58 | static constexpr const char* _type_key = "MemoryInfo" ; |
59 | TVM_DECLARE_FINAL_OBJECT_INFO(MemoryInfoNode, Object); |
60 | }; |
61 | |
62 | /*! \brief Defines memory info */ |
63 | class MemoryInfo : public ObjectRef { |
64 | public: |
65 | TVM_DEFINE_OBJECT_REF_METHODS(MemoryInfo, ObjectRef, MemoryInfoNode); |
66 | }; |
67 | |
68 | /*! |
69 | * \brief get memory info given scope |
70 | * \param scope The scope name. |
71 | * \return info The memory info. |
72 | */ |
73 | TVM_DLL MemoryInfo GetMemoryInfo(const std::string& scope); |
74 | |
75 | } // namespace tvm |
76 | #endif // TVM_TARGET_TARGET_INFO_H_ |
77 | |