Skip to content

Commit

Permalink
[script] Validator for unsupported ops on accelerator
Browse files Browse the repository at this point in the history
Summary:
ATT

Next step:
1. integrate with dper flow.
2. Support in bento after diff is pushed to prod.

Test Plan:
buck run mode/opt-clang sigrid/predictor/scripts:check_accelerator_unsupported_ops -- --model_entity_id=232891739

I0106 17:08:36.425796 1238141 pybind_state.cc:531] Unsupported ops: Fused8BitRowwiseQuantizedToFloat

Reviewed By: khabinov

Differential Revision: D25818253

fbshipit-source-id: 8d8556b0400c1747f154b0517352f1685f1aa8b1
  • Loading branch information
ChunliF authored and facebook-github-bot committed Jan 7, 2021
1 parent 968ad47 commit 321b988
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions caffe2/opt/onnxifi_transformer.cc
Expand Up @@ -1195,11 +1195,11 @@ void OnnxifiTransformer::applyFilteringRules(
blocklistCpuPartition(net, blocklisted_ops);
}

void OnnxifiTransformer::getBackendId() {
std::vector<onnxBackendID> OnnxifiTransformer::getBackendId() {
idx_ = 0;

if (opts_.use_onnx) {
return;
return backend_ids_;
}
// Try to find a backend that support Caffe2 proto. Note that this is quite
// opportunistic as we don't officially support Caffe2 proto.
Expand All @@ -1214,6 +1214,7 @@ void OnnxifiTransformer::getBackendId() {
break;
}
}
return backend_ids_;
}

NetDef OnnxifiTransformer::TransformViaC2(
Expand Down
22 changes: 11 additions & 11 deletions caffe2/opt/onnxifi_transformer.h
Expand Up @@ -61,6 +61,17 @@ class TORCH_API OnnxifiTransformer final : public BackendTransformerBase {
const ShapeInfoMap& shape_hints,
const std::unordered_set<int>& blocklisted_ops) override;

// Query whether an operator is supported by passing C2 protobuf
bool supportOpC2(
const caffe2::OperatorDef& op,
const ShapeInfoMap& shape_hints,
const std::unordered_set<std::string>& weights,
const std::unordered_set<int>& blocklisted_ops,
onnxBackendID backend_id) const;

// Determine backend id
std::vector<onnxBackendID> getBackendId();

private:
// Since we create new tensors during the conversion process, we actually need
// into inject them into the original workspace
Expand Down Expand Up @@ -114,14 +125,6 @@ class TORCH_API OnnxifiTransformer final : public BackendTransformerBase {
ShapeInfoMap* shape_hints_max_bs,
const std::unordered_map<int, ShapeInfoMap> &shape_hints_per_bs);

// Query whether an operator is supported by passing C2 protobuf
bool supportOpC2(
const caffe2::OperatorDef& op,
const ShapeInfoMap& shape_hints,
const std::unordered_set<std::string>& weights,
const std::unordered_set<int>& blocklisted_ops,
onnxBackendID backend_id) const;

// Query whether an operator is supported by passing ONNX protobuf
bool supportOpOnnx(
const caffe2::OperatorDef& op,
Expand Down Expand Up @@ -152,9 +155,6 @@ class TORCH_API OnnxifiTransformer final : public BackendTransformerBase {
const std::unordered_set<std::string>& weights,
std::unordered_set<int>* blocklisted_ops) const;

// Determine backend id
void getBackendId();

// Extract partition info from the original net
void extractPartitionInfo(const NetDef& net);

Expand Down

0 comments on commit 321b988

Please sign in to comment.