forked from mindspore-Ecosystem/mindspore
!3089 Fix data dump device address cannot access
Merge pull request !3089 from caifubi/data-dump-new
This commit is contained in:
commit
8300802b95
|
@ -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(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<uint64_t>(current_epoch));
|
||||
|
|
|
@ -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_; }
|
||||
|
|
|
@ -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 SyncHostToDevice(const std::vector<int> &shape, size_t size, TypeId type,
|
||||
const void *host_ptr) const = 0;
|
||||
virtual void *GetMutablePtr() const = 0;
|
||||
};
|
||||
using DeviceSyncPtr = std::shared_ptr<DeviceSync>;
|
||||
} // namespace mindspore
|
||||
|
|
Loading…
Reference in New Issue