diff --git a/mindspore/ccsrc/runtime/device/ascend/dump/data_dumper.cc b/mindspore/ccsrc/runtime/device/ascend/dump/data_dumper.cc index ab2c6b27486..ca9a74022ac 100644 --- a/mindspore/ccsrc/runtime/device/ascend/dump/data_dumper.cc +++ b/mindspore/ccsrc/runtime/device/ascend/dump/data_dumper.cc @@ -107,9 +107,9 @@ void DataDumper::SetOpMappingInfo(NotNull dump_inf MS_EXCEPTION_IF_NULL(currnet_epoch_tensor->device_address()); MS_EXCEPTION_IF_NULL(steps_per_epoch_tensor->device_address()); - void *current_step = current_step_tensor->device_address()->ptr_; - void *current_epoch = currnet_epoch_tensor->device_address()->ptr_; - void *steps_per_epoch = steps_per_epoch_tensor->device_address()->ptr_; + void *current_step = current_step_tensor->device_address()->GetMutablePtr(); + void *current_epoch = currnet_epoch_tensor->device_address()->GetMutablePtr(); + void *steps_per_epoch = steps_per_epoch_tensor->device_address()->GetMutablePtr(); if (current_epoch != nullptr && current_step != nullptr && steps_per_epoch != nullptr) { dump_info->set_step_id_addr(reinterpret_cast(current_epoch)); diff --git a/mindspore/ccsrc/runtime/device/device_address.h b/mindspore/ccsrc/runtime/device/device_address.h index 32f5fcced9e..fb3cf63488d 100644 --- a/mindspore/ccsrc/runtime/device/device_address.h +++ b/mindspore/ccsrc/runtime/device/device_address.h @@ -65,6 +65,7 @@ class DeviceAddress : public mindspore::DeviceSync { virtual void set_status(DeviceAddressStatus status) {} virtual DeviceAddressStatus status() const { return DeviceAddressStatus::kInDevice; } virtual DeviceAddressType DeviceType() const { return DeviceAddressType::kUnknown; } + void *GetMutablePtr() const override { return ptr_; } protected: const void *ptr() const { return ptr_; } diff --git a/mindspore/core/ir/device_sync.h b/mindspore/core/ir/device_sync.h index a6bbe92233a..708b6b0e565 100644 --- a/mindspore/core/ir/device_sync.h +++ b/mindspore/core/ir/device_sync.h @@ -32,6 +32,7 @@ class DeviceSync { virtual bool SyncDeviceToHost(const std::vector &shape, size_t size, TypeId type, void *host_ptr) const = 0; virtual bool SyncHostToDevice(const std::vector &shape, size_t size, TypeId type, const void *host_ptr) const = 0; + virtual void *GetMutablePtr() const = 0; }; using DeviceSyncPtr = std::shared_ptr; } // namespace mindspore