!5475 Delete is_auto_parallel in parallel operators

Merge pull request !5475 from yangzhenzhang/delete-is-auto-parallel
This commit is contained in:
mindspore-ci-bot 2020-08-29 14:40:38 +08:00 committed by Gitee
commit 9bc470310e
21 changed files with 66 additions and 359 deletions

View File

@ -32,11 +32,7 @@ namespace mindspore {
namespace parallel {
Status Activation::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
return FAILED;
}
@ -45,11 +41,7 @@ Status Activation::SetCostUnderStrategy(const StrategyPtr &strategy) {
Status Activation::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
@ -58,11 +50,7 @@ Status Activation::CheckStrategy(const StrategyPtr &strategy) {
Status DropoutInfo::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
@ -125,7 +113,6 @@ Status Activation::GenerateStrategies(int32_t stage_id) {
return FAILED;
}
is_auto_parallel_ = true;
Shape input0_split(inputs_shape_[0].size(), 1);
Shapes splittable_inputs = {input0_split};
@ -146,7 +133,6 @@ Status Activation::GenerateStrategies(int32_t stage_id) {
}
Status DropoutInfo::GenerateStrategies(int32_t stage_id) {
is_auto_parallel_ = true;
Shape input0_split(inputs_shape_[0].size(), 1);
Shapes splittable_inputs = {input0_split};
@ -168,11 +154,7 @@ Status DropoutInfo::GenerateStrategies(int32_t stage_id) {
Status Softmax::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
@ -189,11 +171,7 @@ Status Softmax::CheckStrategy(const StrategyPtr &strategy) {
int32_t axis_strategy = input_strategy.at(IntToSize(axis_index));
// Dimension corresponding to axis is un-splittable
if (axis_strategy != MIN_SLICE_NUM) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : The strategy corresponding to axis dimension(" << axis_strategy << ") is not 1";
} else {
MS_LOG(ERROR) << name_ << " : The strategy corresponding to axis dimension(" << axis_strategy << ") is not 1";
}
MS_LOG(ERROR) << name_ << " : The strategy corresponding to axis dimension(" << axis_strategy << ") is not 1";
return FAILED;
}
}
@ -253,11 +231,7 @@ Status Softmax::GetAttrs() {
Status Softmax::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
return FAILED;
}
@ -274,7 +248,6 @@ Status Softmax::GenerateStrategies(int32_t stage_id) {
return FAILED;
}
is_auto_parallel_ = true;
Shape input0_split;
(void)input0_split.insert(input0_split.begin(), inputs_shape_[0].size(), 1);
for (auto &element : axis_) {
@ -418,11 +391,7 @@ Status ActivationBase::Init(const StrategyPtr &strategy) {
Status ActivationBase::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
return FAILED;
}

View File

@ -74,11 +74,7 @@ Strategys ExpendStrategy(const StrategyPtr &strategy) {
Status ArithmeticBase::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
Shapes input_shapes = InferExpendShape();
@ -90,11 +86,7 @@ Status ArithmeticBase::CheckStrategy(const StrategyPtr &strategy) {
for (size_t i = 0; i < input_a_shape.size(); ++i) {
if ((sub_a_strategy[i] != sub_b_strategy[i]) && (input_a_shape[i] != 1) && (input_b_shape[i] != 1)) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
}
@ -300,11 +292,7 @@ Status ArithmeticBase::InferTensorInfo() {
Status ArithmeticBase::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
return FAILED;
}
@ -317,7 +305,6 @@ Status ArithmeticBase::GenerateStrategies(int32_t stage_id) {
Shapes splittable_inputs = {input0_split, input1_split};
std::vector<StrategyPtr> sp_vector;
is_auto_parallel_ = true;
if (GenerateStrategiesWithBroadcast(stage_id, inputs_shape_, splittable_inputs, &sp_vector) != SUCCESS) {
MS_LOG(ERROR) << name_ << " : Generate strategies with broadcast failed.";
return FAILED;
@ -347,11 +334,7 @@ Status ArithmeticBase::Init(const StrategyPtr &strategy) {
Status ArithmeticBase::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
return FAILED;
}

View File

@ -28,11 +28,7 @@ namespace mindspore {
namespace parallel {
Status BatchParallelInfo::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
@ -51,11 +47,7 @@ Status BatchParallelInfo::CheckStrategy(const StrategyPtr &strategy) {
int64_t strategy_value = sub_strategy.at(j);
if (strategy_value > 1) {
if (flag || strategy_value != dev_num_) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : It is not a valid data parallel strategy.";
} else {
MS_LOG(ERROR) << name_ << " : It is not a valid data parallel strategy.";
}
MS_LOG(ERROR) << name_ << " : It is not a valid data parallel strategy.";
return FAILED;
}
flag = true;
@ -171,11 +163,7 @@ Status BatchParallelInfo::Init(const StrategyPtr &strategy) {
Status BatchParallelInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
return FAILED;
}
@ -185,11 +173,7 @@ Status BatchParallelInfo::InitForCostModel(const StrategyPtr &strategy) {
Status BatchParallelInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
return FAILED;
}
return SUCCESS;
@ -197,7 +181,6 @@ Status BatchParallelInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
Status BatchParallelInfo::GenerateStrategies(int32_t stage_id) {
CheckGlobalDeviceManager();
is_auto_parallel_ = true;
size_t total_dev_num = g_device_manager->GetDeviceListByStageId(stage_id).size();
StrategyPtr sp;
Strategys strategy;

View File

@ -28,11 +28,7 @@ namespace mindspore {
namespace parallel {
Status BiasAddInfo::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
Strategys stra = strategy->GetInputDim();
@ -41,11 +37,7 @@ Status BiasAddInfo::CheckStrategy(const StrategyPtr &strategy) {
int64_t channel_a_strategy = sub_a_strategy.at(1);
int64_t channel_b_strategy = sub_b_strategy.at(0);
if (channel_a_strategy != channel_b_strategy) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
return SUCCESS;
@ -186,11 +178,7 @@ Status BiasAddInfo::InferTensorInfo() {
Status BiasAddInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
return FAILED;
}
@ -202,7 +190,6 @@ Status BiasAddInfo::GenerateStrategies(int32_t stage_id) {
Shapes splittable_inputs = {input0_split, input0_split};
std::vector<StrategyPtr> sp_vector;
is_auto_parallel_ = true;
Shapes tmp_inputs_shape = {inputs_shape_[0], inputs_shape_[0]};
Shapes tmp_splittable_inputs = {splittable_inputs[0], splittable_inputs[0]};
if (GenerateStrategiesForIndependentInputs(stage_id, tmp_inputs_shape, tmp_splittable_inputs, &sp_vector) !=
@ -245,11 +232,7 @@ Status BiasAddInfo::Init(const StrategyPtr &strategy) {
Status BiasAddInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
return FAILED;
}

View File

@ -229,7 +229,6 @@ Status ConcatInfo::GenerateStrategies(int32_t stage_id) {
Shapes tmp_inputs_shape = {inputs_shape_[0]};
std::vector<StrategyPtr> sp_vector;
is_auto_parallel_ = true;
if (GenerateStrategiesForIndependentInputs(stage_id, tmp_inputs_shape, splittable_input, &sp_vector) != SUCCESS) {
MS_LOG(ERROR) << name_ << ": Generate strategies failed";
return FAILED;

View File

@ -51,11 +51,7 @@ Status DropoutDoMaskInfo::CheckStrategy(const StrategyPtr &strategy) {
// only check the input[0]
Shapes input_shape = {inputs_shape_[0]};
if (CheckStrategyValue(strategy, input_shape, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy";
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy";
}
MS_LOG(ERROR) << name_ << ": Invalid strategy";
return FAILED;
}
return SUCCESS;
@ -130,11 +126,7 @@ Status DropoutDoMaskInfo::InferTensorInfo() {
Status DropoutDoMaskInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed";
return FAILED;
}
@ -147,7 +139,6 @@ Status DropoutDoMaskInfo::GenerateStrategies(int32_t stage_id) {
return FAILED;
}
is_auto_parallel_ = true;
Shape input0_split(inputs_shape_[0].size(), 1);
Shapes splittable_inputs = {input0_split};
Shapes used_inputs_shape = {inputs_shape_[0]};
@ -189,15 +180,11 @@ Status DropoutDoMaskInfo::Init(const StrategyPtr &strategy) {
Status DropoutDoMaskInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed";
return FAILED;
}
MS_LOG(INFO) << name_ << ": Init for cost model success.";
MS_LOG(INFO) << name_ << ": Init for cost model success";
return SUCCESS;
}

View File

@ -83,11 +83,7 @@ Status GatherV2Info::CheckStrategy(const StrategyPtr &strategy) {
}
// Only strategy of the first input should be set.
if (CheckStrategyValue(strategy, {inputs_shape_.at(0)}, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
}
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
return FAILED;
}
axis_strategy_ = strategy->GetInputDim().at(0).at(axis_);
@ -272,11 +268,7 @@ Status GatherV2Info::Init(const StrategyPtr &strategy) {
Status GatherV2Info::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
return FAILED;
}
MS_LOG(INFO) << name_ << ": Init for cost model success.";
@ -289,8 +281,6 @@ Status GatherV2Info::GenerateStrategies(int32_t stage_id) {
<< outputs_shape_.size() << "is wrong.";
return FAILED;
}
is_auto_parallel_ = true;
Shape input0_split(inputs_shape_[0].size(), 1);
Shapes splittable_inputs = {input0_split};
@ -313,11 +303,7 @@ Status GatherV2Info::GenerateStrategies(int32_t stage_id) {
Status GatherV2Info::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
return FAILED;
}
return SUCCESS;

View File

@ -121,11 +121,7 @@ Status GetNextInfo::CheckStrategy(const StrategyPtr &strategy) {
Strategys stras = strategy->GetInputDim();
for (Dimensions stra : stras) {
if (stra.size() != 0) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
}
@ -237,11 +233,7 @@ Status GetNextInfo::InferReplaceOps(const StrategyPtr &) {
Status GetNextInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
return FAILED;
}
MS_LOG(INFO) << name_ << " : Init for cost model success.";
@ -250,18 +242,13 @@ Status GetNextInfo::InitForCostModel(const StrategyPtr &strategy) {
Status GetNextInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
return FAILED;
}
return SUCCESS;
}
Status GetNextInfo::GenerateStrategies(int32_t stage_id) {
is_auto_parallel_ = true;
Strategys stra;
StrategyPtr sp = std::make_shared<Strategy>(stage_id, stra);
if (SetCostUnderStrategy(sp) == SUCCESS) {

View File

@ -28,11 +28,7 @@ namespace mindspore {
namespace parallel {
Status L2NormalizeInfo::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(INFO) << name_ << " : Init success.";
}
MS_LOG(INFO) << name_ << " : Init success.";
return FAILED;
}
@ -94,7 +90,6 @@ Status L2NormalizeInfo::GenerateStrategies(int32_t stage_id) {
MS_LOG(ERROR) << name_ << " : GetAttrs failed.";
return FAILED;
}
is_auto_parallel_ = true;
Shape input0_split(inputs_shape_[0].size() - 1, 1);
int32_t axis_index = axis_;
if (axis_ < 0) {

View File

@ -269,7 +269,6 @@ Status LayerNormInfo::GenerateStrategies(int32_t stage_id) {
Shapes splittable_inputs = {input_split};
Shapes tmp_inputs_shape = {input_shape_};
std::vector<StrategyPtr> sp_vector;
is_auto_parallel_ = true;
if (GenerateStrategiesForIndependentInputs(stage_id, tmp_inputs_shape, splittable_inputs, &sp_vector) != SUCCESS) {
MS_LOG(ERROR) << name_ << ": Generate input strategy failed";
return FAILED;

View File

@ -29,11 +29,7 @@ namespace mindspore {
namespace parallel {
Status SoftmaxCrossEntropyWithLogitsInfo::CheckStrategy(const mindspore::parallel::StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
@ -55,15 +51,8 @@ Status SoftmaxCrossEntropyWithLogitsInfo::CheckStrategy(const mindspore::paralle
int64_t label_axis_strategy = label_strategy.at(IntToSize(axis_index));
// Dimension corresponding to axis is un-splittable
if ((input_axis_strategy != MIN_SLICE_NUM) && (label_axis_strategy != MIN_SLICE_NUM)) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_
<< " : The strategy corresponding to axis dimension is not 1, input: " << input_axis_strategy
<< ", label: " << label_axis_strategy;
} else {
MS_LOG(ERROR) << name_
<< " : The strategy corresponding to axis dimension is not 1, input: " << input_axis_strategy
<< ", label: " << label_axis_strategy;
}
MS_LOG(ERROR) << name_ << " : The strategy corresponding to axis dimension is not 1, input: " << input_axis_strategy
<< ", label: " << label_axis_strategy;
return FAILED;
}
@ -163,11 +152,7 @@ Status SoftmaxCrossEntropyWithLogitsInfo::Init(const StrategyPtr &strategy) {
Status SoftmaxCrossEntropyWithLogitsInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
return FAILED;
}
@ -191,7 +176,6 @@ Status SoftmaxCrossEntropyWithLogitsInfo::GenerateStrategies(int32_t stage_id) {
size_t input_dim = inputs_shape_[0].size();
axis_index = static_cast<int32_t>(input_dim) + axis_;
}
is_auto_parallel_ = true;
Shape input0_split;
(void)input0_split.insert(input0_split.begin(), inputs_shape_[0].size(), 1);
@ -218,11 +202,7 @@ Status SoftmaxCrossEntropyWithLogitsInfo::GenerateStrategies(int32_t stage_id) {
Status SoftmaxCrossEntropyWithLogitsInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
PrintStrategy(strategy);
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << " : Set cost under strategy failed.";
return FAILED;
}
return SUCCESS;

View File

@ -151,11 +151,7 @@ Status CheckRelevantDimension(const Dimensions &long_strategy, const Dimensions
Status MatMul::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
}
MS_LOG(ERROR) << name_ << " : Invalid strategy.";
return FAILED;
}
@ -166,11 +162,7 @@ Status MatMul::CheckStrategy(const StrategyPtr &strategy) {
size_t mat_a_size = mat_a_strategy.size();
size_t mat_b_size = mat_b_strategy.size();
if ((mat_a_size != mat_a_dimension_) || (mat_b_size != mat_b_dimension_)) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : The dimensions of mat_a or mat_b's strategy is wrong.";
} else {
MS_LOG(ERROR) << name_ << " : The dimensions of mat_a or mat_b's strategy is wrong.";
}
MS_LOG(ERROR) << name_ << " : The dimensions of mat_a or mat_b's strategy is wrong.";
return FAILED;
}
@ -405,11 +397,7 @@ Status MatMulBase::Init(const StrategyPtr &strategy) {
Status MatMulBase::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << " : Init for cost model failed.";
return FAILED;
}
@ -455,7 +443,6 @@ Status MatMulBase::GenerateStrategies(int32_t stage_id) {
// Combining the input0_shape and input1_shape
// E.g., combined_shape = [100, 200, 300, 400]
is_auto_parallel_ = true;
size_t input1_shape_size = input1_shape.size(), input0_shape_size = input0_shape.size();
Dimensions combined_partitions;
Shape combined_shape;
@ -622,11 +609,7 @@ std::shared_ptr<Strategys> BatchMatMulInfo::GenerateBatchStrategies() {
Status MatMulBase::SetCostUnderStrategy(const mindspore::parallel::StrategyPtr &strategy) {
if (InitForCostModel(strategy) == FAILED) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << " : Initialization under the strategy failed.";
} else {
MS_LOG(ERROR) << name_ << " : Initialization under the strategy failed.";
}
MS_LOG(ERROR) << name_ << " : Initialization under the strategy failed.";
return FAILED;
}
PrintStrategy(strategy);

View File

@ -65,11 +65,7 @@ Status OneHotInfo::CheckStrategy(const StrategyPtr &strategy) {
}
if (CheckStrategyValue(strategy, {outputs_shape_.at(0), inputs_shape_.at(1), inputs_shape_.at(2)},
is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
}
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
return FAILED;
}
@ -246,11 +242,7 @@ Status OneHotInfo::Init(const StrategyPtr &strategy) {
Status OneHotInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
return FAILED;
}
MS_LOG(INFO) << name_ << ": Init for cost model success.";
@ -268,7 +260,6 @@ Status OneHotInfo::GenerateStrategies(int32_t stage_id) {
MS_LOG(ERROR) << name_ << ": outputs_shape_ size must be 1, but is " << outputs_shape_.size();
return FAILED;
}
is_auto_parallel_ = true;
if (GenerateStrategiesForIndependentInputs(stage_id, {outputs_shape_.at(0), inputs_shape_.at(1), inputs_shape_.at(2)},
splittable_inputs, &sp_vector) != SUCCESS) {
MS_LOG(ERROR) << name_ << ": GenerateStrategies failed.";
@ -289,11 +280,7 @@ Status OneHotInfo::GenerateStrategies(int32_t stage_id) {
Status OneHotInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
return FAILED;
}
return SUCCESS;

View File

@ -35,28 +35,16 @@ namespace parallel {
*/
Status PReLUInfo::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
}
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
return FAILED;
}
Strategys stra = strategy->GetInputDim();
if (stra[1].size() != PRELU_SECOND_INPUT_SIZE) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy size.";
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy size.";
}
MS_LOG(ERROR) << name_ << ": Invalid strategy size.";
return FAILED;
}
if (stra[0][PRELU_CHANNEL_INDEX] != stra[1][0] && inputs_shape_[1][0] != 1) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid channel strategy.";
} else {
MS_LOG(ERROR) << name_ << ": Invalid channel strategy.";
}
MS_LOG(ERROR) << name_ << ": Invalid channel strategy.";
return FAILED;
}
return SUCCESS;
@ -195,11 +183,7 @@ Status PReLUInfo::Init(const StrategyPtr &strategy) {
Status PReLUInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
return FAILED;
}
@ -214,7 +198,6 @@ Status PReLUInfo::GenerateStrategies(int32_t stage_id) {
if (inputs_shape_[1].size() != PRELU_SECOND_INPUT_SIZE) {
return FAILED;
}
is_auto_parallel_ = true;
Shape input0_split;
input0_split.emplace_back(1);
input0_split.emplace_back(0);
@ -239,11 +222,7 @@ Status PReLUInfo::GenerateStrategies(int32_t stage_id) {
Status PReLUInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
return FAILED;
}
return SUCCESS;

View File

@ -31,11 +31,7 @@ namespace mindspore {
namespace parallel {
Status ReduceMethod::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
}
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
return FAILED;
}
@ -360,11 +356,7 @@ Status ReduceMethod::InferTensorInfo() {
Status ReduceMethod::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
return FAILED;
}
@ -380,7 +372,6 @@ Status ReduceMethod::GenerateStrategies(int32_t stage_id) {
Shape input0_split(inputs_shape_[0].size(), 1);
Shapes splittable_inputs = {input0_split};
is_auto_parallel_ = true;
std::vector<StrategyPtr> sp_vector;
if (GenerateStrategiesForIndependentInputs(stage_id, inputs_shape_, splittable_inputs, &sp_vector) != SUCCESS) {
MS_LOG(ERROR) << name_ << ": GenerateStrategiesForIndependentInputs failed.";
@ -408,11 +399,7 @@ Status ReduceMethod::Init(const StrategyPtr &strategy) {
Status ReduceMethod::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Init for cost model failed";
} else {
MS_LOG(ERROR) << name_ << ": Init for cost model failed";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed";
return FAILED;
}
@ -453,11 +440,7 @@ std::vector<int32_t> ArgMaxWithValueInfo::reduce_dim() {
Status ArgMaxWithValueInfo::CheckStrategy(const StrategyPtr &strategy) {
if (ReduceMethod::CheckStrategy(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": CheckStrategy for parent class ReduceMethod failed";
} else {
MS_LOG(ERROR) << name_ << ": CheckStrategy for parent class ReduceMethod failed";
}
MS_LOG(ERROR) << name_ << ": CheckStrategy for parent class ReduceMethod failed";
return FAILED;
}
std::vector<int32_t> dim_list = reduce_dim();
@ -552,7 +535,6 @@ Status ArgMaxWithValueInfo::GenerateStrategies(int32_t stage_id) {
}
Shape input0_split(inputs_shape_[0].size(), 1);
Shapes splittable_inputs = {input0_split};
is_auto_parallel_ = true;
std::vector<StrategyPtr> sp_vector;
if (GenerateStrategiesForIndependentInputs(stage_id, inputs_shape_, splittable_inputs, &sp_vector) != SUCCESS) {
MS_LOG(ERROR) << name_ << ": GenerateStrategiesForIndependentInputs failed.";

View File

@ -31,23 +31,10 @@ namespace mindspore {
namespace parallel {
Status ReshapeInfo::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
}
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
return FAILED;
}
size_t strategy_size = strategy->GetInputNumber();
if (strategy_size != 1) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy size " << strategy_size;
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy size " << strategy_size;
}
return FAILED;
}
return SUCCESS;
}
@ -398,11 +385,7 @@ Status ReshapeInfo::Init(const StrategyPtr &strategy) {
Status ReshapeInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
return FAILED;
}
@ -412,11 +395,7 @@ Status ReshapeInfo::InitForCostModel(const StrategyPtr &strategy) {
Status ReshapeInfo::SetCostUnderStrategy(const mindspore::parallel::StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
return FAILED;
}
@ -468,7 +447,6 @@ Status ReshapeInfo::GenerateStrategies(int32_t stage_id) {
<< outputs_shape_.size();
return FAILED;
}
is_auto_parallel_ = true;
Shape input0_split;
(void)input0_split.insert(input0_split.end(), inputs_shape_[0].size(), 1);
Shapes splittable_inputs = {input0_split};

View File

@ -265,7 +265,6 @@ Status StridedSliceInfo::GenerateStrategies(int32_t stage_id) {
Shapes splittable_inputs = {input_split};
std::vector<StrategyPtr> sp_vector;
is_auto_parallel_ = true;
if (GenerateStrategiesForIndependentInputs(stage_id, inputs_shape_, splittable_inputs, &sp_vector) != SUCCESS) {
return FAILED;
}

View File

@ -215,7 +215,6 @@ Status TileInfo::GenerateStrategies(int32_t stage_id) {
Shapes splittable_inputs = {multiples_split};
std::vector<StrategyPtr> sp_vector;
is_auto_parallel_ = true;
Shapes tmp_inputs_shape = {full_multiples_};
if (GenerateStrategiesForIndependentInputs(stage_id, tmp_inputs_shape, splittable_inputs, &sp_vector) != SUCCESS) {
return FAILED;

View File

@ -26,11 +26,7 @@ namespace mindspore {
namespace parallel {
Status TmpIdentityInfo::CheckStrategy(const mindspore::parallel::StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << ": invalid strategy.";
}
MS_LOG(ERROR) << name_ << ": invalid strategy.";
return FAILED;
}
return SUCCESS;
@ -94,11 +90,7 @@ Status TmpIdentityInfo::Init(const StrategyPtr &strategy) {
Status TmpIdentityInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
return FAILED;
}
@ -108,11 +100,7 @@ Status TmpIdentityInfo::InitForCostModel(const StrategyPtr &strategy) {
Status TmpIdentityInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
return FAILED;
}
@ -125,7 +113,6 @@ Status TmpIdentityInfo::GenerateStrategies(int32_t stage_id) {
<< outputs_shape_.size();
return FAILED;
}
is_auto_parallel_ = true;
Shape input0_split(inputs_shape_[0].size(), 1);
Shapes splittable_inputs = {input0_split};
std::vector<StrategyPtr> sp_vector;

View File

@ -29,11 +29,7 @@ namespace mindspore {
namespace parallel {
Status TransposeInfo::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
}
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
return FAILED;
}
@ -190,11 +186,7 @@ Status TransposeInfo::Init(const StrategyPtr &strategy) {
Status TransposeInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithAutoRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
return FAILED;
}
@ -204,11 +196,7 @@ Status TransposeInfo::InitForCostModel(const StrategyPtr &strategy) {
Status TransposeInfo::SetCostUnderStrategy(const mindspore::parallel::StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
return FAILED;
}
@ -225,7 +213,6 @@ Status TransposeInfo::GenerateStrategies(int32_t stage_id) {
<< outputs_shape_.size();
return FAILED;
}
is_auto_parallel_ = true;
Shape input0_split(inputs_shape_[0].size(), 1);
Shapes splittable_inputs = {input0_split};
std::vector<StrategyPtr> sp_vector;

View File

@ -30,21 +30,13 @@ namespace mindspore {
namespace parallel {
Status VirtualDatasetInfo::CheckStrategy(const StrategyPtr &strategy) {
if (CheckStrategyValue(strategy, inputs_shape_, is_auto_parallel_) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Invalid strategy.";
} else {
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
}
MS_LOG(ERROR) << name_ << ": Invalid strategy.";
return FAILED;
}
Strategys stra = strategy->GetInputDim();
if (stra.size() < 1) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Strategy size must be larger than 1.";
} else {
MS_LOG(ERROR) << name_ << ": Strategy size must be larger than 1.";
}
MS_LOG(ERROR) << name_ << ": Strategy size must be larger than 1.";
return FAILED;
}
if (stra.size() == 1) {
@ -57,21 +49,13 @@ Status VirtualDatasetInfo::CheckStrategy(const StrategyPtr &strategy) {
MS_LOG(ERROR) << name_ << ": iter_strategy size is zero.";
}
if (strategy_first.at(0) != *(iter_strategy->begin())) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": The first dimension of each strategy must be the same.";
} else {
MS_LOG(ERROR) << name_ << ": The first dimension of each strategy must be the same.";
}
MS_LOG(ERROR) << name_ << ": The first dimension of each strategy must be the same.";
return FAILED;
}
for (auto iter_element = iter_strategy->begin() + 1; iter_element != iter_strategy->end(); ++iter_element) {
if (*iter_element != 1) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": All dimension except the first dimension of each strategy must be 1.";
} else {
MS_LOG(ERROR) << name_ << ": All dimension except the first dimension of each strategy must be 1.";
}
MS_LOG(ERROR) << name_ << ": All dimension except the first dimension of each strategy must be 1.";
return FAILED;
}
}
@ -144,11 +128,7 @@ Status VirtualDatasetInfo::Init(const StrategyPtr &strategy) {
Status VirtualDatasetInfo::InitForCostModel(const StrategyPtr &strategy) {
if (InitForCostModelWithManualRepeatCalc(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Init for cost model failed.";
} else {
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
}
MS_LOG(ERROR) << name_ << ": Init for cost model failed.";
return FAILED;
}
@ -164,11 +144,7 @@ void VirtualDatasetInfo::ReComputeBatchSplitFlagList() {
Status VirtualDatasetInfo::SetCostUnderStrategy(const StrategyPtr &strategy) {
if (SetCostUnderStrategyBase(strategy) != SUCCESS) {
if (is_auto_parallel_) {
MS_LOG(DEBUG) << name_ << ": Set cost under strategy failed.";
} else {
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
}
MS_LOG(ERROR) << name_ << ": Set cost under strategy failed.";
return FAILED;
}
@ -186,7 +162,6 @@ Status VirtualDatasetInfo::GenerateStrategies(int32_t stage_id) {
}
CheckGlobalDeviceManager();
is_auto_parallel_ = true;
if (full_batch) {
total_dev_num = 1;
} else {