P4 to Git Change 1503207 by wchau@wchau_OCL_boltzmann on 2018/01/12 14:51:08
SWDEV-140733 - OpenCL Runtime Support for Raven BU in ROCm
- Fix OCLMemoryInfo issue of incorrect free memory info
- Fix OCLPerfMemCreate failure due to memory leak
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#31 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.cpp#30 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.hpp#12 edit
[ROCm/clr commit: 074f37ac4d]
Этот коммит содержится в:
@@ -579,17 +579,25 @@ void Buffer::destroy() {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if ((deviceMemory_ != nullptr) && (deviceMemory_ != owner()->getHostMem())) {
|
||||
// if they are identical, the host pointer will be
|
||||
// deallocated later on => avoid double deallocation
|
||||
if (isHostMemDirectAccess()) {
|
||||
if (memFlags & (CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR)) {
|
||||
if (dev().agent_profile() != HSA_PROFILE_FULL) {
|
||||
hsa_amd_memory_unlock(owner()->getHostMem());
|
||||
if (deviceMemory_ != nullptr) {
|
||||
if (deviceMemory_ != owner()->getHostMem()) {
|
||||
// if they are identical, the host pointer will be
|
||||
// deallocated later on => avoid double deallocation
|
||||
if (isHostMemDirectAccess()) {
|
||||
if (memFlags & (CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR)) {
|
||||
if (dev().agent_profile() != HSA_PROFILE_FULL) {
|
||||
hsa_amd_memory_unlock(owner()->getHostMem());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dev().memFree(deviceMemory_, size());
|
||||
const_cast<Device&>(dev()).updateFreeMemory(size(), true);
|
||||
}
|
||||
}
|
||||
else if (dev().settings().apuSystem_) {
|
||||
if (!(memFlags & (CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR))) {
|
||||
dev().memFree(deviceMemory_, size());
|
||||
}
|
||||
} else {
|
||||
dev().memFree(deviceMemory_, size());
|
||||
const_cast<Device&>(dev()).updateFreeMemory(size(), true);
|
||||
}
|
||||
}
|
||||
@@ -672,6 +680,10 @@ bool Buffer::create() {
|
||||
|
||||
deviceMemory_ = dev().hostAlloc(size(), 1, false);
|
||||
owner()->setHostMem(deviceMemory_);
|
||||
|
||||
if (dev().settings().apuSystem_) {
|
||||
const_cast<Device&>(dev()).updateFreeMemory(size(), false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const_cast<Device&>(dev()).updateFreeMemory(size(), false);
|
||||
@@ -938,6 +950,9 @@ bool Image::create() {
|
||||
|
||||
if (originalDeviceMemory_ == nullptr) {
|
||||
originalDeviceMemory_ = dev().hostAlloc(alloc_size, 1, false);
|
||||
if (dev().settings().apuSystem_) {
|
||||
const_cast<Device&>(dev()).updateFreeMemory(alloc_size, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const_cast<Device&>(dev()).updateFreeMemory(alloc_size, false);
|
||||
|
||||
@@ -72,6 +72,8 @@ Settings::Settings() {
|
||||
|
||||
// Don't support Denormals for single precision by default
|
||||
singleFpDenorm_ = false;
|
||||
|
||||
apuSystem_ = false;
|
||||
}
|
||||
|
||||
bool Settings::create(bool fullProfile, int gfxipVersion) {
|
||||
@@ -124,6 +126,10 @@ bool Settings::create(bool fullProfile, int gfxipVersion) {
|
||||
}
|
||||
#endif // WITH_LIGHTNING_COMPILER
|
||||
|
||||
if (gfxipVersion == 902) {
|
||||
apuSystem_ = true;
|
||||
}
|
||||
|
||||
// Override current device settings
|
||||
override();
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ class Settings : public device::Settings {
|
||||
uint stagedXferRead_ : 1; //!< Uses a staged buffer read
|
||||
uint stagedXferWrite_ : 1; //!< Uses a staged buffer write
|
||||
uint singleFpDenorm_ : 1; //!< Support Single FP Denorm
|
||||
uint reserved_ : 21;
|
||||
uint apuSystem_ : 1; //!< APU system
|
||||
uint reserved_ : 20;
|
||||
};
|
||||
uint value_;
|
||||
};
|
||||
|
||||
Ссылка в новой задаче
Block a user