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

Commit

Permalink
[MKLDNN] Fix out of bound access of req vector (#16000)
Browse files Browse the repository at this point in the history
* remove unnecessary creation of req vector

* retrigger CI
  • Loading branch information
ciyongch authored and TaoLv committed Aug 26, 2019
1 parent c7a8a78 commit 5042d2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/operator/subgraph/mkldnn/mkldnn_conv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,12 @@ void SgMKLDNNConvOperator::Forward(const OpContext &ctx,
MKLDNNStream::Get()->Submit();
} else {
std::vector<NDArray> new_inputs;
std::vector<OpReqType> new_req;
if (has_bias) {
new_inputs = {data, cached_weight_, cached_bias_};
new_req = {req[in_data], req[in_weight], req[in_bias]};
} else {
new_inputs = {data, cached_weight_};
new_req = {req[in_data], req[in_weight]};
}
MKLDNNConvolutionForwardFullFeature(full_conv_param, ctx, fwd_.get(), new_inputs, new_req,
MKLDNNConvolutionForwardFullFeature(full_conv_param, ctx, fwd_.get(), new_inputs, req,
{output});
}

Expand Down
5 changes: 1 addition & 4 deletions src/operator/subgraph/mkldnn/mkldnn_fc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,13 @@ void SgMKLDNNFCOp::Forward(const OpContext &ctx,
initialized_ = true;
}
std::vector<NDArray> new_inputs;
std::vector<OpReqType> new_req;
if (has_bias) {
new_inputs = {data, weight, cached_bias_};
new_req = {req[fullc::kData], req[fullc::kWeight], req[fullc::kBias]};
} else {
new_inputs = {data, weight};
new_req = {req[fullc::kData], req[fullc::kWeight]};
}

MKLDNNFCForwardFullFeature(full_param_, ctx, fwd_.get(), new_inputs, new_req, out_data);
MKLDNNFCForwardFullFeature(full_param_, ctx, fwd_.get(), new_inputs, req, out_data);

if (mkldnn_param.quantized && !mkldnn_param.enable_float_output) {
float *min_output_ptr = out_data[quantized_fullc::kOutMin].data().dptr<float>();
Expand Down

0 comments on commit 5042d2a

Please sign in to comment.