forked from huawei/mindspore2022
codex clean 2
This commit is contained in:
parent
debd27a9f2
commit
41c8f2ffb6
|
|
@ -63,7 +63,7 @@ class Messager:
|
|||
logger.debug("[TRACE] read nothing...")
|
||||
self.exit()
|
||||
if res[len(res) - 1] == '\n':
|
||||
res = res[0:len(res)-1]
|
||||
res = res[0:len(res) - 1]
|
||||
self.message = res
|
||||
logger.debug(f"[IN] {self.message}")
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
|
|
@ -87,7 +87,7 @@ class Messager:
|
|||
res_str = str(res).replace('\n', '[LF]').replace('\r', '[CR]').replace(' ', '[SP]')
|
||||
else:
|
||||
res_str = str(res).replace('\n', '').replace('\r', '').replace(' ', '')
|
||||
tag = '[~]' # The same as client kTAG
|
||||
tag = '[~]' # The same as client kTAG
|
||||
|
||||
# Not write by print(tag + res_str, flush=True) any more
|
||||
try:
|
||||
|
|
@ -139,5 +139,6 @@ class Messager:
|
|||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def get_logger():
|
||||
return logger
|
||||
|
|
|
|||
|
|
@ -58,12 +58,10 @@ class AscendMessager(Messager):
|
|||
self.tbe_builder = TbeBuilder()
|
||||
self.akg_builder = AkgBuilder()
|
||||
|
||||
def handle(self):
|
||||
def tbe_handle(self, arg):
|
||||
"""
|
||||
Communicate with remote client.
|
||||
Reference protocol between them at PR#3821 and PR#3935
|
||||
Handle arg start with TBE
|
||||
"""
|
||||
arg = self.get_message()
|
||||
if arg == 'TBE/PRE':
|
||||
ans = self.tbe_builder.create()
|
||||
self.send_res(ans)
|
||||
|
|
@ -96,7 +94,15 @@ class AscendMessager(Messager):
|
|||
elif arg == 'TBE/RESET':
|
||||
self.tbe_builder.reset()
|
||||
self.send_ack()
|
||||
elif arg == 'AKG/START':
|
||||
else:
|
||||
self.send_ack(False)
|
||||
self.exit()
|
||||
|
||||
def akg_handle(self, arg):
|
||||
"""
|
||||
Handle arg start with AKG
|
||||
"""
|
||||
if arg == 'AKG/START':
|
||||
self.send_ack()
|
||||
process_num_str = self.get_message()
|
||||
self.send_ack()
|
||||
|
|
@ -117,6 +123,20 @@ class AscendMessager(Messager):
|
|||
else:
|
||||
self.send_ack(False)
|
||||
break
|
||||
else:
|
||||
self.send_ack(False)
|
||||
self.exit()
|
||||
|
||||
def handle(self):
|
||||
"""
|
||||
Communicate with remote client.
|
||||
Reference protocol between them at PR#3821 and PR#3935
|
||||
"""
|
||||
arg = self.get_message()
|
||||
if arg.startswith('TBE'):
|
||||
self.tbe_handle(arg)
|
||||
elif arg.startswith('AKG'):
|
||||
self.akg_handle(arg)
|
||||
elif arg == 'FORMAT':
|
||||
self.send_ack()
|
||||
json = self.get_message()
|
||||
|
|
|
|||
|
|
@ -43,20 +43,25 @@ def cell_attr_register(fn=None, attrs=None):
|
|||
del arguments['self']
|
||||
arguments = arguments.values()
|
||||
fn(self, *args, **kwargs)
|
||||
if attrs is not None:
|
||||
if isinstance(attrs, list):
|
||||
for item in attrs:
|
||||
if not isinstance(item, str):
|
||||
raise ValueError(f"attr must be a string")
|
||||
if hasattr(self, item):
|
||||
arguments.append(getattr(self, item))
|
||||
elif isinstance(attrs, str):
|
||||
if hasattr(self, attrs):
|
||||
arguments = getattr(self, attrs)
|
||||
else:
|
||||
raise ValueError(f"attrs must be list or string")
|
||||
if attrs is None:
|
||||
self.cell_init_args = type(self).__name__ + str(arguments)
|
||||
return
|
||||
|
||||
if isinstance(attrs, list):
|
||||
for item in attrs:
|
||||
if not isinstance(item, str):
|
||||
raise ValueError(f"attr must be a string")
|
||||
if hasattr(self, item):
|
||||
arguments.append(getattr(self, item))
|
||||
elif isinstance(attrs, str):
|
||||
if hasattr(self, attrs):
|
||||
arguments = getattr(self, attrs)
|
||||
else:
|
||||
raise ValueError(f"attrs must be list or string")
|
||||
self.cell_init_args = type(self).__name__ + str(arguments)
|
||||
|
||||
return deco
|
||||
|
||||
if fn is not None:
|
||||
return wrap_cell(fn)
|
||||
return wrap_cell
|
||||
|
|
|
|||
|
|
@ -299,6 +299,25 @@ void DumpParallelInfo(const CNodePtr &node, const std::shared_ptr<SubGraphIRInfo
|
|||
gsub->buffer << " }";
|
||||
}
|
||||
|
||||
void DumpAttrs(const std::unordered_map<std::string, ValuePtr> &attrs, const std::shared_ptr<SubGraphIRInfo> &gsub,
|
||||
bool check_strategy = false) {
|
||||
int i = 0;
|
||||
for (const auto &attr : attrs) {
|
||||
if (check_strategy && attr.first == PARALLEL_STRATEGY) {
|
||||
continue; // skip the strategy
|
||||
}
|
||||
if (i++ != 0) {
|
||||
gsub->buffer << ", ";
|
||||
}
|
||||
gsub->buffer << attr.first << ": ";
|
||||
if (attr.second == nullptr) {
|
||||
gsub->buffer << "null";
|
||||
} else {
|
||||
gsub->buffer << attr.second->ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DumpOperateAttrs(const AnfNodePtr &op, const std::shared_ptr<SubGraphIRInfo> &gsub) {
|
||||
if (op == nullptr || gsub == nullptr) {
|
||||
return;
|
||||
|
|
@ -316,21 +335,7 @@ void DumpOperateAttrs(const AnfNodePtr &op, const std::shared_ptr<SubGraphIRInfo
|
|||
auto attrs = primitive->attrs();
|
||||
if (!attrs.empty()) {
|
||||
gsub->buffer << " primitive_attrs: {";
|
||||
int i = 0;
|
||||
for (const auto &attr : attrs) {
|
||||
if (attr.first == PARALLEL_STRATEGY) {
|
||||
continue; // skip the strategy
|
||||
}
|
||||
if (i++ != 0) {
|
||||
gsub->buffer << ", ";
|
||||
}
|
||||
gsub->buffer << attr.first << ": ";
|
||||
if (attr.second == nullptr) {
|
||||
gsub->buffer << "null";
|
||||
} else {
|
||||
gsub->buffer << attr.second->ToString();
|
||||
}
|
||||
}
|
||||
DumpAttrs(attrs, gsub, true);
|
||||
gsub->buffer << "}";
|
||||
}
|
||||
}
|
||||
|
|
@ -346,18 +351,7 @@ void DumpCNodeAttrs(const CNodePtr &op, const std::shared_ptr<SubGraphIRInfo> &g
|
|||
|
||||
auto attrs = op->attrs();
|
||||
gsub->buffer << " cnode_attrs: {";
|
||||
int i = 0;
|
||||
for (const auto &attr : attrs) {
|
||||
if (i++ != 0) {
|
||||
gsub->buffer << ", ";
|
||||
}
|
||||
gsub->buffer << attr.first << ": ";
|
||||
if (attr.second == nullptr) {
|
||||
gsub->buffer << "null";
|
||||
} else {
|
||||
gsub->buffer << attr.second->ToString();
|
||||
}
|
||||
}
|
||||
DumpAttrs(attrs, gsub);
|
||||
gsub->buffer << "}";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ namespace mindspore {
|
|||
namespace prim {
|
||||
MultitypeFuncGraph::MultitypeFuncGraph(const std::string &name) : MetaFuncGraph(name) {
|
||||
fn_cache_.clear();
|
||||
signatures_ = std::vector<Signature>({// def multitype(*args:ref):
|
||||
{"args", SignatureEnumRW::kRWRef, SignatureEnumKind::kKindVarPositional}});
|
||||
// def multitype(*args:ref):
|
||||
signatures_ = std::vector<Signature>({{"args", SignatureEnumRW::kRWRef, SignatureEnumKind::kKindVarPositional}});
|
||||
}
|
||||
|
||||
void MultitypeFuncGraph::Register(const TypePtrList &types, specialize_fn s_fn) {
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ FuncGraphPtr ConvertToBpropCut(const py::object &obj) {
|
|||
|
||||
py::object code_obj = py::getattr(bprop_func, "__code__");
|
||||
// Three parameters self, out and dout need to be excluded
|
||||
size_t inputs_num = py::cast<int64_t>(py::getattr(code_obj, "co_argcount")) - 3;
|
||||
constexpr auto kBpropExcludeParamNum = 3;
|
||||
size_t inputs_num = py::cast<int64_t>(py::getattr(code_obj, "co_argcount")) - kBpropExcludeParamNum;
|
||||
for (size_t i = 0; i < inputs_num; ++i) {
|
||||
auto param = bprop_graph->add_parameter();
|
||||
outputs.push_back(param);
|
||||
|
|
|
|||
|
|
@ -966,7 +966,6 @@ EvalResultPtr StaticGetter(const AnalysisEnginePtr &engine, const AbstractBasePt
|
|||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
// static variable start;
|
||||
namespace {
|
||||
class EmbedEvaluator : public SymbolicPrimEvaluator {
|
||||
public:
|
||||
|
|
@ -1067,14 +1066,14 @@ class GetAttrEvaluator : public TransitionPrimEvaluator {
|
|||
MS_DECLARE_PARENT(GetAttrEvaluator, TransitionPrimEvaluator);
|
||||
EvalResultPtr EvalPrim(const AnalysisEnginePtr &engine, const AbstractBasePtrList &args_spec_list,
|
||||
const ConfigPtr &in_conf0, const AnfNodeConfigPtr &out_conf) override {
|
||||
constexpr auto kGetAttrArgSize = 2;
|
||||
auto ret_abstract = AbstractEval(args_spec_list);
|
||||
if (ret_abstract != nullptr) {
|
||||
MS_LOG(DEBUG) << "GetAttrEvaluator eval Undetermined";
|
||||
return ret_abstract;
|
||||
}
|
||||
// Inputs: data, item
|
||||
constexpr size_t input_size = 2;
|
||||
if (args_spec_list.size() != input_size) {
|
||||
if (args_spec_list.size() != kGetAttrArgSize) {
|
||||
MS_LOG(EXCEPTION) << "Expected args_spec_list size = 2, but has size:" << args_spec_list.size();
|
||||
}
|
||||
EvalResultPtr ret = nullptr;
|
||||
|
|
@ -1098,8 +1097,9 @@ class ResolveEvaluator : public TransitionPrimEvaluator {
|
|||
MS_DECLARE_PARENT(ResolveEvaluator, TransitionPrimEvaluator);
|
||||
EvalResultPtr EvalPrim(const AnalysisEnginePtr &engine, const AbstractBasePtrList &args_spec_list,
|
||||
const ConfigPtr &in_conf0, const AnfNodeConfigPtr &out_conf) override {
|
||||
constexpr auto kResolveArgSize = 2;
|
||||
// Inputs: namespace, symbol
|
||||
if (args_spec_list.size() != 2) {
|
||||
if (args_spec_list.size() != kResolveArgSize) {
|
||||
MS_LOG(EXCEPTION) << "Expected args_spec_list size = 2, but has size:" << args_spec_list.size();
|
||||
}
|
||||
EvalResultPtr ret = nullptr;
|
||||
|
|
|
|||
|
|
@ -714,11 +714,11 @@ EvalResultPtr AnalysisEngine::ExecuteMultipleEvaluators(const std::vector<Evalua
|
|||
// Try to travel the latest undetermined.
|
||||
if (latest_entry != eval_trace_.rbegin()->evaluator_) {
|
||||
MS_LOG(DEBUG) << "Direct Run Evaluator " << eval.get() << "----" << eval->ToString();
|
||||
auto eval_result = latest_entry->Run(shared_from_this(), args_conf_list, out_conf);
|
||||
MS_EXCEPTION_IF_NULL(eval_result->abstract());
|
||||
auto latest_entry_eval_result = latest_entry->Run(shared_from_this(), args_conf_list, out_conf);
|
||||
MS_EXCEPTION_IF_NULL(latest_entry_eval_result->abstract());
|
||||
MS_LOG(DEBUG) << "end Direct Evaluator " << latest_entry->ToString()
|
||||
<< " return out_spec: " << eval_result->abstract()->ToString();
|
||||
return eval_result;
|
||||
<< " return out_spec: " << latest_entry_eval_result->abstract()->ToString();
|
||||
return latest_entry_eval_result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ std::size_t AbstractSequeue::hash() const {
|
|||
return hash_sum;
|
||||
}
|
||||
|
||||
bool AbstractTuple::operator==(const AbstractTuple &other) const {
|
||||
bool AbstractSequeue::operator==(const AbstractSequeue &other) const {
|
||||
if (&other == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -313,6 +313,8 @@ bool AbstractTuple::operator==(const AbstractTuple &other) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AbstractTuple::operator==(const AbstractTuple &other) const { return AbstractSequeue::operator==(other); }
|
||||
|
||||
bool AbstractTuple::operator==(const AbstractBase &other) const {
|
||||
if (&other == this) {
|
||||
return true;
|
||||
|
|
@ -326,21 +328,7 @@ bool AbstractTuple::operator==(const AbstractBase &other) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool AbstractList::operator==(const AbstractList &other) const {
|
||||
if (&other == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (elements_.size() != other.elements_.size()) {
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < elements_.size(); i++) {
|
||||
if (!(*(elements_[i]) == *(other.elements_[i]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool AbstractList::operator==(const AbstractList &other) const { return AbstractSequeue::operator==(other); }
|
||||
|
||||
bool AbstractList::operator==(const AbstractBase &other) const {
|
||||
if (&other == this) {
|
||||
|
|
@ -465,9 +453,7 @@ AbstractBasePtr AbstractTensor::Join(const AbstractBasePtr &other) {
|
|||
if (element == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
auto shape = ShapeJoin(this->shape(), other_undetermined_tensor->shape());
|
||||
auto ret = std::make_shared<AbstractUndetermined>(element, shape);
|
||||
return ret;
|
||||
return std::make_shared<AbstractUndetermined>(element, ShapeJoin(shape(), other_undetermined_tensor->shape()));
|
||||
}
|
||||
auto other_tensor = dyn_cast<AbstractTensor>(other);
|
||||
if (other_tensor == nullptr) {
|
||||
|
|
@ -480,8 +466,7 @@ AbstractBasePtr AbstractTensor::Join(const AbstractBasePtr &other) {
|
|||
if (element == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
auto shape = ShapeJoin(this->shape(), other_tensor->shape());
|
||||
return std::make_shared<AbstractTensor>(element, shape);
|
||||
return std::make_shared<AbstractTensor>(element, ShapeJoin(this->shape(), other_tensor->shape()));
|
||||
}
|
||||
|
||||
bool AbstractTensor::equal_to(const AbstractTensor &other) const {
|
||||
|
|
@ -1076,7 +1061,8 @@ std::size_t AbstractBasePtrListHash(const AbstractBasePtrList &args_spec_list) {
|
|||
std::size_t hash_value = 0;
|
||||
// Hashing all elements is costly, so only take at most 4 elements into account based on
|
||||
// some experiments.
|
||||
for (size_t i = 0; (i < args_spec_list.size()) && (i < 4); i++) {
|
||||
constexpr auto kMaxElementsNum = 4;
|
||||
for (size_t i = 0; (i < args_spec_list.size()) && (i < kMaxElementsNum); i++) {
|
||||
MS_EXCEPTION_IF_NULL(args_spec_list[i]);
|
||||
hash_value = hash_combine(hash_value, args_spec_list[i]->hash());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ class AbstractSequeue : public AbstractBase {
|
|||
std::size_t hash() const override;
|
||||
std::string ToString() const override;
|
||||
const AbstractBasePtr operator[](const std::size_t &dim) const;
|
||||
virtual bool operator==(const AbstractSequeue &other) const;
|
||||
|
||||
protected:
|
||||
AbstractBasePtrList elements_;
|
||||
|
|
@ -409,6 +410,7 @@ class AbstractList : public AbstractSequeue {
|
|||
std::string ToString() const override { return type_name() + "[" + AbstractSequeue::ToString() + "]"; }
|
||||
|
||||
bool operator==(const AbstractList &other) const;
|
||||
|
||||
bool operator==(const AbstractBase &other) const override;
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -364,8 +364,9 @@ AbstractBasePtr InferImplUnsortedSegmentMin(const AnalysisEnginePtr &, const Pri
|
|||
|
||||
AbstractBasePtr InferImplScatterAdd(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
constexpr auto kScatterAddInputNum = 3;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckRequiredArgsSize(op_name, args_spec_list, 3);
|
||||
CheckRequiredArgsSize(op_name, args_spec_list, kScatterAddInputNum);
|
||||
auto x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(x);
|
||||
MS_EXCEPTION_IF_NULL(x->shape());
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ namespace abstract {
|
|||
AbstractBasePtr InferImplMinOrMaxGrad(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: three tensors.
|
||||
const std::string op_name = primitive->name();
|
||||
const size_t args_size = 3;
|
||||
constexpr auto kMinMaxGradInputNum = 3;
|
||||
const size_t dout_index = 2;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, kMinMaxGradInputNum);
|
||||
auto input_x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
auto input_y = CheckArg<AbstractTensor>(op_name, args_spec_list, 1);
|
||||
auto dout = CheckArg<AbstractTensor>(op_name, args_spec_list, dout_index);
|
||||
|
|
@ -43,8 +43,9 @@ AbstractBasePtr InferImplMinOrMaxGrad(const AnalysisEnginePtr &, const Primitive
|
|||
AbstractBasePtr InferImplSqrt(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: three tensors.
|
||||
constexpr auto kSqrtInputNum = 1;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 1);
|
||||
CheckArgsSize(op_name, args_spec_list, kSqrtInputNum);
|
||||
auto inp = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
return inp->Clone()->Broaden();
|
||||
}
|
||||
|
|
@ -52,8 +53,9 @@ AbstractBasePtr InferImplSqrt(const AnalysisEnginePtr &, const PrimitivePtr &pri
|
|||
AbstractBasePtr InferImplSqrtGrad(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: two tensors.
|
||||
constexpr auto kSqrtGradInputNum = 2;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
CheckArgsSize(op_name, args_spec_list, kSqrtGradInputNum);
|
||||
auto out = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
auto dout = CheckArg<AbstractTensor>(op_name, args_spec_list, 1);
|
||||
(void)CheckDtypeSame(op_name, out, dout);
|
||||
|
|
@ -65,8 +67,9 @@ AbstractBasePtr InferImplSqrtGrad(const AnalysisEnginePtr &, const PrimitivePtr
|
|||
AbstractBasePtr InferImplSquare(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: one tensor.
|
||||
constexpr auto kSqrtSquareInputNum = 1;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 1);
|
||||
CheckArgsSize(op_name, args_spec_list, kSqrtSquareInputNum);
|
||||
auto ref = dyn_cast<abstract::AbstractRef>(args_spec_list[0]);
|
||||
if (ref != nullptr) {
|
||||
return ref->CloneAsTensor();
|
||||
|
|
@ -76,8 +79,9 @@ AbstractBasePtr InferImplSquare(const AnalysisEnginePtr &, const PrimitivePtr &p
|
|||
|
||||
AbstractBasePtr InferImplEqual(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
constexpr auto kEqualInputNum = 2;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
CheckArgsSize(op_name, args_spec_list, kEqualInputNum);
|
||||
auto x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(x);
|
||||
MS_EXCEPTION_IF_NULL(x->shape());
|
||||
|
|
@ -94,7 +98,7 @@ AbstractBasePtr InferImplEqual(const AnalysisEnginePtr &, const PrimitivePtr &pr
|
|||
|
||||
auto out_shape = BroadcastShape(x_shape, y_shape);
|
||||
if (out_shape.empty()) {
|
||||
MS_LOG(EXCEPTION) << "BroadcastShape fail: " << args_spec_list[0]->ToString() << ","
|
||||
MS_LOG(EXCEPTION) << "Equal op BroadcastShape fail: " << args_spec_list[0]->ToString() << ","
|
||||
<< args_spec_list[1]->ToString();
|
||||
}
|
||||
auto out_shape_min = BroadcastShape(x_shape_min, y_shape_min);
|
||||
|
|
@ -165,8 +169,9 @@ void InferImplReduceFuncCalShape(ShapeVector *shape, const ShapeVector &x_shape,
|
|||
// ReduceAll, ReduceAny, ReduceMax, ReduceMin.
|
||||
AbstractBasePtr InferImplReduceFunc(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
const auto kReduceInputNum = 1;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 1);
|
||||
CheckArgsSize(op_name, args_spec_list, kReduceInputNum);
|
||||
auto input_x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(input_x);
|
||||
MS_EXCEPTION_IF_NULL(input_x->element());
|
||||
|
|
@ -200,9 +205,9 @@ AbstractBasePtr InferImplReduceFunc(const AnalysisEnginePtr &, const PrimitivePt
|
|||
|
||||
AbstractBasePtr InferImplBinaryBase(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
constexpr auto kBinaryBaseInputNum = 2;
|
||||
const std::string op_name = primitive->name();
|
||||
constexpr size_t args_size = 2;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
CheckArgsSize(op_name, args_spec_list, kBinaryBaseInputNum);
|
||||
auto input_x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(input_x);
|
||||
MS_EXCEPTION_IF_NULL(input_x->shape());
|
||||
|
|
@ -273,9 +278,9 @@ AbstractBasePtr InferImplDivNoNan(const AnalysisEnginePtr &engine_ptr, const Pri
|
|||
|
||||
AbstractBasePtr InferImplLinSpace(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
constexpr auto kLinSpaceInputNum = 3;
|
||||
const std::string op_name = primitive->name();
|
||||
constexpr size_t args_size = 3;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
CheckArgsSize(op_name, args_spec_list, kLinSpaceInputNum);
|
||||
auto start = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(start);
|
||||
MS_EXCEPTION_IF_NULL(start->shape());
|
||||
|
|
@ -318,8 +323,9 @@ AbstractBasePtr InferImplLinSpace(const AnalysisEnginePtr &, const PrimitivePtr
|
|||
|
||||
AbstractBasePtr InferImplMatMul(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
constexpr auto kMatMulInputNum = 2;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
CheckArgsSize(op_name, args_spec_list, kMatMulInputNum);
|
||||
auto x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(x);
|
||||
MS_EXCEPTION_IF_NULL(x->shape());
|
||||
|
|
@ -375,8 +381,9 @@ AbstractBasePtr InferImplMatMul(const AnalysisEnginePtr &, const PrimitivePtr &p
|
|||
|
||||
AbstractBasePtr InferImplBatchMatMul(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
constexpr auto kBatchMatMulInputNum = 2;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
CheckArgsSize(op_name, args_spec_list, kBatchMatMulInputNum);
|
||||
auto x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(x);
|
||||
MS_EXCEPTION_IF_NULL(x->shape());
|
||||
|
|
@ -446,8 +453,9 @@ AbstractBasePtr InferImplBatchMatMul(const AnalysisEnginePtr &, const PrimitiveP
|
|||
|
||||
AbstractBasePtr InferImplLess(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
constexpr auto kLessInputNum = 2;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
CheckArgsSize(op_name, args_spec_list, kLessInputNum);
|
||||
auto x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(x);
|
||||
MS_EXCEPTION_IF_NULL(x->shape());
|
||||
|
|
@ -464,7 +472,7 @@ AbstractBasePtr InferImplLess(const AnalysisEnginePtr &, const PrimitivePtr &pri
|
|||
|
||||
auto out_shape = BroadcastShape(x_shape, y_shape);
|
||||
if (out_shape.empty()) {
|
||||
MS_LOG(EXCEPTION) << "BroadcastShape fail: " << args_spec_list[0]->ToString() << ","
|
||||
MS_LOG(EXCEPTION) << "Less op BroadcastShape fail: " << args_spec_list[0]->ToString() << ","
|
||||
<< args_spec_list[1]->ToString();
|
||||
}
|
||||
auto out_shape_min = BroadcastShape(x_shape_min, y_shape_min);
|
||||
|
|
|
|||
|
|
@ -107,8 +107,9 @@ AbstractBasePtr InferImplPooling(const AnalysisEnginePtr &, const PrimitivePtr &
|
|||
AbstractBasePtr InferImplPoolingGrad(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: three tensors(y, dy, x).
|
||||
constexpr auto kPoolingGradInputNum = 3;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 3);
|
||||
CheckArgsSize(op_name, args_spec_list, kPoolingGradInputNum);
|
||||
auto out_y = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
auto d_out = CheckArg<AbstractTensor>(op_name, args_spec_list, 1);
|
||||
auto input_x = CheckArg<AbstractTensor>(op_name, args_spec_list, 2);
|
||||
|
|
@ -152,8 +153,9 @@ void FusedBatchNormCheckDim(const PrimitivePtr &primitive, const AbstractBasePtr
|
|||
AbstractBasePtr InferImplBatchNorm(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: five tensors(x, gamma, beta, mean, variance).
|
||||
constexpr auto kBatchNormInputNum = 5;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 5);
|
||||
CheckArgsSize(op_name, args_spec_list, kBatchNormInputNum);
|
||||
AbstractTensorPtr input_x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(input_x);
|
||||
MS_EXCEPTION_IF_NULL(input_x->shape());
|
||||
|
|
@ -266,8 +268,9 @@ void CheckShape(const std::string &op_name, const ShapeVector &w_shape, const Ab
|
|||
|
||||
AbstractBasePtr InferImplConv2D(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
constexpr auto kConv2DInputNum = 2;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
CheckArgsSize(op_name, args_spec_list, kConv2DInputNum);
|
||||
AbstractTensorPtr input_x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(input_x);
|
||||
MS_EXCEPTION_IF_NULL(input_x->shape());
|
||||
|
|
|
|||
|
|
@ -295,8 +295,9 @@ AbstractBasePtr InferImplRowTensorAdd(const AnalysisEnginePtr &, const Primitive
|
|||
AbstractBasePtr InferImplMakeSparseTensor(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: two tensors and a tuple.
|
||||
constexpr auto kMakeSparseInputNum = 3;
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 3);
|
||||
CheckArgsSize(op_name, args_spec_list, kMakeSparseInputNum);
|
||||
auto indices = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
auto values = CheckArg<AbstractTensor>(op_name, args_spec_list, 1);
|
||||
auto dense_shape = CheckArg<AbstractTuple>(op_name, args_spec_list, 2);
|
||||
|
|
|
|||
|
|
@ -68,9 +68,10 @@ AbstractBasePtr InferImplSwitch(const AnalysisEnginePtr &, const PrimitivePtr &p
|
|||
|
||||
AbstractBasePtr InferImplSwitchLayer(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: index, branch
|
||||
// Inputs: {index, MakeTuple{branch1,branch2,branch3....}}
|
||||
constexpr auto kSwitchLayerInputNum = 2;
|
||||
const std::string op_name = primitive->name();
|
||||
abstract::CheckArgsSize(op_name, args_spec_list, 2);
|
||||
abstract::CheckArgsSize(op_name, args_spec_list, kSwitchLayerInputNum);
|
||||
auto index = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
auto &input_shape = index->shape()->shape();
|
||||
if (input_shape.size() != 0) {
|
||||
|
|
|
|||
|
|
@ -19,9 +19,39 @@
|
|||
#include "utils/log_adapter.h"
|
||||
|
||||
namespace mindspore {
|
||||
const char *GetSubModuleName(SubModuleId module_id, const char **sub_module_names) {
|
||||
return sub_module_names[module_id % NUM_SUBMODUES];
|
||||
}
|
||||
static const std::vector<std::string> sub_module_names = {
|
||||
"UNKNOWN", // SM_UNKNOWN
|
||||
"CORE", // SM_CORE
|
||||
"ANALYZER", // SM_ANALYZER
|
||||
"COMMON", // SM_COMMON
|
||||
"DEBUG", // SM_DEBUG
|
||||
"OFFLINE_DEBUG", // SM_OFFLINE_DEBUG
|
||||
"DEVICE", // SM_DEVICE
|
||||
"GE_ADPT", // SM_GE_ADPT
|
||||
"IR", // SM_IR
|
||||
"KERNEL", // SM_KERNEL
|
||||
"MD", // SM_MD
|
||||
"ME", // SM_ME
|
||||
"EXPRESS", // SM_EXPRESS
|
||||
"OPTIMIZER", // SM_OPTIMIZER
|
||||
"PARALLEL", // SM_PARALLEL
|
||||
"PARSER", // SM_PARSER
|
||||
"PIPELINE", // SM_PIPELINE
|
||||
"PRE_ACT", // SM_PRE_ACT
|
||||
"PYNATIVE", // SM_PYNATIVE
|
||||
"SESSION", // SM_SESSION
|
||||
"UTILS", // SM_UTILS
|
||||
"VM", // SM_VM
|
||||
"PROFILER", // SM_PROFILER
|
||||
"PS", // SM_PS
|
||||
"LITE", // SM_LITE
|
||||
"HCCL_ADPT", // SM_HCCL_ADPT
|
||||
"MINDQUANTUM", // SM_MINDQUANTUM
|
||||
"RUNTIME_FRAMEWORK", // SM_RUNTIME_FRAMEWORK
|
||||
"GE", // SM_GE
|
||||
};
|
||||
|
||||
const std::string GetSubModuleName(SubModuleId module_id) { return sub_module_names[module_id % NUM_SUBMODUES]; }
|
||||
|
||||
// export GetTimeString for all sub modules
|
||||
std::string GetTimeString() {
|
||||
|
|
|
|||
|
|
@ -741,6 +741,24 @@ class PConstant : public PBase<PConstant<T> > {
|
|||
return tmp_data;
|
||||
}
|
||||
|
||||
template <typename TD>
|
||||
bool TensorCopyData(const tensor::TensorPtr &src_tensor_ptr, const tensor::TensorPtr &dst_tensor_ptr,
|
||||
const PrimitivePtr &calcu_type, size_t mem_size) {
|
||||
auto *data = reinterpret_cast<TD *>(src_tensor_ptr->data_c());
|
||||
auto *data2 = reinterpret_cast<TD *>(dst_tensor_ptr->data_c());
|
||||
if (memcpy_s(data2, mem_size, data, mem_size) != 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < src_tensor_ptr->DataSize(); i++) {
|
||||
if (data2[i] == 0 && calcu_type == prim::kPrimReciprocal) {
|
||||
return false;
|
||||
}
|
||||
data2[i] = CalcuConstant(data2[i], calcu_type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// calculate const with different operations
|
||||
AnfNodePtr CalcuConstantTensor(const AnfNodePtr &node, const ValuePtr &value, const PrimitivePtr &calcu_type) {
|
||||
tensor::TensorPtr tensor_ptr = dyn_cast<tensor::Tensor>(value);
|
||||
TypeId tensor_type = tensor_ptr->Dtype()->type_id();
|
||||
|
|
@ -754,43 +772,19 @@ class PConstant : public PBase<PConstant<T> > {
|
|||
}
|
||||
if ((tensor_type == TypeId::kNumberTypeFloat32) || (tensor_type == TypeId::kNumberTypeFloat) ||
|
||||
(tensor_type == TypeId::kNumberTypeFloat64)) {
|
||||
float *data = reinterpret_cast<float *>(tensor_ptr->data_c());
|
||||
float *data2 = reinterpret_cast<float *>(new_tensor_ptr->data_c());
|
||||
if (memcpy_s(data2, mem_size, data, mem_size) != 0) {
|
||||
if (!TensorCopyData<float>(tensor_ptr, new_tensor_ptr, calcu_type, mem_size)) {
|
||||
return nullptr;
|
||||
}
|
||||
for (int i = 0; i < tensor_ptr->DataSize(); i++) {
|
||||
if (data2[i] == 0 && calcu_type == prim::kPrimReciprocal) {
|
||||
return nullptr;
|
||||
}
|
||||
data2[i] = CalcuConstant(data2[i], calcu_type);
|
||||
}
|
||||
}
|
||||
if ((tensor_type == TypeId::kNumberTypeInt32) || (tensor_type == TypeId::kNumberTypeInt)) {
|
||||
int *data = reinterpret_cast<int *>(tensor_ptr->data_c());
|
||||
int *data2 = reinterpret_cast<int *>(new_tensor_ptr->data_c());
|
||||
if (memcpy_s(data2, mem_size, data, mem_size) != 0) {
|
||||
if (!TensorCopyData<int>(tensor_ptr, new_tensor_ptr, calcu_type, mem_size)) {
|
||||
return nullptr;
|
||||
}
|
||||
for (int i = 0; i < tensor_ptr->DataSize(); i++) {
|
||||
if (data2[i] == 0 && calcu_type == prim::kPrimReciprocal) {
|
||||
return nullptr;
|
||||
}
|
||||
data2[i] = CalcuConstant(data2[i], calcu_type);
|
||||
}
|
||||
}
|
||||
if (tensor_type == TypeId::kNumberTypeFloat64) {
|
||||
double *data = reinterpret_cast<double *>(tensor_ptr->data_c());
|
||||
double *data2 = reinterpret_cast<double *>(new_tensor_ptr->data_c());
|
||||
if (memcpy_s(data2, mem_size, data, mem_size) != 0) {
|
||||
if (!TensorCopyData<double>(tensor_ptr, new_tensor_ptr, calcu_type, mem_size)) {
|
||||
return nullptr;
|
||||
}
|
||||
for (int i = 0; i < tensor_ptr->DataSize(); i++) {
|
||||
if (data2[i] == 0 && calcu_type == prim::kPrimReciprocal) {
|
||||
return nullptr;
|
||||
}
|
||||
data2[i] = CalcuConstant(data2[i], calcu_type);
|
||||
}
|
||||
}
|
||||
auto new_vnode = NewValueNode(new_tensor_ptr);
|
||||
new_vnode->set_abstract(tensor_ptr->ToAbstract());
|
||||
|
|
@ -899,43 +893,12 @@ class PConstant : public PBase<PConstant<T> > {
|
|||
if (tensor_ptr_1 == nullptr || tensor_ptr_2 == nullptr || node_3->abstract() == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto tensor_1_abstract = vnode_1->abstract()->cast<abstract::AbstractTensorPtr>();
|
||||
auto tensor_2_abstract = vnode_1->abstract()->cast<abstract::AbstractTensorPtr>();
|
||||
TypePtr tensor_1_type_ptr = tensor_1_abstract->element()->BuildType();
|
||||
TypePtr tensor_2_type_ptr = tensor_2_abstract->element()->BuildType();
|
||||
|
||||
ShapeVector tensor_out_shape;
|
||||
int data_out_size;
|
||||
tensor::TensorPtr new_tensor_ptr;
|
||||
|
||||
if ((tensor_1_abstract->shape()->shape() == tensor_2_abstract->shape()->shape()) &&
|
||||
(tensor_1_type_ptr->type_id() == tensor_2_type_ptr->type_id())) {
|
||||
// If two constant nodes have the same shape, then create a new one with this shape
|
||||
tensor_out_shape = tensor_1_abstract->shape()->shape();
|
||||
data_out_size = std::accumulate(tensor_out_shape.begin(), tensor_out_shape.end(), 1, std::multiplies<int>());
|
||||
|
||||
new_tensor_ptr = std::make_shared<tensor::Tensor>(tensor_1_type_ptr->type_id(), tensor_out_shape);
|
||||
} else {
|
||||
// If two constant nodes have different shapes, then create a new one node with the shape of the 3rd node
|
||||
auto tensor_3_abstract = node_3->abstract()->cast<abstract::AbstractTensorPtr>();
|
||||
|
||||
TypePtr tensor_3_type_ptr = tensor_3_abstract->element()->BuildType();
|
||||
if ((tensor_1_type_ptr->type_id() != tensor_3_type_ptr->type_id()) ||
|
||||
(tensor_2_type_ptr->type_id() != tensor_3_type_ptr->type_id())) {
|
||||
return nullptr;
|
||||
}
|
||||
tensor_out_shape = tensor_3_abstract->shape()->shape();
|
||||
data_out_size = std::accumulate(tensor_out_shape.begin(), tensor_out_shape.end(), 1, std::multiplies<int>());
|
||||
if ((tensor_ptr_1->DataSize() > 1) && (tensor_ptr_1->DataSize() != data_out_size)) {
|
||||
return nullptr;
|
||||
}
|
||||
if ((tensor_ptr_2->DataSize() > 1) && (tensor_ptr_2->DataSize() != data_out_size)) {
|
||||
return nullptr;
|
||||
}
|
||||
new_tensor_ptr = std::make_shared<tensor::Tensor>(tensor_3_type_ptr->type_id(), tensor_out_shape);
|
||||
tensor::TensorPtr new_tensor_ptr = GetNewTensor(vnode_1, vnode_2, node_3);
|
||||
if (new_tensor_ptr == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShapeVector tensor_out_shape = new_tensor_ptr->shape();
|
||||
int data_out_size = std::accumulate(tensor_out_shape.begin(), tensor_out_shape.end(), 1, std::multiplies<int>());
|
||||
size_t mem_size = GetTypeByte(new_tensor_ptr->Dtype()) * IntToSize(new_tensor_ptr->ElementsNum());
|
||||
char *data = reinterpret_cast<char *>(new_tensor_ptr->data_c());
|
||||
|
||||
|
|
@ -986,6 +949,44 @@ class PConstant : public PBase<PConstant<T> > {
|
|||
mutable bool is_new_value_node_{false};
|
||||
mutable bool captured_{false};
|
||||
mutable bool changed_shape_{false};
|
||||
|
||||
private:
|
||||
tensor::TensorPtr GetNewTensor(const AnfNodePtr &vnode_1, const AnfNodePtr &vnode_2, const AnfNodePtr &node_3) const {
|
||||
auto value_1 = GetValueNode(vnode_1);
|
||||
auto value_2 = GetValueNode(vnode_2);
|
||||
auto tensor_ptr_1 = dyn_cast<tensor::Tensor>(value_1);
|
||||
auto tensor_ptr_2 = dyn_cast<tensor::Tensor>(value_2);
|
||||
auto tensor_1_abstract = vnode_1->abstract()->cast<abstract::AbstractTensorPtr>();
|
||||
auto tensor_2_abstract = vnode_2->abstract()->cast<abstract::AbstractTensorPtr>();
|
||||
|
||||
TypePtr tensor_1_type_ptr = tensor_1_abstract->element()->BuildType();
|
||||
TypePtr tensor_2_type_ptr = tensor_2_abstract->element()->BuildType();
|
||||
if ((tensor_1_abstract->shape()->shape() == tensor_2_abstract->shape()->shape()) &&
|
||||
(tensor_1_type_ptr->type_id() == tensor_2_type_ptr->type_id())) {
|
||||
// If two constant nodes have the same shape, then create a new one with this shape
|
||||
auto tensor_out_shape = tensor_1_abstract->shape()->shape();
|
||||
|
||||
return std::make_shared<tensor::Tensor>(tensor_1_type_ptr->type_id(), tensor_out_shape);
|
||||
} else {
|
||||
// If two constant nodes have different shapes, then create a new one node with the shape of the 3rd node
|
||||
auto tensor_3_abstract = node_3->abstract()->cast<abstract::AbstractTensorPtr>();
|
||||
|
||||
TypePtr tensor_3_type_ptr = tensor_3_abstract->element()->BuildType();
|
||||
if ((tensor_1_type_ptr->type_id() != tensor_3_type_ptr->type_id()) ||
|
||||
(tensor_2_type_ptr->type_id() != tensor_3_type_ptr->type_id())) {
|
||||
return nullptr;
|
||||
}
|
||||
auto tensor_out_shape = tensor_3_abstract->shape()->shape();
|
||||
int data_out_size = std::accumulate(tensor_out_shape.begin(), tensor_out_shape.end(), 1, std::multiplies<int>());
|
||||
if ((tensor_ptr_1->DataSize() > 1) && (tensor_ptr_1->DataSize() != data_out_size)) {
|
||||
return nullptr;
|
||||
}
|
||||
if ((tensor_ptr_2->DataSize() > 1) && (tensor_ptr_2->DataSize() != data_out_size)) {
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_shared<tensor::Tensor>(tensor_3_type_ptr->type_id(), tensor_out_shape);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Macro for binary operation functions
|
||||
|
|
|
|||
|
|
@ -142,44 +142,10 @@ enum SubModuleId : int {
|
|||
#define SUBMODULE_ID mindspore::SubModuleId::SM_ME
|
||||
#endif
|
||||
|
||||
static const char *SUB_MODULE_NAMES[NUM_SUBMODUES] = {
|
||||
"UNKNOWN", // SM_UNKNOWN
|
||||
"CORE", // SM_CORE
|
||||
"ANALYZER", // SM_ANALYZER
|
||||
"COMMON", // SM_COMMON
|
||||
"DEBUG", // SM_DEBUG
|
||||
"OFFLINE_DEBUG", // SM_OFFLINE_DEBUG
|
||||
"DEVICE", // SM_DEVICE
|
||||
"GE_ADPT", // SM_GE_ADPT
|
||||
"IR", // SM_IR
|
||||
"KERNEL", // SM_KERNEL
|
||||
"MD", // SM_MD
|
||||
"ME", // SM_ME
|
||||
"EXPRESS", // SM_EXPRESS
|
||||
"OPTIMIZER", // SM_OPTIMIZER
|
||||
"PARALLEL", // SM_PARALLEL
|
||||
"PARSER", // SM_PARSER
|
||||
"PIPELINE", // SM_PIPELINE
|
||||
"PRE_ACT", // SM_PRE_ACT
|
||||
"PYNATIVE", // SM_PYNATIVE
|
||||
"SESSION", // SM_SESSION
|
||||
"UTILS", // SM_UTILS
|
||||
"VM", // SM_VM
|
||||
"PROFILER", // SM_PROFILER
|
||||
"PS", // SM_PS
|
||||
"LITE", // SM_LITE
|
||||
"HCCL_ADPT", // SM_HCCL_ADPT
|
||||
"MINDQUANTUM", // SM_MINDQUANTUM
|
||||
"RUNTIME_FRAMEWORK", // SM_RUNTIME_FRAMEWORK
|
||||
"GE", // SM_GE
|
||||
};
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
extern const char *GetSubModuleName(SubModuleId module_id, const char **sub_module_names = SUB_MODULE_NAMES)
|
||||
__attribute__((dllexport));
|
||||
extern const std::string GetSubModuleName(SubModuleId module_id) __attribute__((dllexport));
|
||||
#else
|
||||
extern const char *GetSubModuleName(SubModuleId module_id, const char **sub_module_names = SUB_MODULE_NAMES)
|
||||
__attribute__((visibility("default")));
|
||||
extern const std::string GetSubModuleName(SubModuleId module_id) __attribute__((visibility("default")));
|
||||
#endif
|
||||
|
||||
const char *EnumStrForMsLogLevel(MsLogLevel level);
|
||||
|
|
|
|||
Loading…
Reference in New Issue