提交 3f03480e 编写于 作者: C caifubi

fix dump device address cannot access

上级 3e691e54
...@@ -107,9 +107,9 @@ void DataDumper::SetOpMappingInfo(NotNull<aicpu::dump::OpMappingInfo *> dump_inf ...@@ -107,9 +107,9 @@ void DataDumper::SetOpMappingInfo(NotNull<aicpu::dump::OpMappingInfo *> dump_inf
MS_EXCEPTION_IF_NULL(currnet_epoch_tensor->device_address()); MS_EXCEPTION_IF_NULL(currnet_epoch_tensor->device_address());
MS_EXCEPTION_IF_NULL(steps_per_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_step = current_step_tensor->device_address()->GetMutablePtr();
void *current_epoch = currnet_epoch_tensor->device_address()->ptr_; void *current_epoch = currnet_epoch_tensor->device_address()->GetMutablePtr();
void *steps_per_epoch = steps_per_epoch_tensor->device_address()->ptr_; void *steps_per_epoch = steps_per_epoch_tensor->device_address()->GetMutablePtr();
if (current_epoch != nullptr && current_step != nullptr && steps_per_epoch != nullptr) { if (current_epoch != nullptr && current_step != nullptr && steps_per_epoch != nullptr) {
dump_info->set_step_id_addr(reinterpret_cast<uint64_t>(current_epoch)); dump_info->set_step_id_addr(reinterpret_cast<uint64_t>(current_epoch));
......
...@@ -65,6 +65,7 @@ class DeviceAddress : public mindspore::DeviceSync { ...@@ -65,6 +65,7 @@ class DeviceAddress : public mindspore::DeviceSync {
virtual void set_status(DeviceAddressStatus status) {} virtual void set_status(DeviceAddressStatus status) {}
virtual DeviceAddressStatus status() const { return DeviceAddressStatus::kInDevice; } virtual DeviceAddressStatus status() const { return DeviceAddressStatus::kInDevice; }
virtual DeviceAddressType DeviceType() const { return DeviceAddressType::kUnknown; } virtual DeviceAddressType DeviceType() const { return DeviceAddressType::kUnknown; }
void *GetMutablePtr() const override { return ptr_; }
protected: protected:
const void *ptr() const { return ptr_; } const void *ptr() const { return ptr_; }
......
...@@ -32,6 +32,7 @@ class DeviceSync { ...@@ -32,6 +32,7 @@ class DeviceSync {
virtual bool SyncDeviceToHost(const std::vector<int> &shape, size_t size, TypeId type, void *host_ptr) const = 0; virtual bool SyncDeviceToHost(const std::vector<int> &shape, size_t size, TypeId type, void *host_ptr) const = 0;
virtual bool SyncHostToDevice(const std::vector<int> &shape, size_t size, TypeId type, virtual bool SyncHostToDevice(const std::vector<int> &shape, size_t size, TypeId type,
const void *host_ptr) const = 0; const void *host_ptr) const = 0;
virtual void *GetMutablePtr() const = 0;
}; };
using DeviceSyncPtr = std::shared_ptr<DeviceSync>; using DeviceSyncPtr = std::shared_ptr<DeviceSync>;
} // namespace mindspore } // namespace mindspore
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册