mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/57366 We often get error messages such as ``` Model failed AOT (glow ahead-of-time compilation) with exception: Error during AOT optimization (non-provisioned addNetwork): Non-recoverable device error when adding network: Error code: PARTITIONER_ERROR Error message: Did not find a partition with an SLS node Error return stack: -------------------------------------------------------------------------------- glow/glow/lib/Partitioner/Partitioner.cpp:1244 -------------------------------------------------------------------------------- glow/glow/lib/Runtime/HostManager/HostManager.cpp:375 -------------------------------------------------------------------------------- ``` This makes the error message more clear by checking for the number of OnnixifiOp created before going into Glow. The check is enabled with the `verify_only_single_subnet` flag, and is disabled by default. Test Plan: Unit tests pass Reviewed By: khabinov Differential Revision: D28097674 fbshipit-source-id: 0eefd8f6ec1a82546b759be8e541256bf271a673
46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_set>
|
|
#include <vector>
|
|
|
|
#include <caffe2/core/net.h>
|
|
#include <caffe2/core/workspace.h>
|
|
#include <caffe2/opt/shape_info.h>
|
|
#include <caffe2/proto/caffe2_pb.h>
|
|
|
|
C10_DECLARE_string(onnxifi_blacklist);
|
|
C10_DECLARE_string(onnxifi_blacklist_ops);
|
|
|
|
namespace caffe2 {
|
|
namespace glow {
|
|
/// Onnxifi transformation on the net and workspace. We also
|
|
/// needed the input data/shape to populate the shape. In addition, we take a \p
|
|
/// blocklist to control and mask what ops we want to consider in onnxifi
|
|
/// process. We can also set whether to use ONNX proto or C2 proto through
|
|
/// ONNXIFI interface.
|
|
void onnxifi(
|
|
NetDef* net,
|
|
Workspace* ws,
|
|
const std::vector<std::string>& input_names,
|
|
const std::vector<std::string>& output_names,
|
|
const std::vector<std::string>& weight_names,
|
|
const std::unordered_set<int>& blocklist,
|
|
const ShapeInfoMap& shape_hints_max_bs,
|
|
bool use_onnx,
|
|
size_t max_batch_size = 0,
|
|
size_t max_seq_size = 0,
|
|
bool load_model_by_blob = false,
|
|
bool predictor_net_ssa_rewritten = false,
|
|
const std::unordered_map<int, ShapeInfoMap> &shape_hints_per_bs = {},
|
|
const c10::optional<std::string> &blacklist_ops = c10::nullopt,
|
|
const c10::optional<size_t> &min_ops = c10::nullopt,
|
|
const std::unordered_set<std::string> &blocklist_blobs = {},
|
|
const c10::optional<bool> & verify_only_single_subnet = c10::nullopt);
|
|
|
|
std::unordered_set<int> ParseNetPositionList(const std::string& str);
|
|
std::unordered_set<std::string> ParseBlockListOps(const std::string& str);
|
|
|
|
} // namespace glow
|
|
} // namespace caffe2
|