|  |  | @ -25,10 +25,8 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "graph/manager/graph_var_manager.h" |  |  |  | #include "graph/manager/graph_var_manager.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "graph/manager/host_mem_manager.h" |  |  |  | #include "graph/manager/host_mem_manager.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "graph/manager/trans_var_data_utils.h" |  |  |  | #include "graph/manager/trans_var_data_utils.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | #ifndef ONLY_COMPILE_OPEN_SRC |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "graph/manager/graph_mem_allocator.h" |  |  |  | #include "graph/manager/graph_mem_allocator.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "graph/manager/host_mem_allocator.h" |  |  |  | #include "graph/manager/host_mem_allocator.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | #endif |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "graph/utils/graph_utils.h" |  |  |  | #include "graph/utils/graph_utils.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "hybrid/common/npu_memory_allocator.h" |  |  |  | #include "hybrid/common/npu_memory_allocator.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "hybrid/node_executor/node_executor.h" |  |  |  | #include "hybrid/node_executor/node_executor.h" | 
			
		
	
	
		
		
			
				
					|  |  | @ -865,7 +863,6 @@ Status HybridModelBuilder::InitConstantOps() { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     std::unique_ptr<TensorValue> var_tensor; |  |  |  |     std::unique_ptr<TensorValue> var_tensor; | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (GetContext().GetHostExecFlag()) { |  |  |  |     if (GetContext().GetHostExecFlag()) { | 
			
		
	
		
		
			
				
					
					|  |  |  | #ifndef ONLY_COMPILE_OPEN_SRC |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       GE_CHECK_NOTNULL(ge_tensor); |  |  |  |       GE_CHECK_NOTNULL(ge_tensor); | 
			
		
	
		
		
			
				
					
					|  |  |  |       // Address for eigen kernel should be aligned with 16 bytes
 |  |  |  |       // Address for eigen kernel should be aligned with 16 bytes
 | 
			
		
	
		
		
			
				
					
					|  |  |  |       // Tensors return by api GetWeights share data with proto, whose addr is not confirmed to be aligned
 |  |  |  |       // Tensors return by api GetWeights share data with proto, whose addr is not confirmed to be aligned
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -878,11 +875,6 @@ Status HybridModelBuilder::InitConstantOps() { | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |       var_tensor.reset(new(std::nothrow)TensorValue(aligned_tensor.MutableData().data(), |  |  |  |       var_tensor.reset(new(std::nothrow)TensorValue(aligned_tensor.MutableData().data(), | 
			
		
	
		
		
			
				
					
					|  |  |  |                                                     aligned_tensor.GetData().size())); |  |  |  |                                                     aligned_tensor.GetData().size())); | 
			
		
	
		
		
			
				
					
					|  |  |  | #else |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       auto buffer = ge_tensor->MutableData(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       GELOGD("Init tensor with host constant. size = %zu", buffer.GetSize()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       var_tensor.reset(new(std::nothrow)TensorValue(buffer.GetData(), buffer.GetSize())); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #endif |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } else { |  |  |  |     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |       GE_CHK_STATUS_RET_NOLOG(VarNodeToTensor(var_node, var_tensor)); |  |  |  |       GE_CHK_STATUS_RET_NOLOG(VarNodeToTensor(var_node, var_tensor)); | 
			
		
	
		
		
			
				
					
					|  |  |  |       GELOGD("Init const op tensor. name = %s, size = %ld", var_name.c_str(), var_tensor->GetSize()); |  |  |  |       GELOGD("Init const op tensor. name = %s, size = %ld", var_name.c_str(), var_tensor->GetSize()); | 
			
		
	
	
		
		
			
				
					|  |  | @ -937,7 +929,6 @@ Status HybridModelBuilder::InitVariableTensors() { | 
			
		
	
		
		
			
				
					
					|  |  |  |       GELOGE(GE_GRAPH_MALLOC_FAILED, "Host variable [%s] malloc failed.", it.first.c_str()); |  |  |  |       GELOGE(GE_GRAPH_MALLOC_FAILED, "Host variable [%s] malloc failed.", it.first.c_str()); | 
			
		
	
		
		
			
				
					
					|  |  |  |       return GE_GRAPH_MALLOC_FAILED; |  |  |  |       return GE_GRAPH_MALLOC_FAILED; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | #ifndef ONLY_COMPILE_OPEN_SRC |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (MemManager::Instance().HostMemInstance(RT_MEMORY_HBM).Malloc(mem_info.host_aligned_ptr, |  |  |  |     if (MemManager::Instance().HostMemInstance(RT_MEMORY_HBM).Malloc(mem_info.host_aligned_ptr, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                                                      tensor_size) == nullptr) { |  |  |  |                                                                      tensor_size) == nullptr) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       GELOGE(MEMALLOC_FAILED, "Malloc host memory for an existed GeTensor failed."); |  |  |  |       GELOGE(MEMALLOC_FAILED, "Malloc host memory for an existed GeTensor failed."); | 
			
		
	
	
		
		
			
				
					|  |  | @ -947,11 +938,6 @@ Status HybridModelBuilder::InitVariableTensors() { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     std::unique_ptr<TensorValue> tensor(new (std::nothrow) TensorValue(mem_info.host_aligned_ptr->MutableGet(), |  |  |  |     std::unique_ptr<TensorValue> tensor(new (std::nothrow) TensorValue(mem_info.host_aligned_ptr->MutableGet(), | 
			
		
	
		
		
			
				
					
					|  |  |  |                                                                        tensor_size)); |  |  |  |                                                                        tensor_size)); | 
			
		
	
		
		
			
				
					
					|  |  |  | #else |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     GELOGD("Host variable [%s] malloc success.", it.first.c_str()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     std::unique_ptr<TensorValue> tensor(new (std::nothrow) TensorValue(mem_info.host_address, tensor_size)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #endif |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     GE_CHECK_NOTNULL(tensor); |  |  |  |     GE_CHECK_NOTNULL(tensor); | 
			
		
	
		
		
			
				
					
					|  |  |  |     hybrid_model_.variable_tensors_.emplace(it.first, std::move(tensor)); |  |  |  |     hybrid_model_.variable_tensors_.emplace(it.first, std::move(tensor)); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |