Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions ffi/include/tvm/ffi/cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,10 @@ inline OptionalType Downcast(const std::optional<Any>& ref) {
}

} // namespace ffi

// Expose to the tvm namespace
// Rationale: convinience and no ambiguity
using ffi::Downcast;
using ffi::GetRef;
} // namespace tvm
#endif // TVM_FFI_CAST_H_
4 changes: 4 additions & 0 deletions ffi/include/tvm/ffi/container/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -1031,5 +1031,9 @@ inline constexpr bool type_contains_v<Array<T>, Array<U>> = type_contains_v<T, U
} // namespace details

} // namespace ffi

// Expose to the tvm namespace
// Rationale: convinience and no ambiguity
using ffi::Array;
} // namespace tvm
#endif // TVM_FFI_CONTAINER_ARRAY_H_
6 changes: 5 additions & 1 deletion ffi/include/tvm/ffi/container/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ class Map : public ObjectRef {
iterator end() const { return iterator(GetMapObj()->end()); }
/*! \return find the key and returns the associated iterator */
iterator find(const K& key) const { return iterator(GetMapObj()->find(key)); }
/*! \return The value associated with the key, NullOpt if not found */
/*! \return The value associated with the key, std::nullopt if not found */
std::optional<V> Get(const K& key) const {
MapObj::iterator iter = GetMapObj()->find(key);
if (iter == GetMapObj()->end()) {
Expand Down Expand Up @@ -1602,5 +1602,9 @@ inline constexpr bool type_contains_v<Map<K, V>, Map<KU, VU>> =
} // namespace details

} // namespace ffi

// Expose to the tvm namespace
// Rationale: convinience and no ambiguity
using ffi::Map;
} // namespace tvm
#endif // TVM_FFI_CONTAINER_MAP_H_
4 changes: 4 additions & 0 deletions ffi/include/tvm/ffi/container/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,9 @@ inline constexpr bool type_contains_v<Tuple<T...>, Tuple<U...>> = (type_contains
} // namespace details

} // namespace ffi

// Expose to the tvm namespace
// Rationale: convinience and no ambiguity
using ffi::Tuple;
} // namespace tvm
#endif // TVM_FFI_CONTAINER_TUPLE_H_
4 changes: 4 additions & 0 deletions ffi/include/tvm/ffi/container/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,9 @@ template <typename... V, typename T>
inline constexpr bool type_contains_v<Variant<V...>, T> = (type_contains_v<V, T> || ...);
} // namespace details
} // namespace ffi

// Expose to the tvm namespace
// Rationale: convinience and no ambiguity
using ffi::Variant;
} // namespace tvm
#endif // TVM_FFI_CONTAINER_VARIANT_H_
1 change: 1 addition & 0 deletions ffi/include/tvm/ffi/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@ inline int32_t TypeKeyToIndex(std::string_view type_key) {
*/
#define TVM_FFI_REGISTER_GLOBAL(OpName) \
TVM_FFI_STR_CONCAT(TVM_FFI_FUNC_REG_VAR_DEF, __COUNTER__) = ::tvm::ffi::Function::Registry(OpName)

} // namespace ffi
} // namespace tvm
#endif // TVM_FFI_FUNCTION_H_
4 changes: 4 additions & 0 deletions ffi/include/tvm/ffi/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,9 @@ inline ObjectPtr<ArrayType> make_inplace_array_object(size_t num_elems, Args&&..
}

} // namespace ffi

// Export the make_object function
// rationale: ease of use, and no ambiguity
using ffi::make_object;
} // namespace tvm
#endif // TVM_FFI_MEMORY_H_
3 changes: 3 additions & 0 deletions ffi/include/tvm/ffi/optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,8 @@ class Optional<T, std::enable_if_t<use_ptr_based_optional_v<T>>> : public Object
}
};
} // namespace ffi

// Expose to the tvm namespace
using ffi::Optional;
} // namespace tvm
#endif // TVM_FFI_OPTIONAL_H_
5 changes: 5 additions & 0 deletions ffi/include/tvm/ffi/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@ inline int Bytes::memncmp(const char* lhs, const char* rhs, size_t lhs_count, si
}
}
} // namespace ffi

// Expose to the tvm namespace for usability
// Rationale: no ambiguity even in root
using ffi::Bytes;
using ffi::String;
} // namespace tvm

namespace std {
Expand Down
6 changes: 4 additions & 2 deletions include/tvm/arith/int_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ Map<Var, arith::IntSet> AsIntSet(const Map<Var, Range>& var_dom);
* \param var_dom The ranges of the variables
* \param predicate The predicate for the affine map
* \param analyzer The analyzer used
* \return NullOpt if the detection fails, or an array of arith::IntSet as the result of analysis
* \return std::nullopt if the detection fails, or an array of arith::IntSet as the result of
* analysis
*/
TVM_DLL Optional<Array<IntSet>> EstimateRegionStrictBound(const Array<Range>& region,
const Map<Var, Range>& var_dom,
Expand All @@ -313,7 +314,8 @@ TVM_DLL Optional<Array<IntSet>> EstimateRegionStrictBound(const Array<Range>& re
* \param var_dom The ranges of the variables
* \param predicate The predicate for the affine map
* \param analyzer The analyzer used
* \return NullOpt if the detection fails, or an array of arith::IntSet as the result of analysis
* \return std::nullopt if the detection fails, or an array of arith::IntSet as the result of
* analysis
*/
TVM_DLL Optional<Array<IntSet>> EstimateRegionLowerBound(const Array<Range>& region,
const Map<Var, Range>& var_dom,
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/analysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
#ifndef TVM_IR_ANALYSIS_H_
#define TVM_IR_ANALYSIS_H_

#include <tvm/ffi/container/array.h>
#include <tvm/ir/expr.h>
#include <tvm/ir/module.h>
#include <tvm/node/functor.h>
#include <tvm/runtime/container/array.h>

namespace tvm {
namespace ir {
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/attrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
#define TVM_IR_ATTRS_H_

#include <dmlc/common.h>
#include <tvm/ffi/container/map.h>
#include <tvm/ir/expr.h>
#include <tvm/node/structural_equal.h>
#include <tvm/node/structural_hash.h>
#include <tvm/runtime/container/map.h>
#include <tvm/runtime/packed_func.h>

#include <functional>
Expand Down
4 changes: 2 additions & 2 deletions include/tvm/ir/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#ifndef TVM_IR_EXPR_H_
#define TVM_IR_EXPR_H_

#include <tvm/ffi/string.h>
#include <tvm/ir/source_map.h>
#include <tvm/ir/type.h>
#include <tvm/node/node.h>
#include <tvm/runtime/container/string.h>
#include <tvm/runtime/object.h>

#include <algorithm>
Expand All @@ -38,7 +38,7 @@

namespace tvm {

using tvm::runtime::String;
using tvm::String;

// Forward-declare VirtualDevice to avoid circular imports.
class VirtualDevice;
Expand Down
6 changes: 3 additions & 3 deletions include/tvm/ir/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
#ifndef TVM_IR_FUNCTION_H_
#define TVM_IR_FUNCTION_H_

#include <tvm/ffi/container/array.h>
#include <tvm/ffi/container/map.h>
#include <tvm/ffi/string.h>
#include <tvm/ir/attrs.h>
#include <tvm/ir/expr.h>
#include <tvm/runtime/container/array.h>
#include <tvm/runtime/container/map.h>
#include <tvm/runtime/container/string.h>

#include <string>
#include <type_traits>
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/instrument.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#ifndef TVM_IR_INSTRUMENT_H_
#define TVM_IR_INSTRUMENT_H_

#include <tvm/ffi/string.h>
#include <tvm/node/reflection.h>
#include <tvm/runtime/container/string.h>

#include <utility>
#include <vector>
Expand Down
6 changes: 3 additions & 3 deletions include/tvm/ir/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
#ifndef TVM_IR_MODULE_H_
#define TVM_IR_MODULE_H_

#include <tvm/ffi/container/array.h>
#include <tvm/ffi/container/map.h>
#include <tvm/ffi/string.h>
#include <tvm/ir/expr.h>
#include <tvm/ir/function.h>
#include <tvm/ir/global_info.h>
#include <tvm/ir/source_map.h>
#include <tvm/ir/type.h>
#include <tvm/runtime/container/array.h>
#include <tvm/runtime/container/map.h>
#include <tvm/runtime/container/string.h>

#include <string>
#include <unordered_map>
Expand Down
8 changes: 4 additions & 4 deletions include/tvm/ir/transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
#ifndef TVM_IR_TRANSFORM_H_
#define TVM_IR_TRANSFORM_H_

#include <tvm/ffi/container/array.h>
#include <tvm/ffi/string.h>
#include <tvm/ir/diagnostic.h>
#include <tvm/ir/instrument.h>
#include <tvm/ir/module.h>
#include <tvm/runtime/container/array.h>
#include <tvm/runtime/container/string.h>
#include <tvm/support/with.h>

#include <string>
Expand Down Expand Up @@ -365,7 +365,7 @@ class PassInfo : public ObjectRef {
* \param required The passes that are required to perform the current pass.
* \param traceable Boolean that tells whether the pass is traceable.
*/
TVM_DLL PassInfo(int opt_level, String name, Array<runtime::String> required, bool traceable);
TVM_DLL PassInfo(int opt_level, String name, Array<String> required, bool traceable);

TVM_DEFINE_OBJECT_REF_METHODS(PassInfo, ObjectRef, PassInfoNode);
};
Expand Down Expand Up @@ -538,7 +538,7 @@ class Sequential : public Pass {
* \return The created module pass.
*/
TVM_DLL Pass CreateModulePass(std::function<IRModule(IRModule, PassContext)> pass_func,
int opt_level, String name, Array<runtime::String> required,
int opt_level, String name, Array<String> required,
bool traceable = false);

/*
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
#ifndef TVM_IR_TYPE_H_
#define TVM_IR_TYPE_H_

#include <tvm/ffi/container/array.h>
#include <tvm/ir/source_map.h>
#include <tvm/node/node.h>
#include <tvm/runtime/container/array.h>
#include <tvm/runtime/data_type.h>
#include <tvm/runtime/object.h>

Expand Down
6 changes: 3 additions & 3 deletions include/tvm/meta_schedule/arg_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#ifndef TVM_META_SCHEDULE_ARG_INFO_H_
#define TVM_META_SCHEDULE_ARG_INFO_H_

#include <tvm/ffi/container/shape.h>
#include <tvm/ir/module.h>
#include <tvm/node/node.h>
#include <tvm/node/reflection.h>
#include <tvm/runtime/container/shape_tuple.h>
#include <tvm/runtime/data_type.h>
#include <tvm/runtime/object.h>
#include <tvm/tir/function.h>
Expand Down Expand Up @@ -81,7 +81,7 @@ class TensorInfoNode : public ArgInfoNode {
/*! \brief The data type of the tensor. */
runtime::DataType dtype;
/*! \brief The shape of the tensor. */
runtime::ShapeTuple shape;
ffi::Shape shape;

void VisitAttrs(tvm::AttrVisitor* v) {
v->Visit("dtype", &dtype);
Expand All @@ -106,7 +106,7 @@ class TensorInfo : public ArgInfo {
* \param dtype The data type of the tensor argument.
* \param shape The shape tuple of the tensor argument.
*/
TVM_DLL explicit TensorInfo(runtime::DataType dtype, runtime::ShapeTuple shape);
TVM_DLL explicit TensorInfo(runtime::DataType dtype, ffi::Shape shape);
/*!
* \brief Parse the argument information from a JSON object.
* \param json_obj The json object to parse.
Expand Down
10 changes: 5 additions & 5 deletions include/tvm/meta_schedule/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
#ifndef TVM_META_SCHEDULE_BUILDER_H_
#define TVM_META_SCHEDULE_BUILDER_H_

#include <tvm/ffi/container/array.h>
#include <tvm/ffi/container/map.h>
#include <tvm/ffi/optional.h>
#include <tvm/ffi/string.h>
#include <tvm/ir/module.h>
#include <tvm/node/reflection.h>
#include <tvm/runtime/container/array.h>
#include <tvm/runtime/container/map.h>
#include <tvm/runtime/container/optional.h>
#include <tvm/runtime/container/string.h>
#include <tvm/runtime/ndarray.h>
#include <tvm/runtime/object.h>
#include <tvm/runtime/packed_func.h>
Expand Down Expand Up @@ -66,7 +66,7 @@ class BuilderInput : public runtime::ObjectRef {
* \param params Parameters for Relax build module.
*/
TVM_DLL explicit BuilderInput(IRModule mod, Target target,
Optional<Map<String, runtime::NDArray>> params = NullOpt);
Optional<Map<String, runtime::NDArray>> params = std::nullopt);
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(BuilderInput, runtime::ObjectRef, BuilderInputNode);
};

Expand Down
4 changes: 2 additions & 2 deletions include/tvm/meta_schedule/cost_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
#ifndef TVM_META_SCHEDULE_COST_MODEL_H_
#define TVM_META_SCHEDULE_COST_MODEL_H_

#include <tvm/ffi/container/array.h>
#include <tvm/ffi/string.h>
#include <tvm/meta_schedule/arg_info.h>
#include <tvm/meta_schedule/measure_candidate.h>
#include <tvm/meta_schedule/runner.h>
#include <tvm/node/reflection.h>
#include <tvm/runtime/container/array.h>
#include <tvm/runtime/container/string.h>
#include <tvm/runtime/object.h>
#include <tvm/runtime/packed_func.h>
#include <tvm/tir/schedule/schedule.h>
Expand Down
16 changes: 8 additions & 8 deletions include/tvm/meta_schedule/database.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
#ifndef TVM_META_SCHEDULE_DATABASE_H_
#define TVM_META_SCHEDULE_DATABASE_H_

#include <tvm/ffi/container/array.h>
#include <tvm/ffi/string.h>
#include <tvm/ir/expr.h>
#include <tvm/ir/module.h>
#include <tvm/meta_schedule/arg_info.h>
#include <tvm/node/reflection.h>
#include <tvm/runtime/container/array.h>
#include <tvm/runtime/container/string.h>
#include <tvm/runtime/object.h>
#include <tvm/runtime/packed_func.h>
#include <tvm/target/target.h>
Expand Down Expand Up @@ -238,7 +238,7 @@ class DatabaseNode : public runtime::Object {
* \param mod The IRModule to be searched for.
* \param target The target to be searched for.
* \param workload_name The name of the workload to be searched for.
* \return The best record of the given workload; NullOpt if not found.
* \return The best record of the given workload; std::nullopt if not found.
*/
virtual Optional<TuningRecord> QueryTuningRecord(const IRModule& mod, const Target& target,
const String& workload_name);
Expand All @@ -247,7 +247,7 @@ class DatabaseNode : public runtime::Object {
* \param mod The IRModule to be searched for.
* \param target The target to be searched for.
* \param workload_name The name of the workload to be searched for.
* \return The schedule in the best schedule of the given workload; NullOpt if not found.
* \return The schedule in the best schedule of the given workload; std::nullopt if not found.
*/
virtual Optional<tir::Schedule> QuerySchedule(const IRModule& mod, const Target& target,
const String& workload_name);
Expand All @@ -256,7 +256,7 @@ class DatabaseNode : public runtime::Object {
* \param mod The IRModule to be searched for.
* \param target The target to be searched for.
* \param workload_name The name of the workload to be searched for.
* \return The IRModule in the best IRModule of the given workload; NullOpt if not found.
* \return The IRModule in the best IRModule of the given workload; std::nullopt if not found.
*/
virtual Optional<IRModule> QueryIRModule(const IRModule& mod, const Target& target,
const String& workload_name);
Expand Down Expand Up @@ -330,7 +330,7 @@ class PyDatabaseNode : public DatabaseNode {
* \param mod The IRModule to be searched for.
* \param target The target to be searched for.
* \param workload_name The name of the workload to be searched for.
* \return The best record of the given workload; NullOpt if not found.
* \return The best record of the given workload; std::nullopt if not found.
*/
using FQueryTuningRecord =
ffi::TypedFunction<Optional<TuningRecord>(const IRModule&, const Target&, const String&)>;
Expand All @@ -339,7 +339,7 @@ class PyDatabaseNode : public DatabaseNode {
* \param mod The IRModule to be searched for.
* \param target The target to be searched for.
* \param workload_name The name of the workload to be searched for.
* \return The schedule in the best schedule of the given workload; NullOpt if not found.
* \return The schedule in the best schedule of the given workload; std::nullopt if not found.
*/
using FQuerySchedule =
ffi::TypedFunction<Optional<tir::Schedule>(const IRModule&, const Target&, const String&)>;
Expand All @@ -348,7 +348,7 @@ class PyDatabaseNode : public DatabaseNode {
* \param mod The IRModule to be searched for.
* \param target The target to be searched for.
* \param workload_name The name of the workload to be searched for.
* \return The IRModule in the best IRModule of the given workload; NullOpt if not found.
* \return The IRModule in the best IRModule of the given workload; std::nullopt if not found.
*/
using FQueryIRModule =
ffi::TypedFunction<Optional<IRModule>(const IRModule&, const Target&, const String&)>;
Expand Down
Loading
Loading