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

Reduce overhead in sg_onednn_fully_connected for floats #21092

Merged
merged 5 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix sanity
  • Loading branch information
Bartlomiej Gawrych committed Jul 11, 2022
commit 7bce4764340276215356ea4c998a0e2ed95da1e6
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void DNNLQuantizedFullyConnectedForward(const nnvm::NodeAttrs& attrs,
DNNLFCFullParam full_param;
full_param.default_param = param;
full_param.dnnl_param.Init(std::unordered_map<std::string, std::string>());
const size_t num_inputs = param.no_bias ? 2 : 3;
const size_t num_inputs = param.no_bias ? 2 : 3;

CHECK_EQ(in_data.size(), static_cast<size_t>(num_inputs * 3));
CHECK_EQ(out_data.size(), 3U);
Expand Down Expand Up @@ -90,8 +90,8 @@ void DNNLQuantizedFullyConnectedForward(const nnvm::NodeAttrs& attrs,
bool is_train = false;
dnnl::memory::desc out_md = GetMemDesc(out_data[fullc::kOut]);
DNNLFCFlattenData(param, out_data[fullc::kOut], &data, &out_md);
auto& fwd =
GetFCFwd(full_param, is_train, data, weight, param.no_bias ? nullptr : &quantized_bias, out_md);
auto& fwd = GetFCFwd(
full_param, is_train, data, weight, param.no_bias ? nullptr : &quantized_bias, out_md);

auto fwd_src_desc = fwd.fwd_pd.src_desc();
auto data_mem = in_data[fullc::kData].GetDNNLDataReorder(&fwd_src_desc);
Expand Down
8 changes: 4 additions & 4 deletions src/operator/subgraph/dnnl/dnnl_fc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ void SgDNNLFCOp::Forward(const OpContext& ctx,
const std::vector<NDArray>& out_data) {
const FCInputIndex idx(full_param_);
CHECK_EQ(in_data.size(), idx.GetTotal());
const int out_index = 0;
const int out_min_index = 1;
const int out_max_index = 2;
const int out_index = 0;
const int out_min_index = 1;
const int out_max_index = 2;

const auto& default_param = full_param_.default_param;
const auto& dnnl_param = full_param_.dnnl_param;
Expand All @@ -134,7 +134,7 @@ void SgDNNLFCOp::Forward(const OpContext& ctx,
return;
}

const bool has_bias = !default_param.no_bias;
const bool has_bias = !default_param.no_bias;
const bool channel_wise =
dnnl_param.channel_wise_quantize.has_value() && dnnl_param.channel_wise_quantize.value();

Expand Down