Browse Source

fix code review warnings

tags/v0.5.0-beta
lizhenyu 5 years ago
parent
commit
2d16316c55
4 changed files with 12 additions and 13 deletions
  1. +0
    -2
      mindspore/ccsrc/device/gpu/gpu_device_address.cc
  2. +0
    -2
      mindspore/ccsrc/device/gpu/gpu_kernel_build.cc
  3. +7
    -5
      mindspore/ccsrc/pre_activate/mem_reuse/mem_swap_manager.cc
  4. +5
    -4
      mindspore/ccsrc/pre_activate/mem_reuse/mem_swap_manager.h

+ 0
- 2
mindspore/ccsrc/device/gpu/gpu_device_address.cc View File

@@ -15,9 +15,7 @@
*/

#include "device/gpu/gpu_device_address.h"

#include <vector>

#include "device/gpu/gpu_device_manager.h"
#include "utils/log_adapter.h"
#include "utils/context/ms_context.h"


+ 0
- 2
mindspore/ccsrc/device/gpu/gpu_kernel_build.cc View File

@@ -20,12 +20,10 @@
#include "kernel/akg/gpu/akg_gpu_kernel_build.h"
#include "kernel/gpu/gpu_kernel_factory.h"
#include "operator/ops.h"
#include "pybind11/stl.h"
#include "session/anf_runtime_algorithm.h"
namespace mindspore {
namespace device {
namespace gpu {
namespace py = pybind11;
void GpuBuild(const KernelGraphPtr &kernel_graph) {
kernel::KernelMeta *bin_map = kernel::KernelMeta::GetInstance();
bin_map->Initialize();


+ 7
- 5
mindspore/ccsrc/pre_activate/mem_reuse/mem_swap_manager.cc View File

@@ -28,7 +28,7 @@ void MemSwapManager::Init(const mindspore::session::KernelGraph *kernel_graph) {
size_t kernel_index = 0;
for (const auto &kernel : execution_order_) {
// parse topo order of kernel
kernel_execution_info_.emplace(kernel.get(), kernel_index++);
(void)kernel_execution_info_.emplace(kernel.get(), kernel_index++);
// parse tensor info
auto kernel_mod = AnfAlgo::GetKernelMod(kernel);
MS_EXCEPTION_IF_NULL(kernel_mod);
@@ -144,7 +144,7 @@ void MemSwapManager::AddSwapInfo() {
}

void MemSwapManager::AddMemSwapTask(SwapKind swap_kind, const DeviceAddressPtr &device_address,
const HostAddress &host_address) {
const HostAddress &host_address) const {
if (swap_kind == SwapKind::kDeviceToHost) {
mem_copy_manager_->AddMemSwapOutTask(device_address, host_address);
} else if (swap_kind == SwapKind::kHostToDevice) {
@@ -152,9 +152,11 @@ void MemSwapManager::AddMemSwapTask(SwapKind swap_kind, const DeviceAddressPtr &
}
}

bool MemSwapManager::SyncMemCopyStream(SwapKind swap_kind) { return mem_copy_manager_->SyncMemCopyStream(swap_kind); }
bool MemSwapManager::SyncMemCopyStream(SwapKind swap_kind) const {
return mem_copy_manager_->SyncMemCopyStream(swap_kind);
}

DeviceAddressPtr MemSwapManager::UpdateSwapQueue(SwapKind swap_kind) {
DeviceAddressPtr MemSwapManager::UpdateSwapQueue(SwapKind swap_kind) const {
if (swap_kind == SwapKind::kDeviceToHost) {
return mem_copy_manager_->UpdateSwapOutQueue();
} else {
@@ -298,7 +300,7 @@ void MemSwapManager::ReleaseHostPinnedMem() {
host_addrs_list_.clear();
}

void MemSwapManager::ClearSwapQueue() { mem_copy_manager_->ClearSwapQueue(); }
void MemSwapManager::ClearSwapQueue() const { mem_copy_manager_->ClearSwapQueue(); }

void MemSwapManager::ResetSwapInfo() {
ClearSwapQueue();


+ 5
- 4
mindspore/ccsrc/pre_activate/mem_reuse/mem_swap_manager.h View File

@@ -44,11 +44,12 @@ class MemSwapManager {

void Init(const mindspore::session::KernelGraph *kernel_graph);

void AddMemSwapTask(SwapKind swap_kind, const DeviceAddressPtr &device_address, const HostAddress &host_address);
void AddMemSwapTask(SwapKind swap_kind, const DeviceAddressPtr &device_address,
const HostAddress &host_address) const;

bool SyncMemCopyStream(SwapKind swap_kind);
bool SyncMemCopyStream(SwapKind swap_kind) const;

DeviceAddressPtr UpdateSwapQueue(SwapKind swap_kind);
DeviceAddressPtr UpdateSwapQueue(SwapKind swap_kind) const;

// retreat to find a workable swap scheme
bool RetreatSwapInfo();
@@ -83,7 +84,7 @@ class MemSwapManager {

void ReleaseHostPinnedMem();

void ClearSwapQueue();
void ClearSwapQueue() const;

private:
void AddSwapInfo();


Loading…
Cancel
Save