Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Dynamic subgraph property #17034

Merged
merged 71 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
cf30d30
initial commit
Dec 10, 2019
58a41ff
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
Dec 10, 2019
702cf50
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
Dec 11, 2019
d17a118
added subgraphCreate API function to partition the model/graph
Dec 11, 2019
e05d4e1
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
Dec 12, 2019
d0f2fb3
cleaned up API, added API to specify subgraphOp
Dec 12, 2019
55e8861
fixed whitespace
samskalicky Dec 12, 2019
8c97c45
added custom subgraph property
samskalicky Dec 12, 2019
0ebf5b6
fixed whitespace
samskalicky Dec 12, 2019
84f8426
fixed subgraph property
samskalicky Dec 12, 2019
2a1c6fe
fixed whitespace
samskalicky Dec 12, 2019
d3c277d
added registration of custom subgraph property in c_api
samskalicky Dec 12, 2019
55e0974
added support for calling supportOps from customSubgraphProperty
samskalicky Dec 13, 2019
060c8b6
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 13, 2019
6a7e3f7
sending symbol json to supportedOps API
samskalicky Dec 13, 2019
0488879
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 14, 2019
fa206e4
working partitioning example
samskalicky Dec 14, 2019
79d08ea
fixed whitespace
samskalicky Dec 14, 2019
bbe4062
fixed whitespace
samskalicky Dec 14, 2019
a418301
fixed style
samskalicky Dec 14, 2019
420e77a
fixed style
samskalicky Dec 14, 2019
2f354a4
Annotate the symbol json string with shape/type info from the graph o…
samskalicky Dec 15, 2019
92e6f00
Support multiple supportOps functions grouped together. Similar to ho…
samskalicky Dec 15, 2019
901d308
fixed whitespace
samskalicky Dec 15, 2019
053f14e
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 16, 2019
9b160d6
changed vector to unordered_set for performance
samskalicky Dec 16, 2019
ea29e4b
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 17, 2019
bd79319
fixed clearing supportedNodes set after multiple calls
samskalicky Dec 17, 2019
1e41f8e
changed types to int64_t for tensor sizes, fixed indent
samskalicky Dec 17, 2019
e41c50d
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 18, 2019
dd2de0a
added support for passing options to supportedOps
samskalicky Dec 18, 2019
7ea4330
new API to to review subgraphs after partitioning
samskalicky Dec 19, 2019
022b709
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 19, 2019
2f54b12
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 22, 2019
65b30e8
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 27, 2019
b4b4862
added function to revert subgraphing if rejected by subgraph prop
samskalicky Dec 27, 2019
1b3506a
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 28, 2019
cb199cc
added infrastructure to test subgraph libs in the CI
samskalicky Dec 28, 2019
241b591
fixed whitespace
samskalicky Dec 28, 2019
25b71fb
changed default context to CPU since GPU is not supported yet
samskalicky Dec 28, 2019
a53277d
fixed
samskalicky Dec 29, 2019
2fd7423
added include
samskalicky Dec 29, 2019
8434bd8
fixed return types
samskalicky Dec 29, 2019
3ca5882
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 30, 2019
65012cd
added memory free in error condition
samskalicky Dec 30, 2019
d8cbfeb
added clearer function comment
samskalicky Dec 30, 2019
9ddf449
added file comment
samskalicky Dec 30, 2019
17b7631
added more prints in example test for clarity
samskalicky Dec 30, 2019
d0f2efb
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Dec 31, 2019
fc70db3
enhancements from review
samskalicky Dec 31, 2019
fcf483c
retrigger CI
samskalicky Dec 31, 2019
d915dc6
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Jan 2, 2020
71109ce
stopped passing bool types across ABI boundary (changed to int)
samskalicky Jan 2, 2020
5810a16
removed subgraph op from custom_op example
samskalicky Jan 3, 2020
27d0b20
changed subgraph example to use isSubgraphOp
samskalicky Jan 3, 2020
4278d22
added functionality to set "isArg" attribute for subgraph inputs
samskalicky Jan 3, 2020
4e5d849
added comment
samskalicky Jan 3, 2020
034cb89
added functionality to set aux attribute for inputs to subgraph
samskalicky Jan 3, 2020
1ffabfb
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Jan 3, 2020
584c0f6
fixed whitespace and cmakelists
samskalicky Jan 3, 2020
e09750a
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Jan 4, 2020
d7e5dbb
changed acceptSubgraph API to let library set attributes on subgraph …
samskalicky Jan 4, 2020
add02d1
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Jan 4, 2020
34ff989
fixed whitespace
samskalicky Jan 4, 2020
dda4c86
fixed seconds
samskalicky Jan 5, 2020
1931599
retrigger ci
samskalicky Jan 5, 2020
31473ba
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Jan 7, 2020
39ed299
removed unused code
samskalicky Jan 7, 2020
13cfc1c
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Jan 7, 2020
967787e
fixed variable naming
samskalicky Jan 7, 2020
f90df49
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
samskalicky Jan 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,9 @@ else()
endif()

add_library(sample_lib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/example/extensions/lib_custom_op/gemm_lib.cc)
add_library(subgraph_lib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/example/extensions/lib_subgraph/subgraph_lib.cc)
samskalicky marked this conversation as resolved.
Show resolved Hide resolved
target_include_directories(sample_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/mxnet)
target_include_directories(subgraph_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/mxnet)
set(MXNET_INSTALL_TARGETS mxnet)
if(UNIX)
string(APPEND CMAKE_CUDA_FLAGS "${CUDA_ARCH_FLAGS_SPACES}")
Expand All @@ -690,10 +692,13 @@ if(UNIX)
target_link_libraries(mxnet PRIVATE mxnet_static)
target_link_libraries(mxnet_static PUBLIC ${CMAKE_DL_LIBS})
target_compile_options(sample_lib PUBLIC -shared)
target_compile_options(subgraph_lib PUBLIC -shared)
set_target_properties(mxnet_static PROPERTIES OUTPUT_NAME mxnet)
elseif(MSVC)
target_compile_options(sample_lib PUBLIC /LD)
target_compile_options(subgraph_lib PUBLIC /LD)
set_target_properties(sample_lib PROPERTIES PREFIX "lib")
set_target_properties(subgraph_lib PROPERTIES PREFIX "lib")

if(USE_CUDA)
if(MSVC)
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ endif
.PHONY: clean all extra-packages test lint clean_all rcpplint rcppexport roxygen\
cython2 cython3 cython cyclean

all: lib/libmxnet.a lib/libmxnet.so $(BIN) extra-packages sample_lib
all: lib/libmxnet.a lib/libmxnet.so $(BIN) extra-packages sample_lib subgraph_lib

SRC = $(wildcard src/*/*/*/*.cc src/*/*/*.cc src/*/*.cc src/*.cc)
OBJ = $(patsubst %.cc, build/%.o, $(SRC))
Expand Down Expand Up @@ -667,6 +667,8 @@ pylint:
# sample lib for MXNet extension dynamically loading custom operator
sample_lib:
$(CXX) -shared -fPIC -std=c++11 example/extensions/lib_custom_op/gemm_lib.cc -o libsample_lib.so -I include/mxnet
subgraph_lib:
$(CXX) -shared -fPIC -std=c++11 example/extensions/lib_subgraph/subgraph_lib.cc -o libsubgraph_lib.so -I include/mxnet
samskalicky marked this conversation as resolved.
Show resolved Hide resolved

# Cython build
cython:
Expand Down Expand Up @@ -762,7 +764,7 @@ clean: rclean cyclean $(EXTRA_PACKAGES_CLEAN)
cd $(NNVM_PATH); $(MAKE) clean; cd -
cd $(TVM_PATH); $(MAKE) clean; cd -
cd $(AMALGAMATION_PATH); $(MAKE) clean; cd -
$(RM) libsample_lib.so
$(RM) libsample_lib.so libsubgraph_lib.so
$(RM) -r $(patsubst %, %/*.d, $(EXTRA_OPERATORS)) $(patsubst %, %/*/*.d, $(EXTRA_OPERATORS))
$(RM) -r $(patsubst %, %/*.o, $(EXTRA_OPERATORS)) $(patsubst %, %/*/*.o, $(EXTRA_OPERATORS))
else
Expand All @@ -774,7 +776,7 @@ clean: rclean mkldnn_clean cyclean testclean $(EXTRA_PACKAGES_CLEAN)
cd $(NNVM_PATH); $(MAKE) clean; cd -
cd $(TVM_PATH); $(MAKE) clean; cd -
cd $(AMALGAMATION_PATH); $(MAKE) clean; cd -
$(RM) libsample_lib.so
$(RM) libsample_lib.so libsubgraph_lib.so
endif

clean_all: clean
Expand Down
14 changes: 7 additions & 7 deletions ci/jenkins/Jenkins_steps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
utils = load('ci/Jenkinsfile_utils.groovy')

// mxnet libraries
mx_lib = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, lib/tvmop.conf, libsample_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a'
mx_lib_cython = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, lib/tvmop.conf, libsample_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so'
mx_lib = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, lib/tvmop.conf, libsample_lib.so, libsubgraph_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a'
mx_lib_cython = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, lib/tvmop.conf, libsample_lib.so, libsubgraph_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so'

// Python wheels
mx_pip = 'build/*.whl'

// mxnet cmake libraries, in cmake builds we do not produce a libnvvm static library by default.
mx_cmake_lib = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/tvm/libtvm_runtime.so, build/libtvmop.so, build/tvmop.conf, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so'
mx_cmake_lib_no_tvm_op = 'build/libmxnet.so, build/libmxnet.a, build/libsample_lib.so, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so'
mx_cmake_lib_no_tvm_op = 'build/libmxnet.so, build/libmxnet.a, build/libsample_lib.so, build/libsubgraph_lib.so, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so'
mx_cmake_lib_cython = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/tvm/libtvm_runtime.so, build/libtvmop.so, build/tvmop.conf, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so'
// mxnet cmake libraries, in cmake builds we do not produce a libnvvm static library by default.
mx_cmake_lib_debug = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/tvm/libtvm_runtime.so, build/libtvmop.so, build/tvmop.conf, build/libsample_lib.so, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests'
mx_cmake_lib_debug = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/tvm/libtvm_runtime.so, build/libtvmop.so, build/tvmop.conf, build/libsample_lib.so, build/libsubgraph_lib.so, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests'
mx_cmake_mkldnn_lib = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/tvm/libtvm_runtime.so, build/libtvmop.so, build/tvmop.conf, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so'
mx_mkldnn_lib = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, lib/tvmop.conf, libsample_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a'
mx_mkldnn_lib = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, lib/tvmop.conf, libsample_lib.so, libsubgraph_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a'
mx_tensorrt_lib = 'build/libmxnet.so, build/3rdparty/tvm/libtvm_runtime.so, build/libtvmop.so, build/tvmop.conf, lib/libnvonnxparser_runtime.so.0, lib/libnvonnxparser.so.0, lib/libonnx_proto.so, lib/libonnx.so'
mx_lib_cpp_examples = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, lib/tvmop.conf, libsample_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, 3rdparty/ps-lite/build/libps.a, deps/lib/libprotobuf-lite.a, deps/lib/libzmq.a, build/cpp-package/example/*, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so'
mx_lib_cpp_examples_no_tvm_op = 'lib/libmxnet.so, lib/libmxnet.a, libsample_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, 3rdparty/ps-lite/build/libps.a, deps/lib/libprotobuf-lite.a, deps/lib/libzmq.a, build/cpp-package/example/*, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so'
mx_lib_cpp_examples = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, lib/tvmop.conf, libsample_lib.so, libsubgraph_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, 3rdparty/ps-lite/build/libps.a, deps/lib/libprotobuf-lite.a, deps/lib/libzmq.a, build/cpp-package/example/*, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so'
mx_lib_cpp_examples_no_tvm_op = 'lib/libmxnet.so, lib/libmxnet.a, libsample_lib.so, libsubgraph_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, 3rdparty/ps-lite/build/libps.a, deps/lib/libprotobuf-lite.a, deps/lib/libzmq.a, build/cpp-package/example/*, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so'
mx_lib_cpp_examples_cpu = 'build/libmxnet.so, build/3rdparty/tvm/libtvm_runtime.so, build/libtvmop.so, build/tvmop.conf, build/cpp-package/example/*'

// Python unittest for CPU
Expand Down
7 changes: 2 additions & 5 deletions example/extensions/lib_custom_op/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@
# specific language governing permissions and limitations
# under the License.

all: subgraph_lib gemm_lib
all: gemm_lib

gemm_lib:
g++ -shared -fPIC -std=c++11 gemm_lib.cc -o libgemm_lib.so -I ../../../include/mxnet

subgraph_lib:
g++ -shared -fPIC -std=c++11 subgraph_lib.cc -o libsubgraph_lib.so -I ../../../include/mxnet

clean:
rm -rf libsubgraph_lib.so libgemm_lib.so
rm -rf libgemm_lib.so
98 changes: 0 additions & 98 deletions example/extensions/lib_custom_op/subgraph_lib.cc

This file was deleted.

24 changes: 24 additions & 0 deletions example/extensions/lib_subgraph/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Licensed to the Apache Software Foundation (ASF) under one
eric-haibin-lin marked this conversation as resolved.
Show resolved Hide resolved
# 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.

all: subgraph_lib

subgraph_lib:
g++ -shared -fPIC -std=c++11 subgraph_lib.cc -o libsubgraph_lib.so -I ../../../include/mxnet

clean:
rm -rf libsubgraph_lib.so
Loading