-
Notifications
You must be signed in to change notification settings - Fork 9
11.22 #101
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
Open
remloveh
wants to merge
8
commits into
wlt
Choose a base branch
from
zh
base: wlt
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
11.22 #101
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f64780c
11.22
remloveh edae7e1
12.6
remloveh bc0872c
12.6
remloveh f50ded8
conv2d
remloveh d6af4d3
op
remloveh 1caf0ab
add DLTensor* and int32_t*
remloveh 1bdf37b
update int32_t return value
remloveh cb7ae73
update op take attributes
remloveh 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
|
|
||
| .. _operator-test: | ||
|
|
||
| ************* | ||
| Operator Test | ||
| ************* | ||
|
|
||
| .. contents:: | ||
|
|
||
| Test Method | ||
| ----------- | ||
|
|
||
| First generate test data with test_ops.py, then verify the | ||
| generated data with test_op.cc, execute the following code | ||
| to test(test_op.cc is compiled with Makefile): | ||
|
|
||
| .. code-block:: | ||
|
|
||
| python tests/test_ops.py | ||
| ./test_op 0/1/2 (0 is cpu, 1 is formal, and 2 is gpu) | ||
|
|
||
| Test Results | ||
| ------------ | ||
|
|
||
| The following are the test results of the operator on different devices: | ||
|
|
||
| +-------------------+-------------------------+ | ||
| | operator | results | | ||
| +===================+=========================+ | ||
| | broadcast_sub | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | broadcast_add | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | broadcast_mul | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | broadcast_max | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | broadcast_div | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | broadcast_greater | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | max_pool2d | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | dense | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | sum | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | max | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | slice_like | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | tile | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | repeat | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | concatenate | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | transpose | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | take | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | get_valid_counts | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ | ||
| | strided_slice | cpu & formal & gpu pass | | ||
| +-------------------+-------------------------+ |
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 |
|---|---|---|
|
|
@@ -50,11 +50,11 @@ struct CVMOpParam { | |
| std::string attrs; | ||
| }; | ||
|
|
||
| #ifndef DEVICE | ||
| #define DEVICE 0 | ||
| #endif | ||
| // #ifndef DEVICE | ||
| // #define DEVICE 1 | ||
| // #endif | ||
|
|
||
| int ctx = APIDevTypeMap.at(DEVICE); | ||
| int ctx; | ||
|
|
||
| int device_id = 0; | ||
| /* | ||
|
|
@@ -128,6 +128,9 @@ std::function<void()> get_func( | |
| arg_ptr->arg_tcodes.push_back(kHandle); | ||
|
|
||
|
|
||
| // cvm.runtime.{version}.{op_name} | ||
| // cvm.runtime.cpu.conv2d | ||
| // cvm.runtime.cuda.dense | ||
| auto op = param.func_name; | ||
| int device_type = static_cast<int>(ctx); | ||
| std::string module_name = "cvm.runtime."; | ||
|
|
@@ -472,7 +475,7 @@ void load_input(int num_inputs, string case_path, vector<vector<uint64_t>>& tsha | |
| CVMArrayFree(cpu_tensor); | ||
| } | ||
| } | ||
| const string CASE_DIR = "/data/ops_generator"; | ||
| const string CASE_DIR = "/home/remloveh/cvm-runtime/data/ops_generator"; | ||
wlt-cortex marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| //const string CASE_DIR = "/data/zkh"; | ||
|
|
||
| void test_op(string op_name) { | ||
|
|
@@ -659,36 +662,38 @@ void test_op(string op_name) { | |
| // } | ||
| } | ||
| } | ||
| int main() { | ||
| test_op("max_pool2d"); // formal & cpu pass | ||
| test_op("upsampling"); // formal & cpu pass | ||
| test_op("dense"); // formal & cpu pass | ||
| int main(int argc, char* argv[]) { | ||
| ctx = APIDevTypeMap.at(stoi(argv[1])); | ||
|
Member
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. Add more information about arguments, such as the meaning, format, etc. |
||
| // test_op("max_pool2d"); // formal & cpu pass | ||
| //test_op("upsampling"); // formal & cpu pass | ||
| // test_op("dense"); // formal & cpu pass | ||
| test_op("conv2d"); // formal & cpu pass | ||
| test_op("sum"); // formal & cpu pass | ||
| test_op("max"); // formal & cpu pass | ||
| test_op("slice_like"); // formal & cpu pass | ||
| test_op("tile"); // formal & cpu pass | ||
| test_op("repeat"); // formal & cpu pass | ||
| test_op("get_valid_counts"); // formal & CPU pass | ||
|
|
||
| test_op("strided_slice"); // formal & cpu pass | ||
| test_op("concatenate");// formal & cpu pass | ||
| test_op("transpose");// formal & cpu pass | ||
| test_op("take"); // formal & cpu pass | ||
| //test_op("clip"); // no test case | ||
| //test_op("cvm_clip"); // no test case | ||
| //test_op("cvm_right_shift"); // no test case | ||
| test_op("elemwise_add"); // formal & cpu pass | ||
| // test_op("sum"); // formal & cpu pass | ||
| // test_op("max"); // formal & cpu pass | ||
| // test_op("slice_like"); // formal & cpu pass | ||
| // test_op("tile"); // formal & cpu pass | ||
| // test_op("repeat"); // formal & cpu pass | ||
| // test_op("get_valid_counts"); // formal & CPU pass | ||
|
|
||
| // test_op("strided_slice"); // formal & cpu pass | ||
| // test_op("concatenate");// formal & cpu pass | ||
| // test_op("transpose");// formal & cpu pass | ||
| // test_op("take"); // formal & cpu pass | ||
| // test_op("clip"); // no test case | ||
| // test_op("cvm_clip"); // no test case | ||
| // test_op("cvm_right_shift"); // no test case | ||
| //test_op("elemwise_add"); // formal & cpu pass | ||
| //test_op("elemwise_sub"); // no test case | ||
| //test_op("where"); // no test case | ||
| test_op("non_max_suppression"); // formal & cpu pass | ||
| test_op("broadcast_sub"); // formal & cpu pass | ||
| test_op("broadcast_add"); // formal & cpu pass | ||
| test_op("broadcast_mul"); // formal & cpu pass | ||
| test_op("broadcast_max"); // formal & cpu pass | ||
| test_op("broadcast_div"); // formal & cpu pass | ||
| test_op("broadcast_greater"); // formal & cpu pass | ||
| //test_op("non_max_suppression"); // formal & cpu pass | ||
| // test_op("broadcast_sub"); // formal & cpu pass | ||
| // test_op("broadcast_add"); // formal & cpu pass | ||
| // test_op("broadcast_mul"); // formal & cpu pass | ||
| // test_op("broadcast_max"); // formal & cpu pass | ||
| // test_op("broadcast_div"); // formal & cpu pass | ||
| // test_op("broadcast_greater"); // formal & cpu pass | ||
|
||
|
|
||
| cout << "test device: "<< DeviceName(static_cast<int>(ctx)) << endl; | ||
| cout << "all tests finished" << endl; | ||
| return 0; | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.