!6765 [MS][LITE][GPU]fix bug: softmax precision, model random zero

Merge pull request !6765 from chenzupeng/r1.0
pull/6765/MERGE
mindspore-ci-bot 5 years ago committed by Gitee
commit fdc41ab843

File diff suppressed because it is too large Load Diff

@ -129,7 +129,7 @@ int SubGraphOpenCLKernel::GenToFormatOp(const std::vector<lite::Tensor *> &in_te
MS_LOG(ERROR) << "SubGraphOpenCLKernel create op failed!";
delete new_tensor;
new_tensor = nullptr;
delete parameter;
free(parameter);
parameter = nullptr;
return RET_ERROR;
}

@ -111,8 +111,8 @@ void *OpenCLAllocator::Malloc(size_t size, const std::vector<size_t> &img_size)
ocl_runtime_->UnmapBuffer(*mem, host_ptr);
if (!img_size.empty()) {
cl::ImageFormat image_format(CL_RGBA, img_size[2]);
image = new (std::nothrow) cl::Image2D(*ocl_runtime_->Context(), image_format, *buffer, img_size[0],
img_size[1], img_pitch * dtype_size, &ret);
image = new (std::nothrow) cl::Image2D(*ocl_runtime_->Context(), image_format, *buffer, img_size[0], img_size[1],
img_pitch * dtype_size, &ret);
if (image == nullptr || ret != CL_SUCCESS) {
delete buffer;
UnLock();
@ -265,6 +265,9 @@ void OpenCLAllocator::Clear() {
Lock();
auto svm_capabilities = ocl_runtime_->GetSVMCapabilities();
for (auto it = allocated_list_.begin(); it != allocated_list_.end(); it++) {
if (it->second->map_flags) {
UnmapBuffer(it->second->host_ptr_);
}
if (svm_capabilities) {
clSVMFree((*ocl_runtime_->Context())(), it->second->host_ptr_);
MS_LOG(DEBUG) << "OpenCL free svm buffer : " << it->second->host_ptr_;

@ -63,7 +63,7 @@ class OpenCLAllocator : public Allocator {
int GetImageSize(void *host_ptr, std::vector<size_t> *img_size);
void *Prepare(void *ptr) override {
if (ptr != nullptr) {
ptr = MapBuffer(ptr, CL_MAP_WRITE, nullptr, true);
ptr = MapBuffer(ptr, CL_MAP_READ | CL_MAP_WRITE, nullptr, true);
}
return ptr;
}

@ -184,6 +184,7 @@ class Tensor : public mindspore::tensor::MSTensor {
MS_LOG(WARNING) << "Malloc data failed";
}
}
Prepare();
return this->data_;
}

Loading…
Cancel
Save