From be1a29edb2080864ab1d3bc7d64d9b907a67d1e9 Mon Sep 17 00:00:00 2001 From: Tianqi Chen <tqchen@users.noreply.github.com> Date: Sat, 6 May 2017 19:48:10 -0700 Subject: [PATCH] [CMAKE] Windows support upgrade (#125) * [CMAKE] Windows support upgrade * Fix lint --- CMakeLists.txt | 2 ++ include/tvm/runtime/c_runtime_api.h | 2 +- include/tvm/runtime/packed_func.h | 5 +++-- python/tvm/contrib/nvcc_compiler.py | 2 +- src/codegen/codegen_c.cc | 2 +- src/pass/split_pipeline.cc | 2 +- src/runtime/c_runtime_api.cc | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a61367ef7..736a37187 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ tvm_source_group("Source\\codegen" GLOB "src/codegen/*.cc") tvm_source_group("Source\\codegen\\llvm" GLOB "src/codegen/llvm/*.cc") tvm_source_group("Source\\codegen\\stack_vm" GLOB "src/codegen/stack_vm/*.cc") tvm_source_group("Source\\pass" GLOB "src/pass/*.cc") +tvm_source_group("Source\\op" GLOB "src/op/*.cc") tvm_source_group("Source\\runtime" GLOB "src/runtime/*.cc") tvm_source_group("Source\\runtime\\cuda" GLOB "src/runtime/cuda/*.cc") tvm_source_group("Source\\runtime\\opencl" GLOB "src/runtime/opencl/*.cc") @@ -66,6 +67,7 @@ file(GLOB COMPILER_SRCS src/codegen/stack_vm/*.cc src/lang/*.cc src/pass/*.cc + src/op/*.cc src/schedule/*.cc ) file(GLOB_RECURSE HALIDEIR_SRCS HalideIR/src/*.cpp) diff --git a/include/tvm/runtime/c_runtime_api.h b/include/tvm/runtime/c_runtime_api.h index c778df196..28ddbd09d 100644 --- a/include/tvm/runtime/c_runtime_api.h +++ b/include/tvm/runtime/c_runtime_api.h @@ -375,7 +375,7 @@ TVM_DLL int TVMFuncListGlobalNames(int *out_size, * \return 0 when success, -1 when failure happens */ TVM_DLL int TVMArrayAlloc(const tvm_index_t* shape, - tvm_index_t ndim, + int ndim, TVMType dtype, TVMContext ctx, TVMArrayHandle* out); diff --git a/include/tvm/runtime/packed_func.h b/include/tvm/runtime/packed_func.h index 0d5064dcf..4147f89d7 100644 --- a/include/tvm/runtime/packed_func.h +++ b/include/tvm/runtime/packed_func.h @@ -716,8 +716,9 @@ template<typename... Args> inline TVMRetValue PackedFunc::operator()(Args&& ...args) const { auto targs = std::make_tuple(std::forward<Args>(args)...); const int kNumArgs = sizeof...(Args); - TVMValue values[kNumArgs]; - int type_codes[kNumArgs]; + const int kArraySize = kNumArgs > 0 ? kNumArgs : 1; + TVMValue values[kArraySize]; + int type_codes[kArraySize]; for_each(targs, TVMArgsSetter(values, type_codes)); TVMRetValue rv; body_(TVMArgs(values, type_codes, kNumArgs), &rv); diff --git a/python/tvm/contrib/nvcc_compiler.py b/python/tvm/contrib/nvcc_compiler.py index 161f827f6..182c5503d 100644 --- a/python/tvm/contrib/nvcc_compiler.py +++ b/python/tvm/contrib/nvcc_compiler.py @@ -63,7 +63,7 @@ def compile_source(code, target="ptx", arch=None, if proc.returncode != 0: sys.stderr.write("Compilation error:\n") - sys.stderr.write(out) + sys.stderr.write(str(out)) sys.stderr.flush() cubin = None else: diff --git a/src/codegen/codegen_c.cc b/src/codegen/codegen_c.cc index 5b279c53d..ad07d401e 100644 --- a/src/codegen/codegen_c.cc +++ b/src/codegen/codegen_c.cc @@ -95,7 +95,7 @@ std::string CodeGenC::GetBufferRef( if (alloc_storage_scope_.count(buffer)) { scope = alloc_storage_scope_.at(buffer); } - bool is_vol = volatile_buf_.count(buffer); + bool is_vol = volatile_buf_.count(buffer) != 0; if (t.lanes() == 1) { if (!HandleTypeMatch(buffer, t) || is_vol) { os << "(("; diff --git a/src/pass/split_pipeline.cc b/src/pass/split_pipeline.cc index 40991e2ca..38bd5f86f 100644 --- a/src/pass/split_pipeline.cc +++ b/src/pass/split_pipeline.cc @@ -199,7 +199,7 @@ class StageSplitter : public IRMutator { private: // Build the stage. Stmt BuildStage(Stmt body, NodeRef target) { - int stage_index = static_cast<size_t>(stages_.size()); + int stage_index = static_cast<int>(stages_.size()); std::string stage_suffix = "." + std::to_string(stage_index); // The Substitute Map<Var, Expr> subst; diff --git a/src/runtime/c_runtime_api.cc b/src/runtime/c_runtime_api.cc index 08288c91c..4fddeb328 100644 --- a/src/runtime/c_runtime_api.cc +++ b/src/runtime/c_runtime_api.cc @@ -310,7 +310,7 @@ int TVMFuncCreateFromCFunc(TVMPackedCFunc func, } int TVMArrayAlloc(const tvm_index_t* shape, - tvm_index_t ndim, + int ndim, TVMType dtype, TVMContext ctx, TVMArrayHandle* out) { -- GitLab