From 21ece7526aba6a7018103034325e20fc099f7364 Mon Sep 17 00:00:00 2001
From: Tianqi Chen <tqchen@users.noreply.github.com>
Date: Sun, 17 Jun 2018 12:07:11 -0700
Subject: [PATCH] [DOCS] Improve review guide, improve cmake llvm build (#1295)

---
 CODEOWNERS => .github/CODEOWNERS |  0
 .github/PULL_REQUEST_TEMPLATE.md |  2 +-
 cmake/util/FindLLVM.cmake        | 13 ++++++++++---
 docs/contribute/code_review.rst  | 16 +++++++++++++---
 docs/index.rst                   |  1 +
 docs/langref/index.rst           |  4 ++++
 tutorials/topi/README.txt        |  3 ++-
 7 files changed, 31 insertions(+), 8 deletions(-)
 rename CODEOWNERS => .github/CODEOWNERS (100%)
 create mode 100644 docs/langref/index.rst

diff --git a/CODEOWNERS b/.github/CODEOWNERS
similarity index 100%
rename from CODEOWNERS
rename to .github/CODEOWNERS
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 80742414c..313b776b0 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1 +1 @@
-Thanks for contributing to TVM!   Please refer to guideline http://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from others in the community.
+Thanks for contributing to TVM!   Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from others in the community.
diff --git a/cmake/util/FindLLVM.cmake b/cmake/util/FindLLVM.cmake
index 3396edc7d..c155a34fa 100644
--- a/cmake/util/FindLLVM.cmake
+++ b/cmake/util/FindLLVM.cmake
@@ -23,8 +23,6 @@ macro(find_llvm use_llvm)
   elseif(NOT LLVM_CONFIG STREQUAL "OFF")
     # use llvm config
     message(STATUS "Use llvm-config=" ${LLVM_CONFIG})
-    execute_process(COMMAND ${LLVM_CONFIG} --includedir
-      OUTPUT_VARIABLE LLVM_INCLUDE_DIRS)
     execute_process(COMMAND ${LLVM_CONFIG} --libfiles
       OUTPUT_VARIABLE __llvm_libfiles)
     execute_process(COMMAND ${LLVM_CONFIG} --system-libs
@@ -34,12 +32,21 @@ macro(find_llvm use_llvm)
     execute_process(COMMAND ${LLVM_CONFIG} --version
       COMMAND cut -b 1,3
       OUTPUT_VARIABLE TVM_LLVM_VERSION)
+    # definitions
     string(REGEX MATCHALL "(^| )-D[A-Za-z0-9_]*" LLVM_DEFINITIONS ${__llvm_cxxflags})
+    # include dir
+    string(REGEX MATCHALL "(^| )-I[A-Za-z0-9_/.\-]*" __llvm_include_flags ${__llvm_cxxflags})
+    set(LLVM_INCLUDE_DIRS "")
+    foreach(__flag IN ITEMS ${__llvm_include_flags})
+      string(REGEX REPLACE "(^| )-I" "" __dir "${__flag}")
+      list(APPEND LLVM_INCLUDE_DIRS "${__dir}")
+    endforeach()
+    message(STATUS ${LLVM_INCLUDE_DIRS})
+    # libfiles
     string(STRIP ${__llvm_libfiles} __llvm_libfiles)
     string(STRIP ${__llvm_system_libs} __llvm_system_libs)
     set(LLVM_LIBS "${__llvm_libfiles} ${__llvm_system_libs}")
     separate_arguments(LLVM_LIBS)
-    string(STRIP ${LLVM_INCLUDE_DIRS} LLVM_INCLUDE_DIRS)
     string(STRIP ${TVM_LLVM_VERSION} TVM_LLVM_VERSION)
   endif()
 endmacro(find_llvm)
diff --git a/docs/contribute/code_review.rst b/docs/contribute/code_review.rst
index b6dea5300..344296932 100644
--- a/docs/contribute/code_review.rst
+++ b/docs/contribute/code_review.rst
@@ -7,6 +7,7 @@ Open source code is maintained by a community with diverse backend, and it is ev
 
 Here are some checklists for code reviews, it is also helpful reference for contributors
 
+
 Hold the Highest Standard
 -------------------------
 The first rule for code reviewers is to always keep the highest standard, and do not approve code just to "be friendly". Good, informative critics each other learn and prevents technical debt in early stages.
@@ -46,8 +47,17 @@ Respect each other
 ------------------
 The code reviewers and contributors are paying the most precious currencies in the world -- time. We are volunteers in the community to spend the time to build good code, help each other, learn and have fun hacking.
 
-Approve Changes
----------------
+Learn from other Code Reviews
+-----------------------------
+There can be multiple reviewers reviewing the same changes. Many cases other reviewers
+may spot things you did not find. Try to learn from other code reviews,
+when possible, document these lessons.
+
+Approve and Request Changes Explicitly
+--------------------------------------
 The contributor and code owner can request code reviews from multiple reviewers.
-Code owner can decide if the code can be merged in case by case if some of the reviewers did not respond in time(e.g. a week) and existing reviews are sufficient. 
 Remember to approve changes when your comments are addressed in a code review.
+To do so -- please click on changes tab in the pull request, then select approve,
+or comment on the code and click request changes.
+Code owner can decide if the code can be merged in case by case if some of the reviewers
+did not respond in time(e.g. a week) and existing reviews are sufficient.
diff --git a/docs/index.rst b/docs/index.rst
index f46775d15..e3e7f4804 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -17,6 +17,7 @@ API Reference
 .. toctree::
    :maxdepth: 2
 
+   langref/index
    api/python/index
    api_links
 
diff --git a/docs/langref/index.rst b/docs/langref/index.rst
new file mode 100644
index 000000000..dc51c3172
--- /dev/null
+++ b/docs/langref/index.rst
@@ -0,0 +1,4 @@
+Language Reference
+==================
+This document provide references to
+embedded languages in TVM stack.
diff --git a/tutorials/topi/README.txt b/tutorials/topi/README.txt
index c58aaa9d8..eae0aafaf 100644
--- a/tutorials/topi/README.txt
+++ b/tutorials/topi/README.txt
@@ -1 +1,2 @@
-TOPI: TVM Operator Inventory
\ No newline at end of file
+TOPI: TVM Operator Inventory
+----------------------------
-- 
GitLab