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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-DTVM_EXPORTS)
add_definitions(-DHalide_SHARED)
add_definitions(-DHalide_EXPORTS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj")
Expand Down
2 changes: 1 addition & 1 deletion HalideIR
Submodule HalideIR updated 1 files
+2 −2 src/tvm/node.h
34 changes: 17 additions & 17 deletions include/tvm/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Buffer : public NodeRef {
* but always add stride field.
* \return The strided version of the buffer.
*/
Buffer MakeStrideView() const;
TVM_DLL Buffer MakeStrideView() const;
/*!
* \brief Make a new symbolic buffer representing a slice of the buffer.
* \param begins The beginning position of each dimension.
Expand All @@ -46,25 +46,25 @@ class Buffer : public NodeRef {
* If stride is not needed in the slice, it won't be presented
* \return the result buffer.
*/
Buffer MakeSlice(Array<Expr> begins, Array<Expr> extents) const;
TVM_DLL Buffer MakeSlice(Array<Expr> begins, Array<Expr> extents) const;
/*!
* \brief Get access ptr to the entire buffer.
* \param access_mask The access mask
* \param ptr_type The type of the pointer.
*/
Expr access_ptr(int access_mask, Type ptr_type = Handle()) const;
TVM_DLL Expr access_ptr(int access_mask, Type ptr_type = Handle()) const;
/*!
* \brief Create an Expr that does a vector load at begin index.
* \param begin The beginning index
* \param dtype The data type to be loaded.
*/
Expr vload(Array<Expr> begin, Type dtype) const;
TVM_DLL Expr vload(Array<Expr> begin, Type dtype) const;
/*!
* \brief Create a Stmt that does a vector store at begin index.
* \param begin The beginning index
* \param value The value to be stored.
*/
Stmt vstore(Array<Expr> begin, Expr value) const;
TVM_DLL Stmt vstore(Array<Expr> begin, Expr value) const;
/*!
* \brief access the internal node container
* \return the pointer to the internal node container
Expand Down Expand Up @@ -124,15 +124,15 @@ class BufferNode : public Node {

// User can specify data_alignment and offset_factor to be 0
// A default value will be picked.
static Buffer make(Var ptr,
Type dtype,
Array<Expr> shape,
Array<Expr> strides,
Expr byte_offset,
std::string name,
std::string scope,
int data_alignment,
int offset_factor);
TVM_DLL static Buffer make(Var ptr,
Type dtype,
Array<Expr> shape,
Array<Expr> strides,
Expr byte_offset,
std::string name,
std::string scope,
int data_alignment,
int offset_factor);

static constexpr const char* _type_key = "Buffer";
TVM_DECLARE_NODE_TYPE_INFO(BufferNode, Node);
Expand All @@ -150,8 +150,8 @@ inline const BufferNode* Buffer::operator->() const {
* \return The created buffer.
* \sa BufferNode::make for complete constructor.
*/
Buffer decl_buffer(Array<Expr> shape,
Type dtype = Float(32),
std::string name = "buffer");
TVM_DLL Buffer decl_buffer(Array<Expr> shape,
Type dtype = Float(32),
std::string name = "buffer");
} // namespace tvm
#endif // TVM_BUFFER_H_
16 changes: 8 additions & 8 deletions include/tvm/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ class Range : public Halide::IR::Range {
* \param begin The begin of the range.
* \param end The end of the range.
*/
Range(Expr begin, Expr end);
TVM_DLL Range(Expr begin, Expr end);

static Range make_by_min_extent(Expr min, Expr extent);
TVM_DLL static Range make_by_min_extent(Expr min, Expr extent);
};

/*!
Expand Down Expand Up @@ -216,20 +216,20 @@ class IterVar : public NodeRef {
* \param dom Optional, domain of the thread axis.
* \param tag The thread tag of the axis.
*/
IterVar thread_axis(Range dom, std::string tag);
TVM_DLL IterVar thread_axis(Range dom, std::string tag);

/*!
* \brief Create a new IterVar for reduction operations.
*
* \param dom The domain of the reduction axis.
* \param name The name of the reduction axis.
*/
IterVar reduce_axis(Range dom, std::string name = "rv");
TVM_DLL IterVar reduce_axis(Range dom, std::string name = "rv");

using Domain = Array<Range>;

// print functions for expr
std::ostream& operator<<(std::ostream& os, const NodeRef& n); // NOLINT(*)
TVM_DLL std::ostream& operator<<(std::ostream& os, const NodeRef& n); // NOLINT(*)
// definition of Node.
/*!
* \brief An iteration variable representing an iteration
Expand Down Expand Up @@ -259,9 +259,9 @@ class IterVarNode : public Node {
v->Visit("thread_tag", &thread_tag);
}

static IterVar make(Range dom, Var var,
IterVarType iter_type,
std::string thread_tag = "");
TVM_DLL static IterVar make(Range dom, Var var,
IterVarType iter_type,
std::string thread_tag = "");

static constexpr const char* _type_key = "IterVar";
TVM_DECLARE_NODE_TYPE_INFO(IterVarNode, Node);
Expand Down
14 changes: 7 additions & 7 deletions include/tvm/ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ struct CommReducerNode : public Node {
/*! \brief Function call operator to combine a and b */
Array<Expr> operator()(Array<Expr> a, Array<Expr> b) const;
/*! \brief construct CommReducer from args, result and identity_element */
static CommReducer make(Array<Var> lhs, Array<Var> rhs,
Array<Expr> result, Array<Expr> identity_element);
TVM_DLL static CommReducer make(Array<Var> lhs, Array<Var> rhs,
Array<Expr> result, Array<Expr> identity_element);

void VisitAttrs(AttrVisitor* v) final {
v->Visit("lhs", &lhs);
Expand Down Expand Up @@ -100,11 +100,11 @@ struct Reduce : public ExprNode<Reduce> {
int value_index;

/*! \brief construct expr from op and rdom */
static Expr make(CommReducer combiner,
Array<Expr> src,
Array<IterVar> rdom,
Expr condition,
int value_index);
TVM_DLL static Expr make(CommReducer combiner,
Array<Expr> src,
Array<IterVar> rdom,
Expr condition,
int value_index);

void VisitAttrs(AttrVisitor* v) final {
v->Visit("dtype", &type);
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir_mutator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace ir {
* Simply following the same pattern as IRMutator and create a seperate class.
* \sa IRFunctor
*/
class IRMutator {
class TVM_DLL IRMutator {
public:
/*!
* \brief mutate expression
Expand Down
6 changes: 3 additions & 3 deletions include/tvm/ir_operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ using Halide::select;
* \param source The source expression.
* \param axis List of iteration variables that will be used for reduction.
*/
Expr sum(Expr source, Array<IterVar> axis);
TVM_DLL Expr sum(Expr source, Array<IterVar> axis);

/*!
* \brief max of of source expression over axis
* \param source The source expression.
* \param axis List of iteration variables that will be used for reduction.
*/
Expr max(Expr source, Array<IterVar> axis);
TVM_DLL Expr max(Expr source, Array<IterVar> axis);

/*!
* \brief max of of source expression over axis
* \param source The source expression.
* \param axis List of iteration variables that will be used for reduction.
*/
Expr min(Expr source, Array<IterVar> axis);
TVM_DLL Expr min(Expr source, Array<IterVar> axis);

// Unary intrinsic operators
#define TVM_DECLARE_INTRIN_UNARY(OpName) \
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir_visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace ir {
*
* \endcode
*/
class IRVisitor {
class TVM_DLL IRVisitor {
public:
/*!
* \brief recursively visit an IR node
Expand Down
34 changes: 17 additions & 17 deletions include/tvm/operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ using FBatchCompute = std::function<Array<Expr> (const Array<Var>& i)>;
* \param dtype the data type of the tensor.
* \param name The name of the Tensor.
*/
Tensor placeholder(Array<Expr> shape,
Type dtype = Float(32),
std::string name = "placeholder");
TVM_DLL Tensor placeholder(Array<Expr> shape,
Type dtype = Float(32),
std::string name = "placeholder");

/*!
* \brief Construct a new tensor by computing over shape,
Expand All @@ -388,10 +388,10 @@ Tensor placeholder(Array<Expr> shape,
* \param name The optional name of the tensor.
* \param tag The optional tag of the tensor.
*/
Tensor compute(Array<Expr> shape,
FCompute fcompute,
std::string name = "tensor",
std::string tag = "");
TVM_DLL Tensor compute(Array<Expr> shape,
FCompute fcompute,
std::string name = "tensor",
std::string tag = "");

/*!
* \brief Construct a new tensor by computing over shape,
Expand All @@ -401,10 +401,10 @@ Tensor compute(Array<Expr> shape,
* \param name The optional name of the tensor.
* \param tag The optional tag of the tensor.
*/
Array<Tensor> compute(Array<Expr> shape,
FBatchCompute fcompute,
std::string name = "tensor",
std::string tag = "");
TVM_DLL Array<Tensor> compute(Array<Expr> shape,
FBatchCompute fcompute,
std::string name = "tensor",
std::string tag = "");

/*!
* \brief Construct new tensors by scan.
Expand All @@ -417,12 +417,12 @@ Array<Tensor> compute(Array<Expr> shape,
* \param name The optional name of the tensor.
* \param tag The optional tag of the tensor.
*/
Array<Tensor> scan(Array<Tensor> init,
Array<Tensor> update,
Array<Tensor> state_placeholder,
Array<Tensor> inputs = Array<Tensor>(),
std::string name = "scan",
std::string tag = "");
TVM_DLL Array<Tensor> scan(Array<Tensor> init,
Array<Tensor> update,
Array<Tensor> state_placeholder,
Array<Tensor> inputs = Array<Tensor>(),
std::string name = "scan",
std::string tag = "");

// same as compute, specialized for different fcompute function
inline Tensor compute(Array<Expr> shape,
Expand Down
6 changes: 3 additions & 3 deletions include/tvm/runtime/device_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,21 @@ class DeviceAPI {
* \param ctx The context of allocation.
* \param size The size to be allocated.
*/
virtual void* AllocWorkspace(TVMContext ctx, size_t size);
TVM_DLL virtual void* AllocWorkspace(TVMContext ctx, size_t size);
/*!
* \brief Free temporal workspace in backend execution.
*
* \param ctx The context of allocation.
* \param ptr The pointer to be freed.
*/
virtual void FreeWorkspace(TVMContext ctx, void* ptr);
TVM_DLL virtual void FreeWorkspace(TVMContext ctx, void* ptr);
/*!
* \brief Get device API base don context.
* \param ctx The context
* \param allow_missing Whether allow missing
* \return The corresponding device API.
*/
static DeviceAPI* Get(TVMContext ctx, bool allow_missing = false);
TVM_DLL static DeviceAPI* Get(TVMContext ctx, bool allow_missing = false);
};

/*! \brief The device type bigger than this is RPC device */
Expand Down
14 changes: 7 additions & 7 deletions include/tvm/runtime/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@ class Module {
* \return The result function.
* This function will return PackedFunc(nullptr) if function do not exist.
*/
PackedFunc GetFunction(const std::string& name, bool query_imports = false);
TVM_DLL PackedFunc GetFunction(const std::string& name, bool query_imports = false);
/*!
* \brief Import another module into this module.
* \param other The module to be imported.
*
* \note Cyclic dependency is not allowed among modules,
* An error will be thrown when cyclic dependency is detected.
*/
void Import(Module other);
TVM_DLL void Import(Module other);
/*!
* \brief Load a module from file.
* \param file_name The name of the host function module.
* \param format The format of the file.
* \note This function won't load the import relationship.
* Re-create import relationship by calling Import.
*/
static Module LoadFromFile(const std::string& file_name,
const std::string& format = "");
TVM_DLL static Module LoadFromFile(const std::string& file_name,
const std::string& format = "");
/*! \return internal container */
inline ModuleNode* operator->();
/*! \return internal container */
Expand Down Expand Up @@ -110,21 +110,21 @@ class ModuleNode {
* but not necessarily host modules.
* We can use this to do AOT loading of bundled device functions.
*/
virtual void SaveToBinary(dmlc::Stream* stream);
TVM_DLL virtual void SaveToBinary(dmlc::Stream* stream);
/*!
* \brief Get the source code of module, when available.
* \param format Format of the source code, can be empty by default.
* \return Possible source code when available.
*/
virtual std::string GetSource(const std::string& format = "");
TVM_DLL virtual std::string GetSource(const std::string& format = "");
/*!
* \brief Get a function from current environment
* The environment includes all the imports as well as Global functions.
*
* \param name name of the function.
* \return The corresponding function.
*/
const PackedFunc* GetFuncFromEnv(const std::string& name);
TVM_DLL const PackedFunc* GetFuncFromEnv(const std::string& name);
/*! \return The module it imports from */
const std::vector<Module>& imports() const {
return imports_;
Expand Down
4 changes: 2 additions & 2 deletions include/tvm/runtime/packed_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ class ExtTypeVTable {
* \param type_code The type code
* \return The registered vtable.
*/
static ExtTypeVTable* Get(int type_code);
TVM_DLL static ExtTypeVTable* Get(int type_code);

private:
// Internal registration function.
static ExtTypeVTable* RegisterInternal(int type_code, const ExtTypeVTable& vt);
TVM_DLL static ExtTypeVTable* RegisterInternal(int type_code, const ExtTypeVTable& vt);
};

/*!
Expand Down
Loading