-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add Relay option to link parameters into runtime Modules #6917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
40e5672
refactor RPCSessionContext utils
99ef7e4
Make TVMLogf platform-independent.
b9db147
test pass, make runtime part work (wip)
8d62592
llvm and c backends work!
e0259b0
switch to floating point hex
cb7c001
c backend works works
bbdfd3d
crt tests work
1afa10e
CRT works!
b85d90f
make stm repo work (half done)
bbb6e80
works-ish on micro
6e19b25
final changes for link-params
22a587c
missed stuff
f7b15b7
git-clang-format
ef6e14f
black format
6d6aa66
git-clang-format again
261eda7
address c++ lint
c0d2c0d
git-clang-format
601616a
rm extra comments
cf22894
git-clang-format
ad5837e
pylint
69f127b
Merge remote-tracking branch 'origin/main' into linked-params
154bf5f
pylint again
4d9fc2e
rm debugging breaking build
891ccf5
fix incorrect parameter passing in GraphRuntimeModule
df132fa
fixes for LLVM 4.0 and i386
8bb51e4
set default for --link-params
03432d2
switch link order for proper library symbol resolution
b13472a
git-clang-format
02d9744
black format + pylint
d9c7b9c
pylint again
3ddadf3
fix target_test to recognize --link-params
ef74021
remove --link-params from default micro() target.
5177608
import testing, somehow not needed before
1f471b1
catch correct error from remote module lookup
3e1eb4a
CRT RPC-level ModuleGetFunction behaves like C++ on error
289b1b7
black format
ea0290b
black format again
652571d
rm test_binutils, code is gone
4976e50
split codegen_params into two files, C and LLVM
219e376
git-clang-format
762310b
cpplint
7af6c9a
add missing include for linux compilation
b76d2ce
cpplint
4176a9a
Merge remote-tracking branch 'origin/main' into linked-params
575859b
Merge remote-tracking branch 'origin/main' into linked-params
78de39e
Keep binutils as it was, not part of this PR
148bdfc
templatize LLVM param codegen
38a73ea
address tqchen comments
0fc11f1
git-clang-format
5bf3246
actually use storage_id, not graph node id, for param id
953fb98
demote log level
03b79e9
black format
7a3a9dd
rm debug logs
e4296ef
address kparzysz comments
a05871f
git-clang-format
dd862fc
cpplint
b08e24f
fix compile bugs on linux
bcbeda4
revert pyproject, address tqchen, kparzysz comments
bf42077
git-clang-format
883c878
address tqchen, others' comments
4400a34
git-clang-format
f53c2e2
remove fls, which isn't widely available
754cf35
address tqchen comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -61,14 +61,20 @@ typedef struct TVMGraphRuntime TVMGraphRuntime; | |
| * \brief Allocate a new GraphRuntime with vmalloc and initialize it. | ||
| * | ||
| * \param sym_json JSON-encoded graph. | ||
| * \param m TVM Module that exposes the functions to call. | ||
| * \param module_handle TVM Module that exposes the functions to call. | ||
| * \param ctxs runtime execution context. | ||
| */ | ||
| TVMGraphRuntime* TVMGraphRuntime_Create(const char* sym_json, const struct TVMModule* m, | ||
| TVMGraphRuntime* TVMGraphRuntime_Create(const char* sym_json, TVMModuleHandle module_handle, | ||
| const TVMContext* ctxs); | ||
|
|
||
| int TVMGraphRuntime_GetInputIndex(TVMGraphRuntime* runtime, const char* name); | ||
|
|
||
| /*! | ||
| * \brief get number of input tensors allocated. | ||
| * \return integer number of tensors available to use. | ||
| */ | ||
| int TVMGraphRuntime_GetNumInputs(); | ||
|
|
||
| /*! | ||
| * \brief set input to the graph based on name. | ||
| * \param runtime The graph runtime. | ||
|
|
@@ -77,6 +83,12 @@ int TVMGraphRuntime_GetInputIndex(TVMGraphRuntime* runtime, const char* name); | |
| */ | ||
| void TVMGraphRuntime_SetInput(TVMGraphRuntime* runtime, const char* name, DLTensor* data_in); | ||
|
|
||
| /*! | ||
| * \brief get number of output tensors allocated. | ||
| * \return integer number of output tensors allocated. | ||
| */ | ||
| int TVMGraphRuntime_GetNumOutputs(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe its just me, but I cant see how this is relevant to linked params ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same story as before |
||
|
|
||
| /*! | ||
| * \brief Return NDArray for given output index. | ||
| * \param runtime The graph runtime. | ||
|
|
||
This file contains hidden or 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,42 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| /*! | ||
| * \file graph_runtime.h | ||
| * \brief Tiny graph runtime that can run graph containing only tvm PackedFunc. | ||
| */ | ||
| #ifndef TVM_RUNTIME_CRT_GRAPH_RUNTIME_MODULE_H_ | ||
| #define TVM_RUNTIME_CRT_GRAPH_RUNTIME_MODULE_H_ | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #include <tvm/runtime/crt/error_codes.h> | ||
|
|
||
| /*! | ||
| * \brief Register the "tvm.graph_runtime.create" constructor PackedFunc. | ||
| */ | ||
| tvm_crt_error_t TVMGraphRuntimeModule_Register(); | ||
|
|
||
| #ifdef __cplusplus | ||
| } // extern "C" | ||
| #endif | ||
|
|
||
| #endif // TVM_RUNTIME_CRT_GRAPH_RUNTIME_MODULE_H_ |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe its just me, but I cant see how this is relevant to linked params ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is needed for the CRT test. we didn't yet support the case of executing the graph runtime within the C runtime over RPC. test_linked_params uses this to verify that the CRT graph runtime can lookup the linked params. it's a bit tangential yes, but it is basically rounding out the graph runtime impl and it's not a very large addition; i'd prefer to keep it with this change to show the motivation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine by me, then.