forked from mindspore-Ecosystem/mindspore
!12147 dynamic op add to cache
From: @jjfeing Reviewed-by: @chujinjin,@zhoufeng54 Signed-off-by: @zhoufeng54
This commit is contained in:
commit
07c01cecee
|
@ -94,6 +94,7 @@ constexpr auto kJListArgs = "list_args";
|
|||
constexpr auto kJSocVersion = "socVersion";
|
||||
constexpr auto kSOC_VERSION = "SOC_VERSION";
|
||||
constexpr auto kJIsDynamicShape = "is_dynamic_shape";
|
||||
constexpr auto kJDynamicIndex = "dynamic_index";
|
||||
|
||||
bool IsNeedChangeDefaultFormat(const CNodePtr &cnode) {
|
||||
MS_EXCEPTION_IF_NULL(cnode);
|
||||
|
@ -137,6 +138,10 @@ bool TbeKernelJsonCreator::GenTbeSingleKernelJson(const std::shared_ptr<mindspor
|
|||
op_info_json[kJAttrs] = attrs_json;
|
||||
auto soc_version = TbeKernelJsonCreator::GetSocVersion();
|
||||
op_info_json[kJSocVersion] = soc_version;
|
||||
if (op_info_json[kJIsDynamicShape]) {
|
||||
static int32_t dynamic_index = 0;
|
||||
op_info_json[kJDynamicIndex] = dynamic_index++;
|
||||
}
|
||||
std::string json_str = op_info_json.dump();
|
||||
size_t hash_id = std::hash<std::string>()(json_str);
|
||||
auto context_ptr = MsContext::GetInstance();
|
||||
|
|
|
@ -56,13 +56,11 @@ bool TbeOpParallelBuild(const std::vector<AnfNodePtr> &anf_nodes) {
|
|||
(void)TbeKernelBuild::GetIOSize(kernel_json, &input_size_list, &output_size_list, anf_node);
|
||||
// search cache
|
||||
const std::string &json_name = creator.json_name();
|
||||
auto IsDynamicShape = tbe::TbeDynamicShapeUtil::GetDynamicShapeAttr(anf_node);
|
||||
if (build_manger->SearchInCache(json_name, processor, input_size_list, output_size_list, anf_node.get()) &&
|
||||
!IsDynamicShape) {
|
||||
if (build_manger->SearchInCache(json_name, processor, input_size_list, output_size_list, anf_node.get())) {
|
||||
continue;
|
||||
}
|
||||
// same op not need build, but need wait build finish to set kernel mode
|
||||
if (processed_kernel.find(json_name) != processed_kernel.end() && !IsDynamicShape) {
|
||||
if (processed_kernel.find(json_name) != processed_kernel.end()) {
|
||||
build_manger->SaveSameOpInfo(anf_node, json_name, input_size_list, output_size_list);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue