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
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions apps/hexagon_launcher/launcher_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ tvm::runtime::Module load_module(const std::string& file_name) {
return tvm::runtime::Module();
}

std::ostream& operator<<(std::ostream& os, const tvm::Array<tvm::String>& strings) {
std::ostream& operator<<(std::ostream& os, const tvm::ffi::Array<tvm::ffi::String>& strings) {
os << '[';
for (int i = 0, e = strings.size(); i != e; ++i) {
if (i != 0) os << ',';
Expand Down Expand Up @@ -191,7 +191,7 @@ tvm::runtime::Module create_graph_executor(const std::string& graph_json,

tvm::runtime::Module create_aot_executor(tvm::runtime::Module factory_module, tvm::Device device) {
tvm::ffi::Function list_modules = get_module_func(factory_module, "list_module_names");
tvm::Array<tvm::String> module_names = list_modules();
tvm::ffi::Array<tvm::ffi::String> module_names = list_modules();
if (module_names.size() != 1) {
LOG(WARNING) << __func__ << ": expecting single module, got: " << module_names << ", using "
<< module_names[0];
Expand Down
2 changes: 1 addition & 1 deletion apps/ios_rpc/tvmrpc/TVMRuntime.mm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void Init(const std::string& name) {
namespace refl = tvm::ffi::reflection;
refl::GlobalDef().def_packed("ffi.Module.load_from_file.dylib_custom",
[](ffi::PackedArgs args, ffi::Any* rv) {
auto n = make_object<UnsignedDSOLoader>();
auto n = ffi::make_object<UnsignedDSOLoader>();
n->Init(args[0]);
*rv = tvm::ffi::CreateLibraryModule(n);
});
Expand Down
32 changes: 16 additions & 16 deletions docs/arch/pass_infra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ needs to be executed when running under a user-provided optimization level. The
.. code:: c++

class PassInfoNode : public Object {
String name;
ffi::String name;
int opt_level;
Array<String> required;
ffi::Array<ffi::String> required;
};

PassContext
Expand Down Expand Up @@ -125,11 +125,11 @@ Python APIs to create a compilation pipeline using pass context.
class PassContextNode : public Object {
public:
int opt_level{2};
tvm::Array<tvm::Expr> required_pass;
tvm::Array<tvm::Expr> disabled_pass;
mutable Optional<DiagnosticContext> diag_ctx;
Map<String, Any> config;
Array<instrument::PassInstrument> instruments;
tvm::ffi::Array<tvm::Expr> required_pass;
tvm::ffi::Array<tvm::Expr> disabled_pass;
mutable ffi::Optional<DiagnosticContext> diag_ctx;
ffi::Map<ffi::String, Any> config;
ffi::Array<instrument::PassInstrument> instruments;
};

class PassContext : public NodeRef {
Expand Down Expand Up @@ -262,7 +262,7 @@ of passes for execution.
class SequentialPassNode : PassNode {
PassInfo pass_info;
// Passes need to be executed.
Array<Pass> passes;
ffi::Array<Pass> passes;
bool PassEnabled(const PassInfo& info) const;
Module operator()(const Module& mod, const PassContext& pass_ctx) const final;
};
Expand Down Expand Up @@ -321,22 +321,22 @@ favorably use Python APIs to create a specific pass object.
Pass CreateFunctionPass(
std::function<Function(Function, IRModule, PassContext)> pass_func,
int opt_level,
String name,
Array<String> required);
ffi::String name,
ffi::Array<ffi::String> required);

Pass CreatePrimFuncPass(
std::function<PrimFunc(PrimFunc, IRModule, PassContext)> pass_func,
int opt_level,
String name,
Array<String> required);
ffi::String name,
ffi::Array<ffi::String> required);

Pass CreateModulePass(
std::function<IRModule(IRModule, PassContext)> pass_func,
int opt_level,
String name,
Array<String> required);
ffi::String name,
ffi::Array<ffi::String> required);

Pass Sequential(tvm::Array<Pass> passes, PassInfo pass_info);
Pass Sequential(tvm::ffi::Array<Pass> passes, PassInfo pass_info);

Pass Registration
^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -440,7 +440,7 @@ Multiple ``PassInstrument`` instances can be registed into a single

class PassInstrumentNode : public Object {
public:
String name;
ffi::String name;
virtual void EnterPassContext() const = 0;
virtual void ExitPassContext() const = 0;
virtual bool ShouldRun(const IRModule& mod, const transform::PassInfo& info) const = 0;
Expand Down
3 changes: 0 additions & 3 deletions ffi/include/tvm/ffi/cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,5 @@ inline ObjectPtr<BaseType> GetObjectPtr(ObjectType* ptr) {
return details::ObjectUnsafe::ObjectPtrFromUnowned<BaseType>(ptr);
}
} // namespace ffi

using ffi::GetObjectPtr;
using ffi::GetRef;
} // namespace tvm
#endif // TVM_FFI_CAST_H_
2 changes: 0 additions & 2 deletions ffi/include/tvm/ffi/container/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,5 @@ inline constexpr bool type_contains_v<Array<T>, Array<U>> = type_contains_v<T, U
} // namespace details

} // namespace ffi

using ffi::Array;
} // namespace tvm
#endif // TVM_FFI_CONTAINER_ARRAY_H_
2 changes: 0 additions & 2 deletions ffi/include/tvm/ffi/container/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,5 @@ inline constexpr bool type_contains_v<Map<K, V>, Map<KU, VU>> =
} // namespace details

} // namespace ffi

using ffi::Map;
} // namespace tvm
#endif // TVM_FFI_CONTAINER_MAP_H_
2 changes: 0 additions & 2 deletions ffi/include/tvm/ffi/container/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,5 @@ template <typename... V, typename T>
inline constexpr bool type_contains_v<Variant<V...>, T> = (type_contains_v<V, T> || ...);
} // namespace details
} // namespace ffi

using ffi::Variant;
} // namespace tvm
#endif // TVM_FFI_CONTAINER_VARIANT_H_
2 changes: 0 additions & 2 deletions ffi/include/tvm/ffi/dtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ namespace ffi {
* \brief Extension code beyond the DLDataType.
*
* This class is always consistent with the DLPack.
*
* TODO(tvm-team): update to latest DLPack types.
*/
enum DLExtDataTypeCode { kDLExtCustomBegin = 129 };

Expand Down
2 changes: 0 additions & 2 deletions ffi/include/tvm/ffi/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,5 @@ inline ObjectPtr<ArrayType> make_inplace_array_object(size_t num_elems, Args&&..
}

} // namespace ffi

using ffi::make_object;
} // namespace tvm
#endif // TVM_FFI_MEMORY_H_
2 changes: 0 additions & 2 deletions ffi/include/tvm/ffi/optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,5 @@ class Optional<T, std::enable_if_t<use_ptr_based_optional_v<T>>> : public Object
}
};
} // namespace ffi

using ffi::Optional;
} // namespace tvm
#endif // TVM_FFI_OPTIONAL_H_
3 changes: 0 additions & 3 deletions ffi/include/tvm/ffi/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -993,9 +993,6 @@ inline std::ostream& operator<<(std::ostream& out, const String& input) {
}
/// \endcond
} // namespace ffi

using ffi::Bytes;
using ffi::String;
} // namespace tvm

/// \cond Doxygen_Suppress
Expand Down
4 changes: 2 additions & 2 deletions include/tvm/arith/analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ class IntSetAnalyzer {
* \param dom_map The domain map to indicate which variable to relax.
* \return the result of the analysis.
*/
TVM_DLL IntSet operator()(const PrimExpr& expr, const Map<Var, IntSet>& dom_map);
TVM_DLL IntSet operator()(const PrimExpr& expr, const ffi::Map<Var, IntSet>& dom_map);

/*!
* \brief Find a symbolic integer set that contains all possible
Expand Down Expand Up @@ -704,7 +704,7 @@ class TVM_DLL Analyzer {
* expression. This option should not be used if there is any dependency
* between variables.
*/
void Bind(const Map<Var, Range>& variables, bool allow_override = false);
void Bind(const ffi::Map<Var, Range>& variables, bool allow_override = false);
/*!
* \brief Whether can we prove expr >= val.

Expand Down
4 changes: 2 additions & 2 deletions include/tvm/arith/bound.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ using tir::VarNode;
* The deduce bound must implies e for all value in relax_map
* \return An integer set that always satisfies the condition.
*/
IntSet DeduceBound(PrimExpr v, PrimExpr cond, const Map<Var, IntSet>& hint_map,
const Map<Var, IntSet>& relax_map);
IntSet DeduceBound(PrimExpr v, PrimExpr cond, const ffi::Map<Var, IntSet>& hint_map,
const ffi::Map<Var, IntSet>& relax_map);
/*!
* \brief Same as DeduceBound with unordered_map signature.
*
Expand Down
48 changes: 23 additions & 25 deletions include/tvm/arith/int_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ class IntSet : public ObjectRef {
// Integer set legacy API.
//------------------------------------------------
/*!
* \brief Convert std::unordered_map<const VarNode*, IntSet> to Map<Var, IntSet>
* \brief Convert std::unordered_map<const VarNode*, IntSet> to ffi::Map<Var, IntSet>
*
* \param dom_map The domain map to convert.
* \return The converted map.
*/
Map<Var, IntSet> ConvertDomMap(const std::unordered_map<const VarNode*, IntSet>& dom_map);
ffi::Map<Var, IntSet> ConvertDomMap(const std::unordered_map<const VarNode*, IntSet>& dom_map);
/*!
* \brief Find an symbolic integer set that contains all possible values of
* e given the domain of each iteration variables.
Expand All @@ -184,7 +184,7 @@ Map<Var, IntSet> ConvertDomMap(const std::unordered_map<const VarNode*, IntSet>&
* \param dom_map The domain of each variable.
* \return An integer set that can cover all the possible values of e.
*/
IntSet EvalSet(PrimExpr e, const Map<IterVar, IntSet>& dom_map);
IntSet EvalSet(PrimExpr e, const ffi::Map<IterVar, IntSet>& dom_map);
/*!
* \brief Find an symbolic integer set that contains all possible values of
* e given the domain of each variables.
Expand All @@ -193,7 +193,7 @@ IntSet EvalSet(PrimExpr e, const Map<IterVar, IntSet>& dom_map);
* \param dom_map The domain of each variable.
* \return An integer set that can cover all the possible values of e.
*/
IntSet EvalSet(PrimExpr e, const Map<Var, IntSet>& dom_map);
IntSet EvalSet(PrimExpr e, const ffi::Map<Var, IntSet>& dom_map);
/*!
* \brief Same as EvalSet, but takes unordered_map
*
Expand All @@ -210,7 +210,7 @@ IntSet EvalSet(PrimExpr e, const std::unordered_map<const tir::VarNode*, IntSet>
* \param dom_map The domain of each variable.
* \return An integer set that can cover all the possible values.
*/
IntSet EvalSet(Range r, const Map<IterVar, IntSet>& dom_map);
IntSet EvalSet(Range r, const ffi::Map<IterVar, IntSet>& dom_map);

/*!
* \brief Find an symbolic integer set that contains is union over
Expand All @@ -230,13 +230,13 @@ IntSet EvalSet(IntSet s, const std::unordered_map<const VarNode*, IntSet>& dom_m
*/
IntSet EvalSet(Range r, const std::unordered_map<const VarNode*, IntSet>& dom_map);
/*!
* \brief Same as EvalSet, but takes Array<Range>
* \brief Same as EvalSet, but takes ffi::Array<Range>
*
* \param region The range to be evaluated.
* \param dom_map The domain of each variable.
* \return An array of integer sets that can cover all the possible values.
*/
Array<IntSet> EvalSet(const Array<Range>& region, const Map<Var, IntSet>& dom_map);
ffi::Array<IntSet> EvalSet(const ffi::Array<Range>& region, const ffi::Map<Var, IntSet>& dom_map);
/*! \brief Map from Expr to IntSet */
using ExprIntSetMap = std::unordered_map<PrimExpr, IntSet, ObjectPtrHash, ObjectPtrEqual>;
/*!
Expand All @@ -255,42 +255,42 @@ ExprIntSetMap EvalSetForEachSubExpr(PrimExpr e,
* \param sets The sets to be combined
* \return the set after union
*/
IntSet Union(const Array<IntSet>& sets);
IntSet Union(const ffi::Array<IntSet>& sets);

/*!
* \brief The union of N-dimensional integer sets
* \param nd_int_sets A list of N-dimensional integer sets
* \return An N-dimensional integer set as the result of union
*/
Array<IntSet> UnionRegion(const Array<Array<IntSet>>& nd_int_sets);
ffi::Array<IntSet> UnionRegion(const ffi::Array<ffi::Array<IntSet>>& nd_int_sets);

/*!
* \brief Create a lower-bound of union set, where some of the segments may be dropped
* \param sets The sets to be combined
* \return the set after union
*/
IntSet UnionLowerBound(const Array<IntSet>& sets);
IntSet UnionLowerBound(const ffi::Array<IntSet>& sets);

/*!
* \brief The union of N-dimensional integer sets
* \param nd_int_sets A list of N-dimensional integer sets
* \return An N-dimensional integer set as the result of union
*/
Array<IntSet> UnionRegionLowerBound(const Array<Array<IntSet>>& nd_int_sets);
ffi::Array<IntSet> UnionRegionLowerBound(const ffi::Array<ffi::Array<IntSet>>& nd_int_sets);

/*!
* \brief Create an intersected set of all sets
* \param sets The sets to be intersected
* \return the set after intersected
*/
IntSet Intersect(const Array<IntSet>& sets);
IntSet Intersect(const ffi::Array<IntSet>& sets);

/*!
* \brief Converts the Ranges to IntSets
* \param var_dom The ranges of variables
* \return The integer sets of the variables
*/
Map<Var, arith::IntSet> AsIntSet(const Map<Var, Range>& var_dom);
ffi::Map<Var, arith::IntSet> AsIntSet(const ffi::Map<Var, Range>& var_dom);

/*!
* \brief Analyze the region with affine map, given the domain of variables and their predicate.
Expand All @@ -302,10 +302,9 @@ Map<Var, arith::IntSet> AsIntSet(const Map<Var, Range>& var_dom);
* \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,
const PrimExpr& predicate,
arith::Analyzer* analyzer);
TVM_DLL ffi::Optional<ffi::Array<IntSet>> EstimateRegionStrictBound(
const ffi::Array<Range>& region, const ffi::Map<Var, Range>& var_dom, const PrimExpr& predicate,
arith::Analyzer* analyzer);

/*!
* \brief Analyze the region with affine map, given the domain of variables and their predicate.
Expand All @@ -317,10 +316,9 @@ TVM_DLL Optional<Array<IntSet>> EstimateRegionStrictBound(const Array<Range>& re
* \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,
const PrimExpr& predicate,
arith::Analyzer* analyzer);
TVM_DLL ffi::Optional<ffi::Array<IntSet>> EstimateRegionLowerBound(
const ffi::Array<Range>& region, const ffi::Map<Var, Range>& var_dom, const PrimExpr& predicate,
arith::Analyzer* analyzer);

/*!
* \brief Analyze the region with affine map, given the domain of variables and their predicate
Expand All @@ -332,10 +330,10 @@ TVM_DLL Optional<Array<IntSet>> EstimateRegionLowerBound(const Array<Range>& reg
* \param analyzer The analyzer used
* \return an array of arith::IntSet as the result of analysis
*/
TVM_DLL Array<IntSet> EstimateRegionUpperBound(const Array<Range>& region,
const Map<Var, Range>& var_dom,
const PrimExpr& predicate,
arith::Analyzer* analyzer);
TVM_DLL ffi::Array<IntSet> EstimateRegionUpperBound(const ffi::Array<Range>& region,
const ffi::Map<Var, Range>& var_dom,
const PrimExpr& predicate,
arith::Analyzer* analyzer);

} // namespace arith
} // namespace tvm
Expand Down
Loading
Loading