forked from mindspore-Ecosystem/mindspore
use device type in dump file name when trans_flag=false
This commit is contained in:
parent
f8231412fe
commit
b5e70f7231
|
@ -40,12 +40,13 @@ bool E2eDump::IsDeviceTargetGPU() {
|
|||
|
||||
void E2eDump::DumpGPUMemToFile(const std::string &file_path, const std::string &original_kernel_name,
|
||||
NotNull<const device::DeviceAddress *> addr, const ShapeVector &int_shapes,
|
||||
const TypeId &type, bool trans_flag, size_t slot, const Debugger *debugger) {
|
||||
const TypeId &host_type, const TypeId &device_type, bool trans_flag, size_t slot,
|
||||
const Debugger *debugger) {
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
auto format = kOpFormat_DEFAULT;
|
||||
MS_EXCEPTION_IF_NULL(debugger);
|
||||
auto ret = debugger->DumpTensorToFile(original_kernel_name, trans_flag, file_path, format, int_shapes, type,
|
||||
addr->type_id(), addr->format(), slot);
|
||||
auto ret = debugger->DumpTensorToFile(original_kernel_name, trans_flag, file_path, format, int_shapes, host_type,
|
||||
device_type, addr->format(), slot);
|
||||
if (!ret) {
|
||||
MS_LOG(ERROR) << "DumpTensorToFile Failed: flag:" << std::to_string(trans_flag) << ", path:" << file_path
|
||||
<< ", host_format:" << format;
|
||||
|
@ -86,10 +87,11 @@ void E2eDump::DumpOutputImpl(const CNodePtr &node, bool trans_flag, const std::s
|
|||
ShapeVector int_shapes;
|
||||
GetDumpIntShape(node, j, NOT_NULL(&int_shapes), trans_flag);
|
||||
auto type = AnfAlgo::GetOutputInferDataType(node, j);
|
||||
auto device_type = AnfAlgo::GetOutputDeviceDataType(node, j);
|
||||
std::string file_path = dump_path + '/' + *kernel_name + '_' + "output_" + std::to_string(j);
|
||||
if (IsDeviceTargetGPU()) {
|
||||
DumpGPUMemToFile(file_path, node->fullname_with_scope(), NOT_NULL(addr), int_shapes, type, trans_flag, j,
|
||||
debugger);
|
||||
DumpGPUMemToFile(file_path, node->fullname_with_scope(), NOT_NULL(addr), int_shapes, type, device_type,
|
||||
trans_flag, j, debugger);
|
||||
} else {
|
||||
DumpMemToFile(file_path, NOT_NULL(addr), int_shapes, type, trans_flag);
|
||||
}
|
||||
|
@ -145,9 +147,11 @@ void E2eDump::DumpInputImpl(const CNodePtr &node, bool trans_flag, const std::st
|
|||
ShapeVector int_shapes;
|
||||
GetDumpIntShape(input, index, NOT_NULL(&int_shapes), trans_flag);
|
||||
auto type = AnfAlgo::GetOutputInferDataType(input, index);
|
||||
auto device_type = AnfAlgo::GetOutputDeviceDataType(input, index);
|
||||
std::string file_path = dump_path + '/' + *kernel_name + '_' + "input_" + std::to_string(j);
|
||||
if (IsDeviceTargetGPU()) {
|
||||
DumpGPUMemToFile(file_path, tensor_name, NOT_NULL(addr), int_shapes, type, trans_flag, slot, debugger);
|
||||
DumpGPUMemToFile(file_path, tensor_name, NOT_NULL(addr), int_shapes, type, device_type, trans_flag, slot,
|
||||
debugger);
|
||||
} else {
|
||||
DumpMemToFile(file_path, NOT_NULL(addr), int_shapes, type, trans_flag);
|
||||
}
|
||||
|
@ -185,10 +189,11 @@ void E2eDump::DumpSingleAnfNode(const AnfNodePtr &anf_node, const size_t output_
|
|||
ShapeVector int_shapes;
|
||||
GetDumpIntShape(anf_node, output_index, NOT_NULL(&int_shapes), trans_flag);
|
||||
auto type = AnfAlgo::GetOutputInferDataType(anf_node, output_index);
|
||||
auto device_type = AnfAlgo::GetOutputDeviceDataType(anf_node, output_index);
|
||||
|
||||
std::string file_path = dump_path + '/' + dump_name + '_' + "output_0";
|
||||
if (IsDeviceTargetGPU()) {
|
||||
DumpGPUMemToFile(file_path, node_name, NOT_NULL(addr), int_shapes, type, trans_flag, 0, debugger);
|
||||
DumpGPUMemToFile(file_path, node_name, NOT_NULL(addr), int_shapes, type, device_type, trans_flag, 0, debugger);
|
||||
} else {
|
||||
DumpMemToFile(file_path, NOT_NULL(addr), int_shapes, type, trans_flag);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,8 @@ class E2eDump {
|
|||
|
||||
static void DumpGPUMemToFile(const std::string &file_path, const std::string &original_kernel_name,
|
||||
NotNull<const device::DeviceAddress *> addr, const ShapeVector &int_shapes,
|
||||
const TypeId &type, bool trans_flag, size_t slot, const Debugger *debugger);
|
||||
const TypeId &host_type, const TypeId &device_type, bool trans_flag, size_t slot,
|
||||
const Debugger *debugger);
|
||||
static bool IsDeviceTargetGPU();
|
||||
static void DumpSingleAnfNode(const AnfNodePtr &anf_node, const size_t output_index, const std::string &dump_path,
|
||||
bool trans_flag, std::map<std::string, size_t> *const_map, const Debugger *debugger);
|
||||
|
|
|
@ -887,10 +887,10 @@ void DebugServices::EmptyCurrentTensor() { tensor_loader_->EmptyCurrentTensor();
|
|||
#ifdef ONLINE_DBG_MODE
|
||||
bool DebugServices::DumpTensorToFile(const std::string &tensor_name, bool trans_flag, const std::string &filepath,
|
||||
const std::string &host_fmt, const std::vector<int64_t> &host_shape,
|
||||
TypeId host_type, TypeId addr_type_id, const std::string &addr_format,
|
||||
TypeId host_type, TypeId device_type, const std::string &addr_format,
|
||||
size_t slot) const {
|
||||
return tensor_loader_->DumpTensorToFile(tensor_name, trans_flag, filepath, host_fmt, host_shape, host_type,
|
||||
addr_type_id, addr_format, slot);
|
||||
device_type, addr_format, slot);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ class DebugServices {
|
|||
#ifdef ONLINE_DBG_MODE
|
||||
bool DumpTensorToFile(const std::string &tensor_name, bool trans_flag, const std::string &filepath,
|
||||
const std::string &host_fmt, const std::vector<int64_t> &host_shape, TypeId host_type,
|
||||
TypeId addr_type_id, const std::string &addr_format, size_t slot) const;
|
||||
TypeId device_type, const std::string &addr_format, size_t slot) const;
|
||||
#endif
|
||||
|
||||
bool LoadNewTensor(const std::shared_ptr<TensorData> &tensor, bool keep_prev);
|
||||
|
|
|
@ -881,9 +881,9 @@ void Debugger::SendWatchpoints(const std::list<WatchpointHit> &points) {
|
|||
|
||||
bool Debugger::DumpTensorToFile(const std::string &tensor_name, bool trans_flag, const std::string &filepath,
|
||||
const std::string &host_fmt, const std::vector<int64_t> &host_shape, TypeId host_type,
|
||||
TypeId addr_type_id, const std::string &addr_format, size_t slot) const {
|
||||
TypeId device_type, const std::string &addr_format, size_t slot) const {
|
||||
return debug_services_.get()->DumpTensorToFile(tensor_name, trans_flag, filepath, host_fmt, host_shape, host_type,
|
||||
addr_type_id, addr_format, slot);
|
||||
device_type, addr_format, slot);
|
||||
}
|
||||
|
||||
bool Debugger::DebugServicesIsWatchPoint(const std::string &kernel_name, const CNodePtr &kernel) const {
|
||||
|
|
|
@ -91,7 +91,7 @@ class Debugger : public std::enable_shared_from_this<Debugger> {
|
|||
|
||||
bool DumpTensorToFile(const std::string &tensor_name, bool trans_flag, const std::string &filepath,
|
||||
const std::string &host_fmt, const std::vector<int64_t> &host_shape, TypeId host_type,
|
||||
TypeId addr_type_id, const std::string &addr_format, size_t slot) const;
|
||||
TypeId device_type, const std::string &addr_format, size_t slot) const;
|
||||
|
||||
bool DebugServicesIsWatchPoint(const std::string &kernel_name, const CNodePtr &kernel = nullptr) const;
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ class TensorLoader {
|
|||
#ifdef ONLINE_DBG_MODE
|
||||
bool DumpTensorToFile(const std::string &tensor_name, bool trans_flag, const std::string &filepath,
|
||||
const std::string &host_fmt, const std::vector<int64_t> &host_shape, TypeId host_type,
|
||||
TypeId addr_type_id, const std::string &addr_format, size_t slot) {
|
||||
TypeId device_type, const std::string &addr_format, size_t slot) {
|
||||
if (filepath.empty()) {
|
||||
MS_LOG(ERROR) << "Dump file path is null!";
|
||||
return false;
|
||||
|
@ -177,7 +177,7 @@ class TensorLoader {
|
|||
if (trans_flag) {
|
||||
path = filepath + '_' + shape + '_' + TypeIdToType(host_type)->ToString() + '_' + host_fmt + file_extension;
|
||||
} else {
|
||||
path = filepath + '_' + shape + '_' + TypeIdToType(addr_type_id)->ToString() + '_' + addr_format + file_extension;
|
||||
path = filepath + '_' + shape + '_' + TypeIdToType(device_type)->ToString() + '_' + addr_format + file_extension;
|
||||
}
|
||||
|
||||
MS_LOG(INFO) << "Dump path is " << path;
|
||||
|
|
Loading…
Reference in New Issue