Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
53e3120c
Commit
53e3120c
authored
Sep 24, 2018
by
nhynes
Committed by
Tianqi Chen
Sep 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update SGX cmake (#1763)
parent
046a3ed9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
1 deletions
+58
-1
.gitignore
+1
-0
CMakeLists.txt
+5
-0
cmake/config.cmake
+11
-0
cmake/modules/SGX.cmake
+37
-0
src/runtime/sgx/tvm.edl
+2
-0
src/runtime/sgx/untrusted/sgx_module.cc
+2
-1
No files found.
.gitignore
View file @
53e3120c
...
...
@@ -182,6 +182,7 @@ cat.jpg
docs.tgz
cat.png
*.mlmodel
tvm_u.*
# Mac OS X
.DS_Store
build*
...
...
CMakeLists.txt
View file @
53e3120c
...
...
@@ -32,6 +32,7 @@ tvm_option(USE_LLVM "Build with LLVM, can be set to specific llvm-config path" O
tvm_option
(
USE_STACKVM_RUNTIME
"Include stackvm into the runtime"
OFF
)
tvm_option
(
USE_GRAPH_RUNTIME
"Build with tiny graph runtime"
ON
)
tvm_option
(
USE_GRAPH_RUNTIME_DEBUG
"Build with tiny graph runtime debug mode"
OFF
)
tvm_option
(
USE_SGX
"Build with SGX"
OFF
)
tvm_option
(
USE_RTTI
"Build with RTTI"
ON
)
tvm_option
(
USE_MSVC_MT
"Build with MT"
OFF
)
tvm_option
(
INSTALL_DEV
"Install compiler infrastructure"
OFF
)
...
...
@@ -170,6 +171,7 @@ include(cmake/modules/OpenGL.cmake)
include
(
cmake/modules/Vulkan.cmake
)
include
(
cmake/modules/Metal.cmake
)
include
(
cmake/modules/ROCM.cmake
)
include
(
cmake/modules/SGX.cmake
)
include
(
cmake/modules/LLVM.cmake
)
include
(
cmake/modules/contrib/BLAS.cmake
)
include
(
cmake/modules/contrib/Random.cmake
)
...
...
@@ -179,6 +181,9 @@ include(cmake/modules/contrib/NNPack.cmake)
add_library
(
tvm SHARED
${
COMPILER_SRCS
}
${
RUNTIME_SRCS
}
)
add_library
(
tvm_topi SHARED
${
TOPI_SRCS
}
)
add_library
(
tvm_runtime SHARED
${
RUNTIME_SRCS
}
)
if
(
NOT USE_SGX STREQUAL
"OFF"
)
add_dependencies
(
tvm_runtime sgx_edl
)
endif
()
add_library
(
nnvm_compiler SHARED
${
NNVM_COMPILER_SRCS
}
)
target_link_libraries
(
tvm
${
TVM_LINKER_LIBS
}
${
TVM_RUNTIME_LINKER_LIBS
}
)
...
...
cmake/config.cmake
View file @
53e3120c
...
...
@@ -62,6 +62,17 @@ set(USE_VULKAN OFF)
# Whether enable OpenGL runtime
set
(
USE_OPENGL OFF
)
# Whether to enable SGX runtime
#
# Possible values for USE_SGX:
# - /path/to/sgxsdk: path to Intel SGX SDK
# - OFF: disable SGX
#
# SGX_MODE := HW|SIM
set
(
USE_SGX OFF
)
set
(
SGX_MODE
"SIM"
)
set
(
RUST_SGX_SDK
"/path/to/rust-sgx-sdk"
)
# Whether enable RPC runtime
set
(
USE_RPC ON
)
...
...
cmake/modules/SGX.cmake
0 → 100644
View file @
53e3120c
if
(
NOT USE_SGX STREQUAL
"OFF"
)
message
(
STATUS
"Build with SGX support"
)
set
(
_sgx_src
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/runtime/sgx
)
set
(
_tvm_u_h
${
_sgx_src
}
/untrusted/tvm_u.h
)
set
(
_tvm_edl
${
_sgx_src
}
/tvm.edl
)
set
(
_sgx_ustdc
${
RUST_SGX_SDK
}
/sgx_ustdc
)
set
(
_urts_lib
"sgx_urts"
)
if
(
SGX_MODE STREQUAL
"SIM"
)
set
(
_urts_lib
"
${
_urts_lib
}
_sim"
)
endif
()
add_custom_command
(
OUTPUT
${
_tvm_u_h
}
COMMAND
${
USE_SGX
}
/bin/x64/sgx_edger8r --untrusted
--untrusted-dir
${
_sgx_src
}
/untrusted
--search-path
${
USE_SGX
}
/include --search-path
${
RUST_SGX_SDK
}
/edl
${
_tvm_edl
}
COMMAND sed -i
"4i '#include <tvm/runtime/c_runtime_api.h>'"
${
_tvm_u_h
}
DEPENDS
${
_tvm_edl
}
)
add_custom_command
(
OUTPUT
${
_sgx_ustdc
}
/libsgx_ustdc.a
COMMAND make
WORKING_DIRECTORY
${
_sgx_ustdc
}
)
add_custom_target
(
sgx_edl DEPENDS
${
_tvm_u_h
}
${
_sgx_ustdc
}
/libsgx_ustdc.a
)
include_directories
(
${
USE_SGX
}
/include
)
file
(
GLOB RUNTIME_SGX_SRCS
${
_sgx_src
}
/untrusted/*.c*
)
list
(
APPEND TVM_RUNTIME_LINKER_LIBS
-lpthread
-L
${
USE_SGX
}
/lib64 -l
${
_urts_lib
}
-L
${
RUST_SGX_SDK
}
/sgx_ustdc -lsgx_ustdc
)
list
(
APPEND RUNTIME_SRCS
${
RUNTIME_SGX_SRCS
}
)
endif
()
src/runtime/sgx/tvm.edl
View file @
53e3120c
enclave {
from "sgx_tstdc.edl" import *;
from "sgx_stdio.edl" import *;
from "sgx_backtrace.edl" import *;
trusted {
public void tvm_ecall_init([isptr, user_check] TVMRetValueHandle ret);
...
...
src/runtime/sgx/untrusted/sgx_module.cc
View file @
53e3120c
...
...
@@ -4,11 +4,11 @@
* \brief SGX enclave module.
*/
#include <dmlc/logging.h>
#include <sgx_urts.h>
#include <tvm/runtime/c_runtime_api.h>
#include <tvm/runtime/device_api.h>
#include <tvm/runtime/registry.h>
#include <tvm/runtime/threading_backend.h>
#include <sgx_urts.h>
#include <algorithm>
#include <fstream>
#include <iostream>
...
...
@@ -18,6 +18,7 @@
#include <unordered_map>
#include "../common.h"
#include "../../file_util.h"
#include "./tvm_u.h"
namespace
tvm
{
namespace
runtime
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment