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
33310206
Commit
33310206
authored
Feb 26, 2017
by
Tianqi Chen
Committed by
GitHub
Feb 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BUILD] Add CMake for Windows build (#55)
parent
f6c043eb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
6 deletions
+140
-6
.gitignore
+3
-0
CMakeLists.txt
+117
-0
HalideIR
+1
-1
cmake/Util.cmake
+14
-0
dmlc-core
+1
-1
src/api/api_lang.cc
+2
-2
src/runtime/file_util.cc
+1
-1
src/schedule/graph.cc
+1
-1
No files found.
.gitignore
View file @
33310206
...
...
@@ -92,3 +92,6 @@ ENV/
*~
build
config.mk
build_win
Win32
*.dir
CMakeLists.txt
0 → 100644
View file @
33310206
cmake_minimum_required
(
VERSION 3.5
)
project
(
tvm
)
include
(
cmake/Util.cmake
)
option
(
USE_OPENCL
"Build with OpenCL"
OFF
)
option
(
USE_CUDA
"Build with CUDA"
OFF
)
option
(
USE_LLVM
"Build with LLVM"
OFF
)
option
(
USE_RTTI
"Build with RTTI"
OFF
)
# include path
include_directories
(
"include"
)
include_directories
(
"HalideIR/src"
)
set
(
TVM_LINKER_LIBS
""
)
set
(
TVM_RUNTIME_LINKER_LIBS
""
)
# compile
if
(
MSVC
)
add_definitions
(
-DWIN32_LEAN_AND_MEAN
)
add_definitions
(
-D_CRT_SECURE_NO_WARNINGS
)
add_definitions
(
-D_SCL_SECURE_NO_WARNINGS
)
add_definitions
(
-DTVM_EXPORTS
)
foreach
(
flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if
(
${
flag_var
}
MATCHES
"/MD"
)
string
(
REGEX REPLACE
"/MD"
"/MT"
${
flag_var
}
"
${${
flag_var
}}
"
)
endif
(
${
flag_var
}
MATCHES
"/MD"
)
endforeach
(
flag_var
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/EHsc"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/MP"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/MP"
)
else
(
MSVC
)
include
(
CheckCXXCompilerFlag
)
check_cxx_compiler_flag
(
"-std=c++11"
SUPPORT_CXX11
)
check_cxx_compiler_flag
(
"-msse2"
SUPPORT_MSSE2
)
set
(
CMAKE_C_FLAGS
"-O3 -fno-rtti -Wall -std=c++11 -fPIC"
)
if
(
SUPPORT_OPENMP
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-fopenmp"
)
endif
()
set
(
CMAKE_CXX_FLAGS
${
CMAKE_C_FLAGS
}
)
endif
(
MSVC
)
tvm_source_group
(
"Include
\\
tvm"
GLOB
"include/tvm/*.h"
)
tvm_source_group
(
"Include
\\
tvm
\\
runtime"
GLOB
"include/tvm/runtime/*.h"
)
tvm_source_group
(
"Source
\\
lang"
GLOB
"src/lang/*.cc"
)
tvm_source_group
(
"Source
\\
api"
GLOB
"src/api/*.cc"
)
tvm_source_group
(
"Source
\\
arithmetic"
GLOB
"src/arithmetic/*.cc"
)
tvm_source_group
(
"Source
\\
schedule"
GLOB
"src/schedule/*.cc"
)
tvm_source_group
(
"Source
\\
codegen"
GLOB
"src/codegen/*.cc"
)
tvm_source_group
(
"Source
\\
codegen
\\
llvm"
GLOB
"src/codegen/llvm/*.cc"
)
tvm_source_group
(
"Source
\\
pass"
GLOB
"src/pass/*.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"
)
file
(
GLOB COMPILER_SRCS
src/api/*.cc
src/arithmetic/*.cc
src/codegen/*.cc
src/stack_vm/*.cc
src/lang/*.cc
src/pass/*.cc
src/schedule/*.cc
)
file
(
GLOB_RECURSE HALIDEIR_SRCS HalideIR/src/*.cpp
)
list
(
APPEND COMPILER_SRCS
${
HALIDEIR_SRCS
}
)
file
(
GLOB RUNTIME_SRCS src/runtime/*.cc
)
file
(
GLOB COMPILER_LLVM_SRCS src/codegen/llvm/*.cc
)
file
(
GLOB RUNTIME_CUDA_SRCS src/runtime/cuda/*.cc
)
file
(
GLOB RUNTIME_OPENCL_SRCS src/runtime/opencl/*.cc
)
if
(
USE_CUDA
)
list
(
APPEND RUNTIME_SRCS
${
RUNTIME_CUDA_SRCS
}
)
else
(
USE_CUDA
)
add_definitions
(
-DTVM_CUDA_RUNTIME=0
)
endif
(
USE_CUDA
)
if
(
USE_OPENCL
)
list
(
APPEND RUNTIME_SRCS
${
RUNTIME_OPENCL_SRCS
}
)
else
(
USE_OPENCL
)
add_definitions
(
-DTVM_OPENCL_RUNTIME=0
)
endif
(
USE_OPENCL
)
if
(
USE_LLVM
)
add_definitions
(
-DTVM_LLVM_VERSION=40
)
list
(
APPEND COMPILER_SRCS
${
COMPILER_LLVM_SRCS
}
)
endif
(
USE_LLVM
)
if
(
NOT USE_RTTI
)
add_definitions
(
-DDMLC_ENABLE_RTTI=0
)
endif
()
if
(
EXISTS
${
CMAKE_CURRENT_SOURCE_DIR
}
/dmlc-core/CMakeLists.txt
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/dmlc-core/include
)
elseif
(
DMLC_CORE_PATH
)
include_directories
(
${
DMLC_CORE_PATH
}
/include
)
endif
()
# Set library output directories
if
(
MSVC
)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE
${
PROJECT_SOURCE_DIR
}
/lib
)
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE
${
PROJECT_SOURCE_DIR
}
/lib
)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG
${
PROJECT_SOURCE_DIR
}
/lib
)
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG
${
PROJECT_SOURCE_DIR
}
/lib
)
else
()
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
${
PROJECT_SOURCE_DIR
}
/lib
)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY
${
PROJECT_SOURCE_DIR
}
)
set
(
CMAKE_SHARED_LIBRARY_PREFIX
""
)
endif
()
add_library
(
libtvm SHARED
${
COMPILER_SRCS
}
${
RUNTIME_SRCS
}
)
add_library
(
libtvm_runtime SHARED
${
RUNTIME_SRCS
}
)
target_link_libraries
(
libtvm
${
TVM_LINKER_LIBS
}
)
target_link_libraries
(
libtvm_runtime
${
TVM_RUNTIME_LINKER_LIBS
}
)
HalideIR
@
7efe0366
Subproject commit
1a11a6c2522b1d11a5ccdb9b4fe3976cbe7f9f27
Subproject commit
7efe0366e93c053d558415b72f9fe3f6545eb721
cmake/Util.cmake
0 → 100644
View file @
33310206
# Usage:
# tvm_source_group(<group> GLOB[_RECURSE] <globbing_expression>)
function
(
tvm_source_group group
)
cmake_parse_arguments
(
TVM_SOURCE_GROUP
""
""
"GLOB;GLOB_RECURSE"
${
ARGN
}
)
if
(
TVM_SOURCE_GROUP_GLOB
)
file
(
GLOB srcs1
${
TVM_SOURCE_GROUP_GLOB
}
)
source_group
(
${
group
}
FILES
${
srcs1
}
)
endif
()
if
(
TVM_SOURCE_GROUP_GLOB_RECURSE
)
file
(
GLOB_RECURSE srcs2
${
TVM_SOURCE_GROUP_GLOB_RECURSE
}
)
source_group
(
${
group
}
FILES
${
srcs2
}
)
endif
()
endfunction
()
dmlc-core
@
53751c3d
Subproject commit
8dd365636528175e785448cf8a9f4e494c8ee0e0
Subproject commit
53751c3da2999d841f4f952639bd766505b51d84
src/api/api_lang.cc
View file @
33310206
...
...
@@ -49,7 +49,7 @@ TVM_REGISTER_API(_ArrayGetItem)
auto
*
n
=
static_cast
<
const
ArrayNode
*>
(
sptr
.
get
());
CHECK_LT
(
static_cast
<
size_t
>
(
i
),
n
->
data
.
size
())
<<
"out of bound of array"
;
*
ret
=
n
->
data
[
i
];
*
ret
=
n
->
data
[
static_cast
<
size_t
>
(
i
)
];
});
TVM_REGISTER_API
(
_ArraySize
)
...
...
@@ -185,7 +185,7 @@ TVM_REGISTER_API(_ScanOp)
TVM_REGISTER_API
(
_OpGetOutput
)
.
set_body
([](
TVMArgs
args
,
TVMRetValue
*
ret
)
{
*
ret
=
args
[
0
].
operator
Operation
().
output
(
args
[
1
].
operator
int64_t
(
));
static_cast
<
size_t
>
(
args
[
1
].
operator
int64_t
()
));
});
...
...
src/runtime/file_util.cc
View file @
33310206
...
...
@@ -66,7 +66,7 @@ void LoadBinaryFromFile(const std::string& file_name,
CHECK
(
!
fs
.
fail
())
<<
"Cannot open "
<<
file_name
;
// get its size:
fs
.
seekg
(
0
,
std
::
ios
::
end
);
size_t
size
=
fs
.
tellg
(
);
size_t
size
=
static_cast
<
size_t
>
(
fs
.
tellg
()
);
fs
.
seekg
(
0
,
std
::
ios
::
beg
);
data
->
resize
(
size
);
fs
.
read
(
&
(
*
data
)[
0
],
size
);
...
...
src/schedule/graph.cc
View file @
33310206
...
...
@@ -39,7 +39,7 @@ template <>
struct
hash
<::
tvm
::
schedule
::
TensorDimKey
>
{
std
::
size_t
operator
()(
const
::
tvm
::
schedule
::
TensorDimKey
&
k
)
const
{
size_t
lhs
=
k
.
f
.
hash
();
size_t
rhs
=
static_cast
<
size_t
>
(
k
.
value_index
)
<<
32
UL
|
size_t
rhs
=
static_cast
<
size_t
>
(
k
.
value_index
)
<<
16
UL
|
static_cast
<
size_t
>
(
k
.
dim
);
lhs
^=
rhs
+
0x9e3779b9
+
(
lhs
<<
6
)
+
(
lhs
>>
2
);
return
lhs
;
...
...
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