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

[MKLDNN] Fix out of bound access of req vector #16000

Merged
merged 2 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 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