diff --git a/CMakeLists.txt b/CMakeLists.txt
index a61367ef72af9da3c57b656c87ed13a8903a901f..736a371870cfb160674cd1d8d90c50ffa26008a8 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 c778df1967b102d5435bf9cebb2bc6c4ea18025b..28ddbd09d61d459385c8cf1104bb2a066efb2770 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 0d5064dcff00ad7ad6446dc75c9fe93a54562c3d..4147f89d703224ab53808cf52be425459fe59ab5 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 161f827f69b4c37f8540e0ff853ffc4a0326c62f..182c5503d4548a2fd0b389325d1c7287e7e06245 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 5b279c53d49913c6d966841386c3c5b8e09a2a06..ad07d401ea74913ce0f62696d01346eb7fa669d3 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 40991e2ca047791f6cd0d40c1653c2446bf86270..38bd5f86fd68ce109e2046c23affa94988567ce2 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 08288c91c7bdb372f2f39f60f258f292c29aba91..4fddeb32856609c6ce0c3128f1e32a390dd8b184 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) {