forked from apache/mxnet
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Softmax refactor #7
Open
wentingj
wants to merge
274
commits into
zheng-da:refactor
Choose a base branch
from
wentingj:softmax_refactor
base: refactor
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
Changes from 1 commit
Commits
Show all changes
274 commits
Select commit
Hold shift + click to select a range
5bb99c8
Make pooling stateless.
zheng-da 046eb81
Make dropout stateless.
zheng-da f4c6f1c
Make batchnorm stateless.
zheng-da 30b5fd9
Make SoftmaxActivation stateless.
zheng-da 95ef90e
Fix a code style problem.
zheng-da 921859a
pass amalgamation test for batch norm.
zheng-da 485f58f
pass amalgamation test for dropout.
zheng-da 660968f
Get convolution ops from a function.
zheng-da 26e9430
Fix compilation errors for GPU.
zheng-da 5504e2c
Fix thread local in diff platforms.
zheng-da 6324176
Avoid using thread_local for non-CuDNN conv/deconv.
zheng-da 36c466f
Remove TODO in deconv.
zheng-da 6410684
Fix a compilation error in dropout.
zheng-da 1fa3898
Fix a bug in batch norm.
zheng-da 588383a
Fix a bug in fully connected.
zheng-da 66a281a
Don't set #inputs for backward convolution.
zheng-da d3ce902
Remove MKL code.
zheng-da caa3bf3
Update MXNet for MKLDNN.
zheng-da db10bb1
Enable MKLDNN Relu.
zheng-da 99c1e08
Fix a compilation error.
zheng-da a6c2c82
Change Makefile for MKLDNN.
zheng-da 3f75f52
Remove infer storage in convolution.
zheng-da edf6842
Update MXNet for MKLDNN.
zheng-da c96ca26
Support MKLDNN storage type in python.
zheng-da 1a6e06e
Update activation.
zheng-da ca30cac
Add MKLDNN base classes.
zheng-da 79c563c
Implement MKLDNN fully connected.
zheng-da 2f5ed28
Add MKLDNN convolution.
zheng-da 126b85e
Update MKLDNN interface in NDArray.
zheng-da 7672608
MKLDNN convolution handle CreateMKLDNNData failure.
zheng-da 4064bef
Add another GetMKLDNNData in NDArray.
zheng-da 9c6bf6f
Have mkldnn to define the data format.
zheng-da 3bdc871
Create output MKLDNN memory explicitly for FC.
zheng-da 551c66d
Fix a bug in NDArray.
zheng-da b6abf35
Fix a bug in GetWeightDesc.
zheng-da dff9c0f
Convert data layout if necessary in FC.
zheng-da 310be84
remove unnecessary print in MKLDNN convolution.
zheng-da b1f17c5
Add MKLDNN deconvolution.
zheng-da 926289c
Add MKLDNNStream to manage primitives and memories.
zheng-da fae1fc3
Use MKLDNNStream to register memory in NDArray.
zheng-da 474f847
Use MKLDNNStream to manage resources in operators.
zheng-da d750f86
Handle kAddTo in MKLDNN operators.
zheng-da 3b9395d
Fix a bug in deconvolution.
zheng-da b3518aa
Fix bugs in NDArray.
zheng-da c51576c
Revert "Fix bugs in NDArray."
zheng-da 8e4acd1
Fix a bug in NDArray.
zheng-da e5f9c2f
Fix a bug in NDArray.
zheng-da 7853520
Reorder MKLDNN memory to default format in SetTBlob.
zheng-da d2af1f3
Disable MKLDNN correctly.
zheng-da f9cae1b
Fix a bug in activation.
zheng-da 3965435
Reshape of NDArray supports MKLDNN.
zheng-da 69cce01
Fix a memory ref bug in NDArray.
zheng-da 4c4d73c
Reshape NDArray in MKLDNN FullyConnected.
zheng-da 625951c
Fix data format conversion.
zheng-da 15ee484
Remove MKL code in dropout.
zheng-da 8779612
Create MKLDNN NDArray in python.
zheng-da bc39849
Support Slice for MKLDNN NDArray.
zheng-da 25afbd7
Reduce the overhead of summing the result to the output array.
zheng-da be6f3e7
Avoid unnecessary memory copy in NDArray.
zheng-da 6f12fb3
Fix a bug in data reordering.
zheng-da 6301b0d
Fix a bug in NDArray.
zheng-da 9c62198
Don't hard code MKLDNN type.
zheng-da 59d2ab4
Support dilation in MKLDNN convolution.
zheng-da 8fa58eb
Fix a bug in sum results.
zheng-da ba1be8f
Rewrite GetMKLDNNData.
zheng-da 81493c7
Add prepare_mkldnn.sh
zheng-da 28a7880
Enable MKLDNN activation.
zheng-da 6f19874
Fix a bug on FullyConnected.
zheng-da 873cae9
Handle 3 dims for MKLDNN NDArray.
zheng-da 1aab48f
Fix a bug in MKLDNN FC.
zheng-da e280827
Support MKLDNN storage in KV store.
zheng-da b76418e
Fix a bug in executor for non-default NDArray.
zheng-da 645e9ae
Fix a link error in cast_storage.cc.
zheng-da 706ae04
Remove unnecessary function def
zheng-da 3a32cb9
Fall back to def storage if the type isn't supported by MKLDNN.
zheng-da 7cf8201
Use NDArray for MKLDNN in python.
zheng-da d0f806f
Reshape output of MKLDNN convolution.
zheng-da 39f5820
Fix a bug in NDArray.
zheng-da 770050a
Support more operations in MKLDNN NDArray.
zheng-da 23b5e19
Fix a bug in deconvolution.
zheng-da 4bc0290
Fix bugs in MKLDNN deconvolution.
zheng-da ea3b24c
Have elemwise binary ops to fall to default for MKLDNN.
zheng-da d8f4672
Limit the cases that MKLDNN operations are called.
zheng-da 68add39
Force the layout of mkldnn::memory from NDArray.
zheng-da e09ee05
Add MKLDNN softmax.
zheng-da b6a6ea2
Fix output storage type of MKLDNN softmax.
zheng-da 045d980
Add MKLDNN sum.
zheng-da 852a106
Fix a bug in elemwise sum.
zheng-da 9ebb034
Fix a bug in MKLDNN softmax.
zheng-da b38c466
Fix a bug in imperative.
zheng-da d1544d8
Remove redundant code.
zheng-da 2886818
MKLDNN Pooling Op integration
ashokei 1213670
MKLDNN Pooling Op integration add missing file
ashokei ecfb6b7
fix mkldnn pooling op workspace issue
ashokei adbec7a
handle workspace in MKLDNN pooling correctly.
zheng-da 70b0399
Use a non-MKLDNN op for testing.
zheng-da e785e5d
Allow to share arguments and their gradients between executors.
zheng-da 20f1e6a
Avoid using MKLDNN pooling when it's not supported.
zheng-da 23943f2
Support MKLDNN properly.
zheng-da 801bf66
Choose MKLDNN softmax more carefully.
zheng-da f89ce8a
Fix a bug in MKLDNN pooling.
zheng-da 1d749f0
Fall back if MKLDNN pooling isn't supported.
zheng-da 8f7acab
Fix a bug in Slice of NDArray.
zheng-da 179ac61
Use int32 for workspace memory.
zheng-da 8e6abf9
Exclude MKLDNN act with tanh.
zheng-da e8cc7e0
Have two Reshape functions in NDArray.
zheng-da 801bebb
Move concat to nn/
zheng-da bb1570a
Use NNVM interface for concat.
zheng-da d572bc9
Move lrn to nn/.
zheng-da 539e3e7
Use NNVM interface for LRN.
zheng-da 5439b31
Copy data for NDArray with diff shapes.
zheng-da 6d07be9
Add MKLDNN copy.
zheng-da ea576dd
Add MKLDNN version of elemwise_add.
zheng-da 94cbaae
Add MKLDNN version of Flatten.
zheng-da 13c0199
add mkldnn surport for concat
wentingj 0e87c49
simplify MKLDNN Flatten.
zheng-da 771bbd4
Enalbe MKLDNN deconvolution with bias.
zheng-da aebac39
Fix a bug in CuDNN deconvolution.
zheng-da b9f6f32
avoid using MKLDNNStorage when it's not defined.
zheng-da 9fe92e1
Remove ./cudnn_lrn-inl.h
zheng-da 64a4a28
Fix for make lint.
zheng-da 6a973b9
add mkldnn surport for concat
wentingj 337b2ec
fix the coding style for pr of mkldnn concat
wentingj c290f6e
Only add input data for MKLDNN concat backward
zheng-da a2d8906
Remove unnecessary TODO.
zheng-da 57c2b3d
remove unnecessary __repr__ in MKLNDArray.
zheng-da 43b6f5c
better condition check for readability.
zheng-da b3f7d6e
Use macro when including mkldnn.hpp.
zheng-da ead065f
Revert "Use CoreOpRunner for refactored Ops."
zheng-da 447c2d2
Fix a bug in test core.
zheng-da 0cf3789
Limit MKLDNN ops being used.
zheng-da f6654d8
Fix complains from "make pylint"
zheng-da aa6c19f
Move ContainStorage to common/utils.h
zheng-da 460a0a8
Limit MKLDNN concat being used.
zheng-da e1d0064
Add license.
zheng-da b8bfd7f
Fix amalgamation
zheng-da df63a79
Fix compilation error in mkldnn_ops-inl.h
zheng-da 6934234
Fix a bug in deconvolution.
zheng-da 511ac71
Fix a bug in pooling.
zheng-da 9336bcc
MKLDNN ops allocates temp mem.
zheng-da a8d4138
Fix a bug in pooling.
zheng-da bbea66e
Allocate align memory from temp space.
zheng-da 84e60cd
Have parameter gradients stored in the default storage.
zheng-da ad6c35d
Handle all cases in CopyFrom.
zheng-da be0d5b9
Ensure NDArray returns memory with right memory descriptors.
zheng-da e186ee3
use auto to define memory in the operator.
zheng-da b3d9c16
Use raw pointer for mkldnn memory.
zheng-da c099520
Move more code to mkldnn_base.cc
zheng-da 04ec945
Fix a compilation error.
zheng-da 9562d96
Address review comments.
zheng-da 5842d56
fix a bug in activation backward.
zheng-da 4811bf2
Miss a macro in mkldnn_base.cc
zheng-da 7735fb6
Fix a bug in data iterator in examples.
zheng-da b77ceb3
Avoid memory allocation in ReshapeMKLDNN.
zheng-da 724631c
Avoid memory allocation in storage cast.
zheng-da 80a81a4
Fix a bug in cast storage.
zheng-da aedcfd6
Handle sliced MKLDNN NDArray.
zheng-da b35b74d
Use memcpy if NDArray uses default format.
zheng-da 2ea3ee2
Revert "Limit MKLDNN ops being used."
zheng-da 025be14
Enable mkldnn act backward has the same input layout.
zheng-da 74f8d75
Fix a bug in mkldnn activation.
zheng-da aff0541
Use MKLDNN sum in more cases.
zheng-da 0f98ce0
Improve perf of reorder.
zheng-da aa7afd4
Avoid memory reorder in conv and deconv.
zheng-da f35fa37
Avoid unnecessary storage cast in fallback path.
zheng-da 449b537
Revert "Use MKLDNN sum in more cases."
zheng-da db33412
Handle sliced ndarray in more cases.
zheng-da b9f913d
Fix a complain from make lint.
zheng-da 0f9f75a
Update Jenkins to test MKLDNN.
zheng-da ce87425
Add Dockerfile for CI.
zheng-da 3c41257
debug compiling mkldnn.
zheng-da 79aa7f3
Use MKLDNN sum in more cases.
zheng-da e7783f6
Add mkldnn as a submodule.
zheng-da 66a2557
Compile with mkldnn in 3rdparty.
zheng-da 84469a4
Fix some coding styles.
zheng-da faec6b2
download curl in ci build.
zheng-da 11f58e4
write the path to mkldnn lib in libmxnet.so.
zheng-da 8f61624
use rpath with $ORIGIN.
zheng-da d9eae20
Pack all lib files in Jenkins.
zheng-da cb97b07
pack and unpack mxnet with MKLDNN.
zheng-da 5dc3c42
Update Jenkinsfile
zheng-da 456086b
Update Jenkinsfile
zheng-da 9153471
Add mkldnn batch normalization
TaoLv 91fcd10
Fix bugs in BN.
zheng-da 4c3aeb5
Avoid memory allocation in MKLDNNCopy.
zheng-da 6507e82
only use MKLDNN BatchNorm for special cases.
zheng-da d47b744
Add MKL-DNN based LRN
pengzhao-intel e7ad056
Code Style Changes
pengzhao-intel 530e2b2
Fix a bug in BN.
zheng-da 72f27d5
Fix a bug in LRN.
zheng-da 9321cf3
Handle non-default storage in memory plan.
zheng-da 8c5414d
Merge branch 'refactor' of https://github.com/zheng-da/incubator-mxne…
zheng-da ea30336
Fix coding style.
zheng-da 7f74139
Fix a compilation error without mkldnn.
zheng-da 03fd841
Fix some coding styles for batch norm
TaoLv 42a7f7b
Merge pull request #4 from TaoLv/bn-fix
zheng-da 85e020f
a hack to speed up MKLDNN inference.
zheng-da fbb2fea
Merge branch 'refactor' of https://github.com/zheng-da/incubator-mxne…
zheng-da 7f643ac
Improve forward of convolution.
zheng-da 08a67ed
Add openmp and simd support to BN operator
TaoLv 313b80b
Retrieve MKLDNN Conv primitive based on signature.
zheng-da 550e5e6
Retrieve Act primitive based on its signature.
zheng-da 4122a7a
Fix a bug in pooling.
zheng-da e2ab086
Diable some MKLDNN activation and pooling.
zheng-da 80c43bd
Cast MKLDNN storage with diff data type.
zheng-da 4fd62cc
Check if it's a view of NDArray.
zheng-da e9e47c7
Reshaped and sliced arrays share the same chunks.
zheng-da a1423ef
Implement caching MKLDNN Act correctly.
zheng-da e2c5374
Fix a bug in check_consistency.
zheng-da fb040e6
Fix a potential bug when destroying NDArray.
zheng-da a10075a
Fix bugs when allocating mem in NDArray.
zheng-da 86945b0
Fix coding style.
zheng-da 69c39ac
Add micro when using mkldnn in ndarray.
zheng-da 5cd1adf
Fix a compilation error.
zheng-da f20f4c9
Add primitive and memory cache for BatchNorm
TaoLv 6836bf1
Remove saving reordered mkldnn mem.
zheng-da 47d9f92
Fix a bug in concat.
zheng-da a18b3de
Remove MKLDNNStorage.
zheng-da 8dba402
Force weight grad to use default layout.
zheng-da bcd3253
Reorder weight arrays in (de)conv for faster inference.
zheng-da c994548
handle diff layouts in CopyFromToDnsImpl.
zheng-da 7756b44
use NDArray::data() instead of fallback for arrays with MKLDNN layout.
zheng-da bdbc74b
Fix a bug in NDArray.
zheng-da 04ff469
Fix a bug in Flatten.
zheng-da 1bf2037
Fallback correctly.
zheng-da 79ac700
handle ndarray with def layout in mkldnn BN correctly.
zheng-da f8ff37f
Align to page when mkldnn is enabled.
zheng-da ac546bd
Use default mem alloc for mkldnn.
zheng-da fd33a69
Reuse NDArrays.
zheng-da 22fd0e1
Support WriteInplace for sum.
zheng-da 0ff5d85
Merge branch 'master' of https://github.com/apache/incubator-mxnet in…
zheng-da 489603e
Merge branch 'refactor' of https://github.com/zheng-da/incubator-mxne…
zheng-da 4eeffc9
fix complains from "make lint".
zheng-da f4b73db
Avoid reallocation in NDArray.
zheng-da c8578c0
Merge branch 'refactor' of https://github.com/zheng-da/incubator-mxne…
zheng-da ac8f9fd
Handle weight arrays with special MKLDNN layouts.
zheng-da 24200a0
Remove unnecessary GetWeights.
zheng-da 19d8749
Fix compilation error without MKLDNN.
zheng-da 18236fc
Fix a bug in (de)conv for weight arrays.
zheng-da 1cd8bad
Fix a minor bug in MKLDNN conv.
zheng-da 9b3c8b2
Avoid caching TBlob from NDArray.
zheng-da c426bfa
Fix a bug in MKLDNNOpSignature.
zheng-da 623b994
Merge remote-tracking branch 'da/refactor' into bn-primitive
TaoLv 5825191
1. Fix coding style in BatchNorm;
TaoLv 87fd9d5
Merge pull request #5 from TaoLv/bn-primitive
zheng-da 5cf7882
refact softmax op for mkldnn support
wentingj 5be0cca
fix code format
wentingj 9cf3264
softmax 1.rm not used req input; 2.use input_mem desc to create out_m…
wentingj 2ad8dca
use GetMKLDNNData to get input_mem, then use data_mpd to new this->out
wentingj 1037608
1.rm kMKLDNNStorage 2.key.AddSign mkldnn mem temporally
wentingj 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 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 |
---|---|---|
|
@@ -48,8 +48,7 @@ class MKLDNNSoftmaxFwd { | |
} | ||
~MKLDNNSoftmaxFwd() {} | ||
void SetDataHandle(const NDArray &in_data, | ||
const NDArray &out_data, | ||
const OpReqType &req) { | ||
const NDArray &out_data) { | ||
this->data->set_data_handle(in_data.GetMKLDNNData()->get_data_handle()); | ||
auto out_mem = const_cast<NDArray&>(out_data).CreateMKLDNNData(this->out->get_primitive_desc()); | ||
this->out->set_data_handle(out_mem->get_data_handle()); | ||
|
@@ -68,11 +67,10 @@ class MKLDNNSoftmaxFwd { | |
const OpReqType &req) { | ||
// mkldnn::softmax_forward::primitive_desc | ||
auto input_mem = in_data.GetMKLDNNData(); | ||
auto output_mem = out_data.GetMKLDNNData(); | ||
|
||
mkldnn::memory::primitive_desc data_mpd = input_mem->get_primitive_desc(); | ||
auto output_mem = CreateMKLDNNMem(out_data, data_mpd, req).second; | ||
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. if you use CreateMKLDNNMem, you have to use it with CommitOutput. You can't use CreateMKLDNNMem alone. |
||
mkldnn::memory::desc data_md = data_mpd.desc(); | ||
auto cpu_engine = data_mpd.get_engine(); | ||
auto cpu_engine = CpuEngine::Get()->get_engine(); | ||
auto prop = is_train | ||
? mkldnn::prop_kind::forward_training : mkldnn::prop_kind::forward_scoring; | ||
mkldnn::softmax_forward::desc desc = mkldnn::softmax_forward::desc(prop, | ||
|
@@ -107,8 +105,7 @@ static MKLDNNSoftmaxFwd &GetSoftmaxFwd(const SoftmaxParam& param, | |
auto it = fwds.find(key); | ||
if (it == fwds.end()) { | ||
MKLDNNSoftmaxFwd fwd(param, ctx.is_train, in_data, out_data, req); | ||
auto ins_ret = fwds.insert(std::pair<MKLDNNSmSignature, MKLDNNSoftmaxFwd>( | ||
key, fwd)); | ||
auto ins_ret = fwds.insert(std::pair<MKLDNNSmSignature, MKLDNNSoftmaxFwd>(key, fwd)); | ||
CHECK(ins_ret.second); | ||
it = ins_ret.first; | ||
} | ||
|
@@ -122,7 +119,7 @@ void MKLDNNSoftmaxCompute(const nnvm::NodeAttrs& attrs, | |
const NDArray &out_data) { | ||
const SoftmaxParam& param = nnvm::get<SoftmaxParam>(attrs.parsed); | ||
MKLDNNSoftmaxFwd &fwd = GetSoftmaxFwd(param, ctx, in_data, out_data, req); | ||
fwd.SetDataHandle(in_data, out_data, req); | ||
fwd.SetDataHandle(in_data, out_data); | ||
fwd.Execute(); | ||
} | ||
|
||
|
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.
req is not used in this function?