You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/10/07 14:06:39 UTC

[GitHub] [tvm] csullivan opened a new pull request #9220: [Hexagon] Add hexagon launcher to apps and add to TVM's build system

csullivan opened a new pull request #9220:
URL: https://github.com/apache/tvm/pull/9220


   Goal: Simplify the build system for running models on hexagon.
   
   This PR moves the hexagon launcher to be a tvm application (in tvm/apps). It also introduces the `USE_HEXAGON_LAUNCHER` build flag to build the launcher and all dependencies alongside a standard TVM build which consolidates the number of manual build steps from five to one.
   
   ```
   (1) libtvm.so (x86_64)
   
   (2) launcher_android (android-aarch64)
   (3)  └─►libtvm_runtime.so (android-aarch64)
   
   (4) liblauncher_rpc_skel.so (hexagon)
   (5)  └─►libtvm_runtime.a (hexagon)
   ```
   Also added a section on [Compilation with TVM](https://github.com/csullivan/incubator-tvm/blob/1922cfb50489682388b2e10244f392e06d09d2fd/apps/hexagon_launcher/README.md) to the launcher readme.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] csullivan commented on pull request #9220: [Hexagon] Add hexagon launcher to apps and add to TVM's build system

Posted by GitBox <gi...@apache.org>.
csullivan commented on pull request #9220:
URL: https://github.com/apache/tvm/pull/9220#issuecomment-937829286


   @kparzysz-quic 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] csullivan commented on pull request #9220: [Hexagon] Add hexagon launcher to apps and add to TVM's build system

Posted by GitBox <gi...@apache.org>.
csullivan commented on pull request #9220:
URL: https://github.com/apache/tvm/pull/9220#issuecomment-937829286


   @kparzysz-quic 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] kparzysz-quic commented on pull request #9220: [Hexagon] Add hexagon launcher to apps and add to TVM's build system

Posted by GitBox <gi...@apache.org>.
kparzysz-quic commented on pull request #9220:
URL: https://github.com/apache/tvm/pull/9220#issuecomment-938704198


   This is great!
   
   I just started testing it, and the first thing I saw was a bunch of warnings from the Android NDK cmake:
   ```
   ndk-bundle/build/cmake/android.toolchain.cmake:449 (message):
     An old version of CMake is being used that cannot automatically detect
     compiler attributes.  Compiler identification is being bypassed.  Some
     values may be wrong or missing.  Update to CMake 3.19 or newer to use
     CMake's built-in compiler identification.
   ```
   I'm using cmake 3.17, the NDK bundle version in my SDK is 22.1.7171670.  These warning are most likely safe to ignore, but maybe there could be a note about it somewhere?  Your call, I'm fine either way.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] kparzysz-quic merged pull request #9220: [Hexagon] Add hexagon launcher to apps and add to TVM's build system

Posted by GitBox <gi...@apache.org>.
kparzysz-quic merged pull request #9220:
URL: https://github.com/apache/tvm/pull/9220


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] kparzysz-quic commented on a change in pull request #9220: [Hexagon] Add hexagon launcher to apps and add to TVM's build system

Posted by GitBox <gi...@apache.org>.
kparzysz-quic commented on a change in pull request #9220:
URL: https://github.com/apache/tvm/pull/9220#discussion_r725082267



##########
File path: apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt
##########
@@ -0,0 +1,84 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+cmake_minimum_required(VERSION 3.2)
+project(HexagonLauncherRPCSkel C CXX)
+
+include("${CMAKE_CURRENT_SOURCE_DIR}/../HexagonLauncher.cmake")
+
+add_custom_command(
+  OUTPUT ${LAUNCHER_RPC_SKEL_C} ${LAUNCHER_RPC_H}
+  COMMAND ${QAIC_EXE} ${QAIC_FLAGS}
+  "${LAUNCHER_SRC}/${LAUNCHER_RPC_IDL}"
+  MAIN_DEPENDENCY "${LAUNCHER_SRC}/${LAUNCHER_RPC_IDL}"
+)
+
+include_directories(SYSTEM ${HEXAGON_QURT_INCLUDES})
+
+link_directories(${HEXAGON_QURT_LIBS})
+
+add_definitions(-D_MACH_I32=int)
+add_definitions(-DDMLC_CXX11_THREAD_LOCAL=0)
+add_definitions(-DDMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>)
+
+# Extra compile flags (both C and C++).
+set(EXTRA_COMP_FLAGS
+  "-O3"
+  "-m${USE_HEXAGON_ARCH}"
+)
+string(REGEX REPLACE ";" " " EXTRA_COMP_FLAGS_STR "${EXTRA_COMP_FLAGS}")
+set(CMAKE_C_FLAGS "${EXTRA_COMP_FLAGS_STR} ${CMAKE_C_FLAGS}")
+set(CMAKE_CXX_FLAGS "${EXTRA_COMP_FLAGS_STR} ${CMAKE_CXX_FLAGS}")
+
+set(SKEL_SRCS
+  "${LAUNCHER_SRC}/launcher_core.cc"
+  "${LAUNCHER_SRC}/launcher_hexagon.cc"
+)
+add_library(launcher_rpc_skel SHARED
+  "${LAUNCHER_SRC}/${LAUNCHER_RPC_H}"
+  "${LAUNCHER_RPC_SKEL_C}"
+  "${SKEL_SRCS}"
+)
+
+ExternalProject_Add(static_hexagon_tvm_runtime
+  SOURCE_DIR "${TVM_SOURCE_DIR}"
+  BUILD_COMMAND $(MAKE) runtime
+  CMAKE_ARGS
+  "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
+  "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
+  "-DUSE_HEXAGON_ARCH=v68"

Review comment:
       This should be `"-DUSE_HEXAGON_ARCH=${USE_HEXAGON_ARCH}"`.

##########
File path: apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt
##########
@@ -0,0 +1,84 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+cmake_minimum_required(VERSION 3.2)
+project(HexagonLauncherRPCSkel C CXX)
+
+include("${CMAKE_CURRENT_SOURCE_DIR}/../HexagonLauncher.cmake")
+
+add_custom_command(
+  OUTPUT ${LAUNCHER_RPC_SKEL_C} ${LAUNCHER_RPC_H}
+  COMMAND ${QAIC_EXE} ${QAIC_FLAGS}
+  "${LAUNCHER_SRC}/${LAUNCHER_RPC_IDL}"
+  MAIN_DEPENDENCY "${LAUNCHER_SRC}/${LAUNCHER_RPC_IDL}"
+)
+
+include_directories(SYSTEM ${HEXAGON_QURT_INCLUDES})
+
+link_directories(${HEXAGON_QURT_LIBS})
+
+add_definitions(-D_MACH_I32=int)
+add_definitions(-DDMLC_CXX11_THREAD_LOCAL=0)
+add_definitions(-DDMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>)
+
+# Extra compile flags (both C and C++).
+set(EXTRA_COMP_FLAGS
+  "-O3"
+  "-m${USE_HEXAGON_ARCH}"
+)
+string(REGEX REPLACE ";" " " EXTRA_COMP_FLAGS_STR "${EXTRA_COMP_FLAGS}")
+set(CMAKE_C_FLAGS "${EXTRA_COMP_FLAGS_STR} ${CMAKE_C_FLAGS}")
+set(CMAKE_CXX_FLAGS "${EXTRA_COMP_FLAGS_STR} ${CMAKE_CXX_FLAGS}")
+
+set(SKEL_SRCS
+  "${LAUNCHER_SRC}/launcher_core.cc"
+  "${LAUNCHER_SRC}/launcher_hexagon.cc"
+)
+add_library(launcher_rpc_skel SHARED
+  "${LAUNCHER_SRC}/${LAUNCHER_RPC_H}"
+  "${LAUNCHER_RPC_SKEL_C}"
+  "${SKEL_SRCS}"
+)
+
+ExternalProject_Add(static_hexagon_tvm_runtime
+  SOURCE_DIR "${TVM_SOURCE_DIR}"
+  BUILD_COMMAND $(MAKE) runtime
+  CMAKE_ARGS
+  "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
+  "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
+  "-DUSE_HEXAGON_ARCH=v68"
+  "-DCMAKE_CXX_STANDARD=14"
+  "-DUSE_LIBBACKTRACE=OFF"
+  "-DUSE_LLVM=OFF"
+  "-DUSE_RPC=OFF"
+  "-DBUILD_STATIC_RUNTIME=ON"
+  "-DUSE_HEXAGON_SDK=/opt/qualcomm/hexagon/SDK/4.2.0.2"

Review comment:
       This should be `"-DUSE_HEXAGON_SDK=${USE_HEXAGON_SDK}"`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] csullivan commented on a change in pull request #9220: [Hexagon] Add hexagon launcher to apps and add to TVM's build system

Posted by GitBox <gi...@apache.org>.
csullivan commented on a change in pull request #9220:
URL: https://github.com/apache/tvm/pull/9220#discussion_r725218033



##########
File path: apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt
##########
@@ -0,0 +1,84 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+cmake_minimum_required(VERSION 3.2)
+project(HexagonLauncherRPCSkel C CXX)
+
+include("${CMAKE_CURRENT_SOURCE_DIR}/../HexagonLauncher.cmake")
+
+add_custom_command(
+  OUTPUT ${LAUNCHER_RPC_SKEL_C} ${LAUNCHER_RPC_H}
+  COMMAND ${QAIC_EXE} ${QAIC_FLAGS}
+  "${LAUNCHER_SRC}/${LAUNCHER_RPC_IDL}"
+  MAIN_DEPENDENCY "${LAUNCHER_SRC}/${LAUNCHER_RPC_IDL}"
+)
+
+include_directories(SYSTEM ${HEXAGON_QURT_INCLUDES})
+
+link_directories(${HEXAGON_QURT_LIBS})
+
+add_definitions(-D_MACH_I32=int)
+add_definitions(-DDMLC_CXX11_THREAD_LOCAL=0)
+add_definitions(-DDMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>)
+
+# Extra compile flags (both C and C++).
+set(EXTRA_COMP_FLAGS
+  "-O3"
+  "-m${USE_HEXAGON_ARCH}"
+)
+string(REGEX REPLACE ";" " " EXTRA_COMP_FLAGS_STR "${EXTRA_COMP_FLAGS}")
+set(CMAKE_C_FLAGS "${EXTRA_COMP_FLAGS_STR} ${CMAKE_C_FLAGS}")
+set(CMAKE_CXX_FLAGS "${EXTRA_COMP_FLAGS_STR} ${CMAKE_CXX_FLAGS}")
+
+set(SKEL_SRCS
+  "${LAUNCHER_SRC}/launcher_core.cc"
+  "${LAUNCHER_SRC}/launcher_hexagon.cc"
+)
+add_library(launcher_rpc_skel SHARED
+  "${LAUNCHER_SRC}/${LAUNCHER_RPC_H}"
+  "${LAUNCHER_RPC_SKEL_C}"
+  "${SKEL_SRCS}"
+)
+
+ExternalProject_Add(static_hexagon_tvm_runtime
+  SOURCE_DIR "${TVM_SOURCE_DIR}"
+  BUILD_COMMAND $(MAKE) runtime
+  CMAKE_ARGS
+  "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
+  "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
+  "-DUSE_HEXAGON_ARCH=v68"
+  "-DCMAKE_CXX_STANDARD=14"
+  "-DUSE_LIBBACKTRACE=OFF"
+  "-DUSE_LLVM=OFF"
+  "-DUSE_RPC=OFF"
+  "-DBUILD_STATIC_RUNTIME=ON"
+  "-DUSE_HEXAGON_SDK=/opt/qualcomm/hexagon/SDK/4.2.0.2"

Review comment:
       Good catches, thank you




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org