forked from neo-ai/tvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RUNTIME] Hexagon driver for offloading kernels to simulator (apache#…
…5492) * [RUNTIME] Hexagon driver for offloading kernels to simulator * Add sim_dev as external project when building with Hexagon/sim support * Change target CPU for sim_dev to v60
- Loading branch information
Krzysztof Parzyszek
authored and
Trevor Morris
committed
Jun 18, 2020
1 parent
1695971
commit 73f4e9b
Showing
8 changed files
with
1,112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# 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. | ||
|
||
project(SIM_DEV C CXX) | ||
cmake_minimum_required(VERSION 3.0.2) | ||
|
||
set(CMAKE_SYSTEM_NAME "Linux") | ||
|
||
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/config.cmake) | ||
include(${CMAKE_CURRENT_BINARY_DIR}/config.cmake) | ||
endif() | ||
|
||
set(EXTRA_CXX_FLAGS | ||
"-O2" | ||
"-Wno-format" | ||
"-mhvx -mhvx-length=128b" | ||
"-mv60" | ||
"-stdlib=libc++" | ||
) | ||
|
||
set(EXTRA_LINK_FLAGS | ||
"-stdlib=libc++" | ||
"-G0" | ||
"-Wl,--force-dynamic" | ||
"-Wl,--export-dynamic" | ||
"-Wl,--whole-archive" # This should link entire libc, libc++ and libc+abi. | ||
"-Wl,--defsym=HEAP_SIZE=0x40000000" | ||
) | ||
|
||
string(REGEX REPLACE ";" " " EXTRA_CXX_FLAGS_STR "${EXTRA_CXX_FLAGS}") | ||
string(REGEX REPLACE ";" " " EXTRA_LINK_FLAGS_STR "${EXTRA_LINK_FLAGS}") | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_FLAGS "${EXTRA_CXX_FLAGS_STR} ${CMAKE_CXX_FLAGS}") | ||
set(CMAKE_EXE_LINKER_FLAGS "${EXTRA_LINK_FLAGS_STR} ${CMAKE_EXE_LINKER_FLAGS}") | ||
|
||
# Set project properties. | ||
|
||
file(GLOB SOURCE_FILES "*.cc") | ||
add_executable(sim_dev ${SOURCE_FILES}) | ||
target_include_directories(sim_dev | ||
PUBLIC "." | ||
PUBLIC ".." | ||
PUBLIC "../../../../../include" | ||
PUBLIC "../../../../../3rdparty/dlpack/include" | ||
) | ||
|
||
target_link_libraries(sim_dev "-ldl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!--- 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. --> | ||
|
||
# Hexagon simulator driver | ||
|
||
The driver (`sim_dev` executable) is the process running on the Hexagon simulator that handles the Hexagon-side communication with the TVM runtime running on x86. The location of `sim_dev` should be added to `PATH` before running any python code that uses Hexagon. The `sim_dev` executable is not intended to be run by users, it is automatically loaded by the simulator control code (in `hexagon_device_sim.cc`). | ||
|
||
### Prerequisites | ||
|
||
1. Hexagon C/C++ toolchain (such as the one in Hexagon SDK version 3.5.0 or later). | ||
|
||
Hexagon SDK is available at //developer.qualcomm.com/software/hexagon-dsp-sdk. | ||
|
||
### Configuring | ||
|
||
Set | ||
``` | ||
CMAKE_C_COMPILER=hexagon-clang | ||
CMAKE_CXX_COMPILER=hexagon-clang++ | ||
``` | ||
|
||
### Building | ||
|
||
There are no special options required for `make` (or the tool selected with `cmake`). The location of the resulting binary `sim_dev` should be added to `PATH`. |
Oops, something went wrong.