From 11e70960a23dcebd1d6d2f8e41c83014227a2bcb Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 15 May 2017 19:42:30 -0400
Subject: [PATCH] P4 to Git Change 1409878 by lmoriche@lmoriche_palamida on
2017/05/15 19:30:18
SWDEV-121585 - [OCL-LC-ROCm] Merge GitHub pull requests
- Merged https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/pull/4
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_gl.cpp#55 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/libUtils.h#28 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/appprofile.cpp#19 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocbinary.hpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#18 edit
... //depot/stg/opencl/drivers/opencl/runtime/os/os_win32.cpp#48 edit
[ROCm/clr commit: 0c526a2e0d291fe5bc032316fb828d74bcdc616f]
---
projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h | 6 ++++--
projects/clr/rocclr/runtime/device/appprofile.cpp | 2 +-
projects/clr/rocclr/runtime/device/rocm/rocbinary.hpp | 1 -
projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp | 5 ++---
projects/clr/rocclr/runtime/os/os_win32.cpp | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h
index 50b0aead82..7e3a85e20f 100644
--- a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h
+++ b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h
@@ -231,11 +231,11 @@ aclutUpdateMetadataWithHiddenKernargsNum(aclCompiler* cl, aclBinary* bin, uint32
char* kernelNames = new char[kernelNamesSize];
error_code = aclQueryInfo(cl, bin, RT_KERNEL_NAMES, NULL, kernelNames, &kernelNamesSize);
if (error_code != ACL_SUCCESS) {
- delete kernelNames;
+ delete[] kernelNames;
return error_code;
}
std::vector vKernels = splitSpaceSeparatedString(kernelNames);
- delete kernelNames;
+ delete[] kernelNames;
size_t roSize = 0;
for (auto it = vKernels.begin(); it != vKernels.end(); ++it) {
std::string symbol = aclutOpenclMangledKernelMetadataName(*it);
@@ -359,6 +359,7 @@ inline char* readFile(std::string source_filename, size_t& size)
if (length != fread(&ptr[offset], 1, length, fp))
{
::free(ptr);
+ ::fclose(fp);
return NULL;
}
ptr[offset + length] = '\0';
@@ -377,6 +378,7 @@ inline bool writeFile(std::string source_filename, const char *source, size_t si
return EXIT_FAILURE;
}
if (!::fwrite(source, size, 1, fp)) {
+ ::fclose(fp);
return EXIT_FAILURE;
}
::fclose(fp);
diff --git a/projects/clr/rocclr/runtime/device/appprofile.cpp b/projects/clr/rocclr/runtime/device/appprofile.cpp
index 868c770450..c32bc0a701 100644
--- a/projects/clr/rocclr/runtime/device/appprofile.cpp
+++ b/projects/clr/rocclr/runtime/device/appprofile.cpp
@@ -158,7 +158,7 @@ bool AppProfile::init() {
wsAppFileName_ = appName;
- delete appName;
+ delete[] appName;
ParseApplicationProfile();
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocbinary.hpp b/projects/clr/rocclr/runtime/device/rocm/rocbinary.hpp
index 056a038787..757bf797bc 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocbinary.hpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocbinary.hpp
@@ -27,7 +27,6 @@ class ClBinary : public device::ClBinary {
assert(((0xFFFF8000 & target) == 0) && "ASIC target ID >= 2^15");
uint16_t elf_target = (uint16_t)(0x7FFF & target);
return elfOut()->setTarget(elf_target, amd::OclElf::CAL_PLATFORM);
- return true;
}
private:
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp
index 720ade81c3..7130476f68 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp
@@ -585,9 +585,8 @@ bool Buffer::create() {
if (nullptr != owner()->parent()) {
amd::Memory& parent = *owner()->parent();
- // Sub-Buffer creation.
- roc:
- Memory* parentBuffer = static_cast(parent.getDeviceMemory(dev_));
+ // Sub-Buffer creation.
+ roc::Memory* parentBuffer = static_cast(parent.getDeviceMemory(dev_));
if (parentBuffer == nullptr) {
LogError("[OCL] Fail to allocate parent buffer");
diff --git a/projects/clr/rocclr/runtime/os/os_win32.cpp b/projects/clr/rocclr/runtime/os/os_win32.cpp
index 909d6cb305..0cb98534d3 100644
--- a/projects/clr/rocclr/runtime/os/os_win32.cpp
+++ b/projects/clr/rocclr/runtime/os/os_win32.cpp
@@ -940,7 +940,7 @@ std::string Os::getAppFileName() {
strFileName = strrchr(buff, '\\') ? strrchr(buff, '\\') + 1 : buff;
}
- delete buff;
+ delete[] buff;
return strFileName;
}