diff --git a/mindspore/ccsrc/runtime/device/ascend/dump/data_dumper.cc b/mindspore/ccsrc/runtime/device/ascend/dump/data_dumper.cc index ab2c6b27486c8e375ca888ffba09c3879d9c8e54..ca9a74022ac9afa4c421eeefb9713c43436d3054 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 32f5fcced9e5b8bcb12cb79520b8269666771d4f..fb3cf63488d872b89472e5617bb6d23eb2fa9e21 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 a6bbe92233a7b948de04e099858badd0ff4e59ee..708b6b0e56518c477e7123e7f9661ea12c66cf06 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